TensorFlowLaunchCommand extends AbstractLaunchCommand { @Override public String generateLaunchScript() throws IOException { LaunchScriptBuilder builder = getBuilder(); if (distributed) { String tfConfigEnvValue = TensorFlowConfigEnvGenerator.getTFConfigEnv( role.getComponentName(), numberOfWorkers, numberOfPS, name, TensorFlowCommons.getUserName(), TensorFlowCommons.getDNSDomain(yarnConfig)); String tfConfig = "export TF_CONFIG=\"" + tfConfigEnvValue + "\"\n"; builder.append(tfConfig); } return builder .withLaunchCommand(createLaunchCommand()) .build(); } TensorFlowLaunchCommand(HadoopEnvironmentSetup hadoopEnvSetup,
                          Role role, Component component,
                          TensorFlowRunJobParameters parameters,
                          Configuration yarnConfig); @Override String generateLaunchScript();  }
@Test public void testLaunchCommandIsNull() throws IOException { MockClientContext mockClientContext = createMockClientContext(); FileSystemOperations fsOperations = new FileSystemOperations(mockClientContext); HadoopEnvironmentSetup hadoopEnvSetup = new HadoopEnvironmentSetup(mockClientContext, fsOperations); Configuration yarnConfig = new Configuration(); Component component = new Component(); TensorFlowRunJobParameters params = new TensorFlowRunJobParameters(); params.setName("testName"); setLaunchCommandToParams(params, null); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("LaunchCommand must not be null or empty"); TensorFlowLaunchCommand launchCommand = createTensorFlowLaunchCommandObject(hadoopEnvSetup, yarnConfig, component, params); launchCommand.generateLaunchScript(); }
@Test public void testLaunchCommandIsEmpty() throws IOException { MockClientContext mockClientContext = createMockClientContext(); FileSystemOperations fsOperations = new FileSystemOperations(mockClientContext); HadoopEnvironmentSetup hadoopEnvSetup = new HadoopEnvironmentSetup(mockClientContext, fsOperations); Configuration yarnConfig = new Configuration(); Component component = new Component(); TensorFlowRunJobParameters params = new TensorFlowRunJobParameters(); params.setName("testName"); setLaunchCommandToParams(params, ""); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("LaunchCommand must not be null or empty"); TensorFlowLaunchCommand launchCommand = createTensorFlowLaunchCommandObject(hadoopEnvSetup, yarnConfig, component, params); launchCommand.generateLaunchScript(); }