pingsutw commented on a change in pull request #174: SUBMARINE-202. submarine
core need to support MXNet
URL: https://github.com/apache/submarine/pull/174#discussion_r377139787
##########
File path:
submarine-server/server-submitter/submitter-yarn/src/main/java/org/apache/submarine/server/submitter/yarn/YarnUtils.java
##########
@@ -203,4 +147,118 @@ private static Resource getResource(Parameter
parametersHolder, String option)
}
return ResourceUtils.createResourceFromString(resourceStr);
}
+
+ private static void setParametersForWorker (Configuration tonyConf,
+ ParametersHolder parameters) throws YarnException, ParseException {
+ tonyConf.setStrings(
+ TonyConfigurationKeys.getInstancesKey(Constants.WORKER_JOB_NAME),
+ parameters.getOptionValue(CliConstants.N_WORKERS));
+
+ if (parameters.getOptionValue(CliConstants.WORKER_RES) != null) {
+ Resource workerResource = getResource(parameters,
CliConstants.WORKER_RES);
+
+ tonyConf.setInt(
+ TonyConfigurationKeys.getResourceKey(Constants.WORKER_JOB_NAME,
+ Constants.VCORES),
+ workerResource.getVirtualCores());
+ tonyConf.setLong(
+ TonyConfigurationKeys.getResourceKey(Constants.WORKER_JOB_NAME,
+ Constants.MEMORY),
+ ResourceUtils.getMemorySize(workerResource));
+ tonyConf.setLong(
+ TonyConfigurationKeys.getResourceKey(Constants.WORKER_JOB_NAME,
+ Constants.GPUS),
+ ResourceUtils.getResourceValue(workerResource,
+ ResourceUtils.GPU_URI));
+ }
+
+ if (parameters.getOptionValue(CliConstants.WORKER_DOCKER_IMAGE) != null) {
+ tonyConf.set(
+
TonyConfigurationKeys.getDockerImageKey(Constants.WORKER_JOB_NAME),
+ parameters.getOptionValue(CliConstants.WORKER_DOCKER_IMAGE));
+ tonyConf.setBoolean(TonyConfigurationKeys.DOCKER_ENABLED, true);
+ }
+
+ if (parameters.getOptionValue(CliConstants.WORKER_LAUNCH_CMD) != null) {
+ tonyConf.set(
+
TonyConfigurationKeys.getExecuteCommandKey(Constants.WORKER_JOB_NAME),
+ parameters.getOptionValue(CliConstants.WORKER_LAUNCH_CMD));
+ }
+ }
+
+ private static void setParametersForPS (Configuration tonyConf,
+ ParametersHolder parameters) throws YarnException, ParseException {
+ String jobName = Constants.PS_JOB_NAME;
+ if (parameters.getFramework() == Framework.MXNET) {
+ jobName = Constants.SERVER_JOB_NAME;
+ }
+
+ if (parameters.getOptionValue(CliConstants.N_PS) != null) {
+ tonyConf.setStrings(
+ TonyConfigurationKeys.getInstancesKey(jobName),
+ parameters.getOptionValue(CliConstants.N_PS));
+ }
+ if (parameters.getOptionValue(CliConstants.PS_RES) != null) {
+ Resource psResource = getResource(parameters, CliConstants.PS_RES);
+
+ tonyConf.setInt(
+ TonyConfigurationKeys.getResourceKey(jobName,
+ Constants.VCORES),
+ psResource.getVirtualCores());
+ tonyConf.setLong(
+ TonyConfigurationKeys.getResourceKey(jobName,
+ Constants.MEMORY),
+ ResourceUtils.getMemorySize(psResource));
+ }
+
+ if (parameters.getOptionValue(CliConstants.PS_LAUNCH_CMD) != null) {
+ tonyConf.set(
+ TonyConfigurationKeys.getExecuteCommandKey(jobName),
+ parameters.getOptionValue(CliConstants.PS_LAUNCH_CMD));
+ }
+
+ if (parameters.getOptionValue(CliConstants.PS_DOCKER_IMAGE) != null) {
+ tonyConf.set(
+ TonyConfigurationKeys.getDockerImageKey(jobName),
+ parameters.getOptionValue(CliConstants.PS_DOCKER_IMAGE));
+ tonyConf.setBoolean(TonyConfigurationKeys.DOCKER_ENABLED, true);
+ }
+ }
+
+ private static void setParametersForScheduler (Configuration tonyConf,
+ ParametersHolder parameters) throws YarnException, ParseException {
+ if (parameters.getOptionValue(CliConstants.N_SCHEDULERS) != null) {
+ tonyConf.setStrings(
+
TonyConfigurationKeys.getInstancesKey(Constants.SCHEDULER_JOB_NAME),
+ parameters.getOptionValue(CliConstants.N_SCHEDULERS));
+ }
+
+ if (parameters.getOptionValue(CliConstants.SCHEDULER_RES) != null) {
+ Resource schedulerResource = getResource(parameters,
CliConstants.SCHEDULER_RES);
+
+ tonyConf.setInt(
+
TonyConfigurationKeys.getResourceKey(Constants.SCHEDULER_JOB_NAME,
+ Constants.VCORES),
+ schedulerResource.getVirtualCores());
+ tonyConf.setLong(
+
TonyConfigurationKeys.getResourceKey(Constants.SCHEDULER_JOB_NAME,
+ Constants.MEMORY),
+ ResourceUtils.getMemorySize(schedulerResource));
+ tonyConf.setLong(
+
TonyConfigurationKeys.getResourceKey(Constants.SCHEDULER_JOB_NAME,
Review comment:
if MXNET scheduler don't use GPU, we should remove these lines as 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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]