Return-Path: X-Original-To: apmail-hadoop-yarn-commits-archive@minotaur.apache.org Delivered-To: apmail-hadoop-yarn-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 144CE10C14 for ; Sun, 6 Oct 2013 00:15:18 +0000 (UTC) Received: (qmail 34491 invoked by uid 500); 6 Oct 2013 00:15:17 -0000 Delivered-To: apmail-hadoop-yarn-commits-archive@hadoop.apache.org Received: (qmail 34464 invoked by uid 500); 6 Oct 2013 00:15:17 -0000 Mailing-List: contact yarn-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: yarn-commits@hadoop.apache.org Delivered-To: mailing list yarn-commits@hadoop.apache.org Received: (qmail 34454 invoked by uid 99); 6 Oct 2013 00:15:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Oct 2013 00:15:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Oct 2013 00:15:16 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id BAC99238883D; Sun, 6 Oct 2013 00:14:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1529555 - in /hadoop/common/trunk/hadoop-yarn-project: CHANGES.txt hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c Date: Sun, 06 Oct 2013 00:14:55 -0000 To: yarn-commits@hadoop.apache.org From: vinodkv@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131006001455.BAC99238883D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: vinodkv Date: Sun Oct 6 00:14:55 2013 New Revision: 1529555 URL: http://svn.apache.org/r1529555 Log: YARN-1274. Fixed NodeManager's LinuxContainerExecutor to create user, app-dir and log-dirs correctly even when there are no resources to localize for the container. Contributed by Siddharth Seth. Modified: hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c Modified: hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt?rev=1529555&r1=1529554&r2=1529555&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt (original) +++ hadoop/common/trunk/hadoop-yarn-project/CHANGES.txt Sun Oct 6 00:14:55 2013 @@ -184,6 +184,10 @@ Release 2.1.2 - UNRELEASED YARN-1090. Fixed CS UI to better reflect applications as non-schedulable and not as pending. (Jian He via acmurthy) + YARN-1274. Fixed NodeManager's LinuxContainerExecutor to create user, app-dir + and log-dirs correctly even when there are no resources to localize for the + container. (Siddharth Seth via vinodkv) + Release 2.1.1-beta - 2013-09-23 INCOMPATIBLE CHANGES Modified: hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c?rev=1529555&r1=1529554&r2=1529555&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c (original) +++ hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c Sun Oct 6 00:14:55 2013 @@ -751,28 +751,11 @@ int initialize_user(const char *user, ch return failed ? INITIALIZE_USER_FAILED : 0; } -/** - * Function to prepare the application directories for the container. - */ -int initialize_app(const char *user, const char *app_id, - const char* nmPrivate_credentials_file, - char* const* local_dirs, char* const* log_roots, - char* const* args) { - if (app_id == NULL || user == NULL || user_detail == NULL || user_detail->pw_name == NULL) { - fprintf(LOGFILE, "Either app_id is null or the user passed is null.\n"); - return INVALID_ARGUMENT_NUMBER; - } +int create_log_dirs(const char *app_id, char * const * log_dirs) { - // create the user directory on all disks - int result = initialize_user(user, local_dirs); - if (result != 0) { - return result; - } - - ////////////// create the log directories for the app on all disks char* const* log_root; char *any_one_app_log_dir = NULL; - for(log_root=log_roots; *log_root != NULL; ++log_root) { + for(log_root=log_dirs; *log_root != NULL; ++log_root) { char *app_log_dir = get_app_log_directory(*log_root, app_id); if (app_log_dir == NULL) { // try the next one @@ -791,7 +774,33 @@ int initialize_app(const char *user, con return -1; } free(any_one_app_log_dir); - ////////////// End of creating the log directories for the app on all disks + return 0; +} + + +/** + * Function to prepare the application directories for the container. + */ +int initialize_app(const char *user, const char *app_id, + const char* nmPrivate_credentials_file, + char* const* local_dirs, char* const* log_roots, + char* const* args) { + if (app_id == NULL || user == NULL || user_detail == NULL || user_detail->pw_name == NULL) { + fprintf(LOGFILE, "Either app_id is null or the user passed is null.\n"); + return INVALID_ARGUMENT_NUMBER; + } + + // create the user directory on all disks + int result = initialize_user(user, local_dirs); + if (result != 0) { + return result; + } + + // create the log directories for the app on all disks + int log_create_result = create_log_dirs(app_id, log_roots); + if (log_create_result != 0) { + return log_create_result; + } // open up the credentials file int cred_file = open_file_as_nm(nmPrivate_credentials_file); @@ -922,18 +931,34 @@ int launch_container_as_user(const char } } + // create the user directory on all disks + int result = initialize_user(user, local_dirs); + if (result != 0) { + return result; + } + + // initializing log dirs + int log_create_result = create_log_dirs(app_id, log_dirs); + if (log_create_result != 0) { + return log_create_result; + } + // give up root privs if (change_user(user_detail->pw_uid, user_detail->pw_gid) != 0) { exit_code = SETUID_OPER_FAILED; goto cleanup; } + // Create container specific directories as user. If there are no resources + // to localize for this container, app-directories and log-directories are + // also created automatically as part of this call. if (create_container_directories(user, app_id, container_id, local_dirs, log_dirs, work_dir) != 0) { fprintf(LOGFILE, "Could not create container dirs"); goto cleanup; } + // 700 if (copy_file(container_file_source, script_name, script_file_dest,S_IRWXU) != 0) { goto cleanup;