jeff-901 commented on a change in pull request #653:
URL: https://github.com/apache/submarine/pull/653#discussion_r665812139
##########
File path:
submarine-server/server-submitter/submitter-k8s/src/main/java/org/apache/submarine/server/submitter/k8s/K8sSubmitter.java
##########
@@ -534,6 +535,49 @@ public ServeResponse deleteServe(ServeRequest spec)
}
}
+ @Override
+ public ServeResponse checkServePodReady(String name)
+ throws SubmarineRuntimeException {
+ V1Pod pod = null;
+ V1PodList list;
+ try {
+ list = coreApi.listPodForAllNamespaces(null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null);
+ } catch (ApiException e){
+ throw new SubmarineRuntimeException(e.getCode(), "K8s ApiException" +
e.getMessage());
+ }
+ for (V1Pod item : list.getItems()){
+ try {
+ if (item.getMetadata().getLabels().get("app").equals(name)){
+ pod = item;
+ break;
+ }
+ } catch (NullPointerException e){
+ continue;
+ }
+ }
+ if (pod == null) {
+ throw new SubmarineRuntimeException(404, "Pod " + name + " not fund.");
Review comment:
But some functions above is not using constant error code.
##########
File path:
submarine-server/server-submitter/submitter-k8s/src/main/java/org/apache/submarine/server/submitter/k8s/K8sSubmitter.java
##########
@@ -534,6 +535,49 @@ public ServeResponse deleteServe(ServeRequest spec)
}
}
+ @Override
+ public ServeResponse checkServePodReady(String name)
+ throws SubmarineRuntimeException {
+ V1Pod pod = null;
+ V1PodList list;
+ try {
+ list = coreApi.listPodForAllNamespaces(null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null);
+ } catch (ApiException e){
+ throw new SubmarineRuntimeException(e.getCode(), "K8s ApiException" +
e.getMessage());
+ }
+ for (V1Pod item : list.getItems()){
+ try {
+ if (item.getMetadata().getLabels().get("app").equals(name)){
+ pod = item;
+ break;
+ }
+ } catch (NullPointerException e){
+ continue;
+ }
+ }
+ if (pod == null) {
+ throw new SubmarineRuntimeException(404, "Pod " + name + " not fund.");
Review comment:
But some functions above are not using constant error code.
--
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]