pingsutw commented on a change in pull request #484:
URL: https://github.com/apache/submarine/pull/484#discussion_r549944512
##########
File path:
submarine-server/server-submitter/submitter-k8s/src/main/java/org/apache/submarine/server/submitter/k8s/K8sSubmitter.java
##########
@@ -320,6 +349,161 @@ public Notebook deleteNotebook(NotebookSpec spec) throws
SubmarineRuntimeExcepti
return notebookList;
}
+ public void createTFBoard(String name, String namespace) throws ApiException
{
+ final String deploy_name = TensorboardUtils.DEPLOY_PREFIX + name;
+ final String pod_name = TensorboardUtils.POD_PREFIX + name;
+ final String svc_name = TensorboardUtils.SVC_PREFIX + name;
+ final String ingress_name = TensorboardUtils.INGRESS_PREFIX + name;
+
+ final String image = TensorboardUtils.IMAGE_NAME;
+ final String route_path = TensorboardUtils.PATH_PREFIX + name;
+ final String pvc = TensorboardUtils.PVC_PREFIX + name;
+
+ V1Deployment deployment =
TensorboardSpecParser.parseDeployment(deploy_name, image, route_path, pvc);
+ V1Service svc = TensorboardSpecParser.parseService(svc_name, pod_name);
+ IngressRoute ingressRoute = TensorboardSpecParser.parseIngressRoute(
+ ingress_name, namespace, route_path, svc_name
+ );
+
+ try {
+ appsV1Api.createNamespacedDeployment(namespace, deployment, "true",
null, null);
+ coreApi.createNamespacedService(namespace, svc, "true", null, null);
+ api.createNamespacedCustomObject(
+ ingressRoute.getGroup(), ingressRoute.getVersion(),
+ ingressRoute.getMetadata().getNamespace(),
+ ingressRoute.getPlural(), ingressRoute, "true");
+ } catch (ApiException e) {
+ LOG.error("Exception when calling createTFBoard");
+ throw e;
+ }
+ }
+
+ public void deleteTFBoard(String name, String namespace) throws ApiException
{
+ final String deploy_name = TensorboardUtils.DEPLOY_PREFIX + name;
+ final String pod_name = TensorboardUtils.POD_PREFIX + name;
+ final String svc_name = TensorboardUtils.SVC_PREFIX + name;
+ final String ingress_name = TensorboardUtils.INGRESS_PREFIX + name;
+
+ final String image = TensorboardUtils.IMAGE_NAME;
+ final String route_path = TensorboardUtils.PATH_PREFIX + name;
+ final String pvc = TensorboardUtils.PVC_PREFIX + name;
+
+ V1Deployment deployment =
TensorboardSpecParser.parseDeployment(deploy_name, image, route_path, pvc);
+ V1Service svc = TensorboardSpecParser.parseService(svc_name, pod_name);
+ IngressRoute ingressRoute = TensorboardSpecParser.parseIngressRoute(
+ ingress_name, namespace, route_path, svc_name
+ );
+
+ try {
+ appsV1Api.deleteNamespacedDeployment(deploy_name, namespace, "true",
+ null, null, null, null, null);
+ coreApi.deleteNamespacedService(svc_name, namespace, "true",
+ null, null, null, null, null);
+ api.deleteNamespacedCustomObject(
+ ingressRoute.getGroup(), ingressRoute.getVersion(),
+ ingressRoute.getMetadata().getNamespace(), ingressRoute.getPlural(),
ingress_name,
+ new
V1DeleteOptionsBuilder().withApiVersion(ingressRoute.getApiVersion()).build(),
+ null, null, null);
+
+ } catch (ApiException e) {
+ LOG.error("Exception when calling createTFBoard");
Review comment:
And I think the `ApiException` message in other files also need to be
modify
##########
File path:
submarine-server/server-submitter/submitter-k8s/src/main/java/org/apache/submarine/server/submitter/k8s/K8sSubmitter.java
##########
@@ -320,6 +349,161 @@ public Notebook deleteNotebook(NotebookSpec spec) throws
SubmarineRuntimeExcepti
return notebookList;
}
+ public void createTFBoard(String name, String namespace) throws ApiException
{
+ final String deploy_name = TensorboardUtils.DEPLOY_PREFIX + name;
+ final String pod_name = TensorboardUtils.POD_PREFIX + name;
+ final String svc_name = TensorboardUtils.SVC_PREFIX + name;
+ final String ingress_name = TensorboardUtils.INGRESS_PREFIX + name;
+
+ final String image = TensorboardUtils.IMAGE_NAME;
+ final String route_path = TensorboardUtils.PATH_PREFIX + name;
+ final String pvc = TensorboardUtils.PVC_PREFIX + name;
+
+ V1Deployment deployment =
TensorboardSpecParser.parseDeployment(deploy_name, image, route_path, pvc);
+ V1Service svc = TensorboardSpecParser.parseService(svc_name, pod_name);
+ IngressRoute ingressRoute = TensorboardSpecParser.parseIngressRoute(
+ ingress_name, namespace, route_path, svc_name
+ );
+
+ try {
+ appsV1Api.createNamespacedDeployment(namespace, deployment, "true",
null, null);
+ coreApi.createNamespacedService(namespace, svc, "true", null, null);
+ api.createNamespacedCustomObject(
+ ingressRoute.getGroup(), ingressRoute.getVersion(),
+ ingressRoute.getMetadata().getNamespace(),
+ ingressRoute.getPlural(), ingressRoute, "true");
+ } catch (ApiException e) {
+ LOG.error("Exception when calling createTFBoard");
+ throw e;
+ }
+ }
+
+ public void deleteTFBoard(String name, String namespace) throws ApiException
{
+ final String deploy_name = TensorboardUtils.DEPLOY_PREFIX + name;
+ final String pod_name = TensorboardUtils.POD_PREFIX + name;
+ final String svc_name = TensorboardUtils.SVC_PREFIX + name;
+ final String ingress_name = TensorboardUtils.INGRESS_PREFIX + name;
+
+ final String image = TensorboardUtils.IMAGE_NAME;
+ final String route_path = TensorboardUtils.PATH_PREFIX + name;
+ final String pvc = TensorboardUtils.PVC_PREFIX + name;
+
+ V1Deployment deployment =
TensorboardSpecParser.parseDeployment(deploy_name, image, route_path, pvc);
+ V1Service svc = TensorboardSpecParser.parseService(svc_name, pod_name);
+ IngressRoute ingressRoute = TensorboardSpecParser.parseIngressRoute(
+ ingress_name, namespace, route_path, svc_name
+ );
+
+ try {
+ appsV1Api.deleteNamespacedDeployment(deploy_name, namespace, "true",
+ null, null, null, null, null);
+ coreApi.deleteNamespacedService(svc_name, namespace, "true",
+ null, null, null, null, null);
+ api.deleteNamespacedCustomObject(
+ ingressRoute.getGroup(), ingressRoute.getVersion(),
+ ingressRoute.getMetadata().getNamespace(), ingressRoute.getPlural(),
ingress_name,
+ new
V1DeleteOptionsBuilder().withApiVersion(ingressRoute.getApiVersion()).build(),
+ null, null, null);
+
+ } catch (ApiException e) {
+ LOG.error("Exception when calling createTFBoard");
Review comment:
`LOG.error` will show which function and which line runs an error, so we
don't need to display `Exception when calling .....`, we should show more
detailed messages to users. like
https://github.com/apache/submarine/blob/d104080a926d30bcc45ccd740f9489dd7365d0b5/submarine-server/server-submitter/submitter-k8s/src/main/java/org/apache/submarine/server/submitter/k8s/K8sSubmitter.java#L264-L270
----------------------------------------------------------------
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:
[email protected]