@Test public void testTensorBoardComponentWithNullResource() throws IOException { TensorFlowRunJobParameters parameters = new TensorFlowRunJobParameters(); parameters.setTensorboardResource(null); TensorBoardComponent tensorBoardComponent = createTensorBoardComponent(parameters); expectedException.expect(NullPointerException.class); expectedException.expectMessage("TensorBoard resource must not be null"); tensorBoardComponent.createComponent(); }
@Override public Component createComponent() throws IOException { TensorFlowRunJobParameters tensorFlowParams = (TensorFlowRunJobParameters) this.parameters; Objects.requireNonNull(tensorFlowParams.getTensorboardResource(), "TensorBoard resource must not be null!"); Component component = new Component(); component.setName(role.getComponentName()); component.setNumberOfContainers(1L); component.setRestartPolicy(RestartPolicyEnum.NEVER); component.setResource(SubmarineResourceUtils.convertYarnResourceToServiceResource( tensorFlowParams.getTensorboardResource())); if (tensorFlowParams.getTensorboardDockerImage() != null) { component.setArtifact( DockerUtilities.getDockerArtifact(tensorFlowParams.getTensorboardDockerImage())); } TensorFlowCommons.addCommonEnvironments(component, role); generateLaunchCommand(component); tensorboardLink = "http: parameters.getName(), role.getComponentName() + "-" + 0, TensorFlowCommons.getUserName(), TensorFlowCommons.getDNSDomain(yarnConfig), DEFAULT_PORT); LOG.info("Link to tensorboard:" + tensorboardLink); return component; }
TensorBoardComponent extends AbstractComponent { @Override public Component createComponent() throws IOException { TensorFlowRunJobParameters tensorFlowParams = (TensorFlowRunJobParameters) this.parameters; Objects.requireNonNull(tensorFlowParams.getTensorboardResource(), "TensorBoard resource must not be null!"); Component component = new Component(); component.setName(role.getComponentName()); component.setNumberOfContainers(1L); component.setRestartPolicy(RestartPolicyEnum.NEVER); component.setResource(SubmarineResourceUtils.convertYarnResourceToServiceResource( tensorFlowParams.getTensorboardResource())); if (tensorFlowParams.getTensorboardDockerImage() != null) { component.setArtifact( DockerUtilities.getDockerArtifact(tensorFlowParams.getTensorboardDockerImage())); } TensorFlowCommons.addCommonEnvironments(component, role); generateLaunchCommand(component); tensorboardLink = "http: parameters.getName(), role.getComponentName() + "-" + 0, TensorFlowCommons.getUserName(), TensorFlowCommons.getDNSDomain(yarnConfig), DEFAULT_PORT); LOG.info("Link to tensorboard:" + tensorboardLink); return component; } }
TensorBoardComponent extends AbstractComponent { @Override public Component createComponent() throws IOException { TensorFlowRunJobParameters tensorFlowParams = (TensorFlowRunJobParameters) this.parameters; Objects.requireNonNull(tensorFlowParams.getTensorboardResource(), "TensorBoard resource must not be null!"); Component component = new Component(); component.setName(role.getComponentName()); component.setNumberOfContainers(1L); component.setRestartPolicy(RestartPolicyEnum.NEVER); component.setResource(SubmarineResourceUtils.convertYarnResourceToServiceResource( tensorFlowParams.getTensorboardResource())); if (tensorFlowParams.getTensorboardDockerImage() != null) { component.setArtifact( DockerUtilities.getDockerArtifact(tensorFlowParams.getTensorboardDockerImage())); } TensorFlowCommons.addCommonEnvironments(component, role); generateLaunchCommand(component); tensorboardLink = "http: parameters.getName(), role.getComponentName() + "-" + 0, TensorFlowCommons.getUserName(), TensorFlowCommons.getDNSDomain(yarnConfig), DEFAULT_PORT); LOG.info("Link to tensorboard:" + tensorboardLink); return component; } TensorBoardComponent(FileSystemOperations fsOperations,
                              RemoteDirectoryManager remoteDirectoryManager,
                              RunJobParameters parameters,
                              TensorFlowLaunchCommandFactory launchCommandFactory,
                              Configuration yarnConfig); }
TensorBoardComponent extends AbstractComponent { @Override public Component createComponent() throws IOException { TensorFlowRunJobParameters tensorFlowParams = (TensorFlowRunJobParameters) this.parameters; Objects.requireNonNull(tensorFlowParams.getTensorboardResource(), "TensorBoard resource must not be null!"); Component component = new Component(); component.setName(role.getComponentName()); component.setNumberOfContainers(1L); component.setRestartPolicy(RestartPolicyEnum.NEVER); component.setResource(SubmarineResourceUtils.convertYarnResourceToServiceResource( tensorFlowParams.getTensorboardResource())); if (tensorFlowParams.getTensorboardDockerImage() != null) { component.setArtifact( DockerUtilities.getDockerArtifact(tensorFlowParams.getTensorboardDockerImage())); } TensorFlowCommons.addCommonEnvironments(component, role); generateLaunchCommand(component); tensorboardLink = "http: parameters.getName(), role.getComponentName() + "-" + 0, TensorFlowCommons.getUserName(), TensorFlowCommons.getDNSDomain(yarnConfig), DEFAULT_PORT); LOG.info("Link to tensorboard:" + tensorboardLink); return component; } TensorBoardComponent(FileSystemOperations fsOperations,
                              RemoteDirectoryManager remoteDirectoryManager,
                              RunJobParameters parameters,
                              TensorFlowLaunchCommandFactory launchCommandFactory,
                              Configuration yarnConfig); @Override Component createComponent(); String getTensorboardLink(); }
TensorBoardComponent extends AbstractComponent { @Override public Component createComponent() throws IOException { TensorFlowRunJobParameters tensorFlowParams = (TensorFlowRunJobParameters) this.parameters; Objects.requireNonNull(tensorFlowParams.getTensorboardResource(), "TensorBoard resource must not be null!"); Component component = new Component(); component.setName(role.getComponentName()); component.setNumberOfContainers(1L); component.setRestartPolicy(RestartPolicyEnum.NEVER); component.setResource(SubmarineResourceUtils.convertYarnResourceToServiceResource( tensorFlowParams.getTensorboardResource())); if (tensorFlowParams.getTensorboardDockerImage() != null) { component.setArtifact( DockerUtilities.getDockerArtifact(tensorFlowParams.getTensorboardDockerImage())); } TensorFlowCommons.addCommonEnvironments(component, role); generateLaunchCommand(component); tensorboardLink = "http: parameters.getName(), role.getComponentName() + "-" + 0, TensorFlowCommons.getUserName(), TensorFlowCommons.getDNSDomain(yarnConfig), DEFAULT_PORT); LOG.info("Link to tensorboard:" + tensorboardLink); return component; } TensorBoardComponent(FileSystemOperations fsOperations,
                              RemoteDirectoryManager remoteDirectoryManager,
                              RunJobParameters parameters,
                              TensorFlowLaunchCommandFactory launchCommandFactory,
                              Configuration yarnConfig); @Override Component createComponent(); String getTensorboardLink(); static final String TENSORBOARD_QUICKLINK_LABEL; }