You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@submarine.apache.org by GitBox <gi...@apache.org> on 2020/04/16 04:18:06 UTC

[GitHub] [submarine] tangzhankun commented on a change in pull request #263: SUBMARINE-442. Support get job's log in submarine-server REST API

tangzhankun commented on a change in pull request #263: SUBMARINE-442. Support get job's log in submarine-server REST API
URL: https://github.com/apache/submarine/pull/263#discussion_r409270029
 
 

 ##########
 File path: submarine-server/server-submitter/submitter-k8s/src/main/java/org/apache/submarine/server/submitter/k8s/K8sJobSubmitter.java
 ##########
 @@ -186,6 +197,80 @@ private Job parseResponseObject(Object object, ParseOp op) throws SubmarineRunti
     throw new SubmarineRuntimeException(500, "K8s Submitter parse upstream response failed.");
   }
 
+  public String getLog(final Job job) {
+    if (job == null) {
+      return null;
+    }
+    final CoreV1Api COREV1_API = new CoreV1Api(client);
+
+    try {
+      final V1PodList podList = COREV1_API.listNamespacedPod(
+          job.getSpec().getSubmitterSpec().getNamespace(),
+          "false", null, null,
+          getJobLabelSelector(job), null, null,
+          null, null);
+
+      final V1Pod pod = podList.getItems().get(0);
 
 Review comment:
   It would be several containers in the "podList", here it only gets the first one. Is it better that we merge all container's pod with a format? Like this:
   {
   jobId: job_123,
   jobType: tensorflow,
   LogContent: [
   {podName: tf-ps-0,
   podLog: 123123123},
   {podName: tf-worker-0,
   podLog: 456456456},
   ...
   ]
   }
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services