YARN-7916. Remove call to docker logs on failure in container-executor. 
Contributed by Shane Kumpf


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/3132709b
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/3132709b
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/3132709b

Branch: refs/heads/HDFS-12996
Commit: 3132709b46a35f70cf5278f3ace677e6e18a1d03
Parents: 2bc3351
Author: Jason Lowe <jl...@apache.org>
Authored: Wed Feb 21 16:54:02 2018 -0600
Committer: Jason Lowe <jl...@apache.org>
Committed: Wed Feb 21 16:54:02 2018 -0600

----------------------------------------------------------------------
 .../impl/container-executor.c                   | 35 --------------------
 1 file changed, 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/3132709b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
index 035c694..751949e 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/native/container-executor/impl/container-executor.c
@@ -1435,20 +1435,16 @@ int launch_docker_container_as_user(const char * user, 
const char *app_id,
   char *exit_code_file = NULL;
   char *docker_command_with_binary = NULL;
   char *docker_wait_command = NULL;
-  char *docker_logs_command = NULL;
   char *docker_inspect_command = NULL;
   char *docker_rm_command = NULL;
   char *docker_inspect_exitcode_command = NULL;
   int container_file_source =-1;
   int cred_file_source = -1;
-  int BUFFER_SIZE = 4096;
-  char buffer[BUFFER_SIZE];
 
   size_t command_size = MIN(sysconf(_SC_ARG_MAX), 128*1024);
 
   docker_command_with_binary = (char *) alloc_and_clear_memory(command_size, 
sizeof(char));
   docker_wait_command = (char *) alloc_and_clear_memory(command_size, 
sizeof(char));
-  docker_logs_command = (char *) alloc_and_clear_memory(command_size, 
sizeof(char));
   docker_inspect_command = (char *) alloc_and_clear_memory(command_size, 
sizeof(char));
   docker_rm_command = (char *) alloc_and_clear_memory(command_size, 
sizeof(char));
   docker_inspect_exitcode_command = (char *) 
alloc_and_clear_memory(command_size, sizeof(char));
@@ -1600,36 +1596,6 @@ int launch_docker_container_as_user(const char * user, 
const char *app_id,
     goto cleanup;
   }
   fprintf(LOGFILE, "Exit code from docker inspect: %d\n", exit_code);
-  if(exit_code != 0) {
-    fprintf(ERRORFILE, "Docker container exit code was not zero: %d\n",
-    exit_code);
-    snprintf(docker_logs_command, command_size, "%s logs --tail=250 %s",
-      docker_binary, container_id);
-    FILE* logs = popen(docker_logs_command, "r");
-    if(logs != NULL) {
-      clearerr(logs);
-      res = fread(buffer, BUFFER_SIZE, 1, logs);
-      if(res < 1) {
-        fprintf(ERRORFILE, "%s %d %d\n",
-          "Unable to read from docker logs(ferror, feof):", ferror(logs), 
feof(logs));
-        fflush(ERRORFILE);
-      }
-      else {
-        fprintf(ERRORFILE, "%s\n", buffer);
-        fflush(ERRORFILE);
-      }
-    }
-    else {
-      fprintf(ERRORFILE, "%s\n", "Failed to get output of docker logs");
-      fprintf(ERRORFILE, "Command was '%s'\n", docker_logs_command);
-      fprintf(ERRORFILE, "%s\n", strerror(errno));
-      fflush(ERRORFILE);
-    }
-    if(pclose(logs) != 0) {
-      fprintf(ERRORFILE, "%s\n", "Failed to fetch docker logs");
-      fflush(ERRORFILE);
-    }
-  }
 
 cleanup:
 
@@ -1662,7 +1628,6 @@ cleanup:
   free(cred_file_dest);
   free(docker_command_with_binary);
   free(docker_wait_command);
-  free(docker_logs_command);
   free(docker_inspect_command);
   free(docker_rm_command);
   return exit_code;


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to