[GitHub] [submarine] pingsutw commented on a change in pull request #179: SUBMARINE-377. [SDK] Submit a job by pysubamrine

2020-02-13 Thread GitBox
pingsutw commented on a change in pull request #179: SUBMARINE-377. [SDK] 
Submit a job by pysubamrine
URL: https://github.com/apache/submarine/pull/179#discussion_r378706861
 
 

 ##
 File path: 
submarine-server/server-submitter/submitter-yarn/src/main/java/org/apache/submarine/server/submitter/yarn/YarnUtils.java
 ##
 @@ -46,129 +44,61 @@
   private static final Log LOG = LogFactory.getLog(YarnUtils.class);
 
   public static Configuration tonyConfFromClientContext(
-  ParametersHolder parameters) throws YarnException, ParseException {
+  RunJobParameters parameters, Framework framework) throws 
YarnException, ParseException {
 Configuration tonyConf = new Configuration();
 // Add tony.xml for configuration.
 tonyConf.addResource(Constants.TONY_XML);
 tonyConf.setStrings(TonyConfigurationKeys.FRAMEWORK_NAME,
-parameters.getFramework().getValue());
+framework.getValue());
 tonyConf.setStrings(TonyConfigurationKeys.APPLICATION_NAME,
-parameters.getParameters().getName());
-tonyConf.setStrings(
-TonyConfigurationKeys.getInstancesKey(Constants.WORKER_JOB_NAME),
-parameters.getOptionValue(CliConstants.N_WORKERS));
-if (parameters.getOptionValue(CliConstants.N_PS) != null) {
-  tonyConf.setStrings(
-  TonyConfigurationKeys.getInstancesKey(Constants.PS_JOB_NAME),
-  parameters.getOptionValue(CliConstants.N_PS));
-}
-// Resources for PS & Worker
-if (parameters.getOptionValue(CliConstants.PS_RES) != null) {
 
 Review comment:
   Yes, I just try to submit job with YAML. it works well.


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:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@submarine.apache.org
For additional commands, e-mail: dev-h...@submarine.apache.org



[GitHub] [submarine] pingsutw commented on a change in pull request #179: SUBMARINE-377. [SDK] Submit a job by pysubamrine

2020-02-11 Thread GitBox
pingsutw commented on a change in pull request #179: SUBMARINE-377. [SDK] 
Submit a job by pysubamrine
URL: https://github.com/apache/submarine/pull/179#discussion_r378083523
 
 

 ##
 File path: 
submarine-sdk/pysubmarine/submarine/proto/SubmarineServerProtocol_pb2.py
 ##
 @@ -0,0 +1,1075 @@
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
 
 Review comment:
   Let me check other python projects how to handle proto files. 


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:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@submarine.apache.org
For additional commands, e-mail: dev-h...@submarine.apache.org



[GitHub] [submarine] pingsutw commented on a change in pull request #179: SUBMARINE-377. [SDK] Submit a job by pysubamrine

2020-02-11 Thread GitBox
pingsutw commented on a change in pull request #179: SUBMARINE-377. [SDK] 
Submit a job by pysubamrine
URL: https://github.com/apache/submarine/pull/179#discussion_r378082733
 
 

 ##
 File path: 
submarine-server/server-submitter/submitter-yarn/src/main/java/org/apache/submarine/server/submitter/yarn/YarnUtils.java
 ##
 @@ -46,129 +44,61 @@
   private static final Log LOG = LogFactory.getLog(YarnUtils.class);
 
   public static Configuration tonyConfFromClientContext(
-  ParametersHolder parameters) throws YarnException, ParseException {
+  RunJobParameters parameters, Framework framework) throws 
YarnException, ParseException {
 Configuration tonyConf = new Configuration();
 // Add tony.xml for configuration.
 tonyConf.addResource(Constants.TONY_XML);
 tonyConf.setStrings(TonyConfigurationKeys.FRAMEWORK_NAME,
-parameters.getFramework().getValue());
+framework.getValue());
 tonyConf.setStrings(TonyConfigurationKeys.APPLICATION_NAME,
-parameters.getParameters().getName());
-tonyConf.setStrings(
-TonyConfigurationKeys.getInstancesKey(Constants.WORKER_JOB_NAME),
-parameters.getOptionValue(CliConstants.N_WORKERS));
-if (parameters.getOptionValue(CliConstants.N_PS) != null) {
-  tonyConf.setStrings(
-  TonyConfigurationKeys.getInstancesKey(Constants.PS_JOB_NAME),
-  parameters.getOptionValue(CliConstants.N_PS));
-}
-// Resources for PS & Worker
-if (parameters.getOptionValue(CliConstants.PS_RES) != null) {
 
 Review comment:
   @yuanzac Thanks for the review.
   > The method of parameters.getOptionValue works for both cli arguments and 
yaml configuration.
   
   In YarnUtils `parameters.getOptionValue` will parse cli and yaml, and the 
write correspond conf to tony-xml, but when use pysubmarine client we won't 
pass `CommandLineProto` or yaml conf to rpc server. We pass 
`TensorFlowRunJobParameterProto` or `PyTorchRunJobParameterProto` , so that if 
we use `parameters.getOptionValue` , it can't find any parameter. 


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:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@submarine.apache.org
For additional commands, e-mail: dev-h...@submarine.apache.org



[GitHub] [submarine] pingsutw commented on a change in pull request #179: SUBMARINE-377. [SDK] Submit a job by pysubamrine

2020-02-10 Thread GitBox
pingsutw commented on a change in pull request #179: SUBMARINE-377. [SDK] 
Submit a job by pysubamrine
URL: https://github.com/apache/submarine/pull/179#discussion_r377033798
 
 

 ##
 File path: submarine-sdk/pysubmarine/tests/client/test_client.py
 ##
 @@ -0,0 +1,161 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from mock import patch
+from unittest.mock import ANY
+import pytest
+from submarine.client import Client
+
+from submarine.exceptions import SubmarineException
+from submarine.proto.SubmarineServerProtocol_pb2_grpc import 
SubmarineServerProtocolStub
+from submarine.client.params import RoleParameter, Localization, Resource
+import submarine.proto.SubmarineServerProtocol_pb2
+
+
+def __init__(self, channel):
+def mocked_submit(params):
+class mocked_response:
+application_id = 'application-123456789'
+
+return mocked_response()
+
+self.SubmitJob = mocked_submit
+
+
+# Submarine client parameters
+host = 'submarine'
+port = 8980
+security_disabled = True
+keytab = 'keytabPath'
+principal = 'testPrincipal'
+distribute_keytab = True
+queue = 'submarine'
+client = Client(host=host, port=port, security_disabled=security_disabled, 
keytab=keytab,
+principal=principal, distribute_keytab=distribute_keytab, 
queue=queue)
+
+# Submarine job parameters
+name = 'test_rpc'
+docker_image = 'apache/submarine:latest'
 
 Review comment:
   This is just an arbitrary string of docker image.
   Actually, we won't run this docker images in the submarine cluster. 
   I used mock_submit, so we won't pass these parameters to RPC server


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:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@submarine.apache.org
For additional commands, e-mail: dev-h...@submarine.apache.org



[GitHub] [submarine] pingsutw commented on a change in pull request #179: SUBMARINE-377. [SDK] Submit a job by pysubamrine

2020-02-10 Thread GitBox
pingsutw commented on a change in pull request #179: SUBMARINE-377. [SDK] 
Submit a job by pysubamrine
URL: https://github.com/apache/submarine/pull/179#discussion_r377033839
 
 

 ##
 File path: submarine-sdk/pysubmarine/tests/client/test_client.py
 ##
 @@ -0,0 +1,161 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from mock import patch
+from unittest.mock import ANY
+import pytest
+from submarine.client import Client
+
+from submarine.exceptions import SubmarineException
+from submarine.proto.SubmarineServerProtocol_pb2_grpc import 
SubmarineServerProtocolStub
+from submarine.client.params import RoleParameter, Localization, Resource
+import submarine.proto.SubmarineServerProtocol_pb2
+
+
+def __init__(self, channel):
+def mocked_submit(params):
+class mocked_response:
+application_id = 'application-123456789'
+
+return mocked_response()
+
+self.SubmitJob = mocked_submit
+
+
+# Submarine client parameters
+host = 'submarine'
+port = 8980
 
 Review comment:
   @liuxunorg Thanks for the review.
   Yes, this is default submarine rpc server port


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:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@submarine.apache.org
For additional commands, e-mail: dev-h...@submarine.apache.org