lowc1012 commented on a change in pull request #735:
URL: https://github.com/apache/submarine/pull/735#discussion_r702243910



##########
File path: 
submarine-server/server-submitter/submitter-k8s/src/main/java/org/apache/submarine/server/submitter/k8s/K8sSubmitter.java
##########
@@ -429,10 +429,30 @@ public Notebook findNotebook(NotebookSpec spec) throws 
SubmarineRuntimeException
 
     try {
       NotebookCR notebookCR = NotebookSpecParser.parseNotebook(spec);
+
       Object object = api.getNamespacedCustomObject(notebookCR.getGroup(), 
notebookCR.getVersion(),
           namespace,
           notebookCR.getPlural(), notebookCR.getMetadata().getName());
       notebook = NotebookUtils.parseObject(object, 
NotebookUtils.ParseOpt.PARSE_OPT_GET);
+      if 
(notebook.getStatus().equals(Notebook.Status.STATUS_WAITING.toString())) {
+        LOG.info(String.format("notebook status: waiting; check the pods in 
namespace:[%s] to "
+            + "ensure is the waiting caused by image pulling", namespace));
+        String podLabelSelector = String.format("%s=%s", 
NotebookCR.NOTEBOOK_ID,
+            spec.getMeta().getLabels().get(NotebookCR.NOTEBOOK_ID).toString());
+
+        V1PodList podList = coreApi.listNamespacedPod(namespace, null, null, 
null, podLabelSelector,
+            null, null, null, null);
+        String podName = podList.getItems().get(0).getMetadata().getName();
+        String fieldSelector = String.format("involvedObject.name=%s", 
podName);
+        V1EventList events = coreApi.listNamespacedEvent(namespace, null, 
null, fieldSelector,
+            null, null, null, null, null);
+        V1Event lastestEvent = events.getItems().get(events.getItems().size() 
- 1);

Review comment:
       latestEvent?

##########
File path: 
submarine-server/server-core/src/main/java/org/apache/submarine/server/notebook/NotebookManager.java
##########
@@ -81,7 +83,17 @@ public Notebook createNotebook(NotebookSpec spec) throws 
SubmarineRuntimeExcepti
     String lowerName = spec.getMeta().getName().toLowerCase();
     spec.getMeta().setName(lowerName);
     NotebookId notebookId = generateNotebookId();
+
+    Map<String, String> labels = spec.getMeta().getLabels();
+
+    if (labels == null) {
+      labels = new HashMap<>();
+    }
+    labels.put("notebook-owner-id", spec.getMeta().getOwnerId());
+    labels.put("notebookId", notebookId.toString());

Review comment:
       Use "notebook-id" ?
   ref: 
[syntax-and-character-set](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set)




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to