class TensorFlowPsComponent extends AbstractComponent {

  @Override
  public Component createComponent() throws IOException {
    TensorFlowRunJobParameters tensorFlowParams =
        (TensorFlowRunJobParameters) this.parameters;

    Objects.requireNonNull(tensorFlowParams.getPsResource(),
        "PS resource must not be null!");
    if (tensorFlowParams.getNumPS() < 1) {
      throw new IllegalArgumentException("Number of PS should be at least 1!");
    }

    Component component = new Component();
    component.setName(role.getComponentName());
    component.setNumberOfContainers((long) tensorFlowParams.getNumPS());
    component.setRestartPolicy(Component.RestartPolicyEnum.NEVER);
    component.setResource(
        SubmarineResourceUtils.convertYarnResourceToServiceResource(tensorFlowParams.getPsResource()));

    // Override global docker image if needed.
    if (tensorFlowParams.getPsDockerImage() != null) {
      component.setArtifact(
          DockerUtilities.getDockerArtifact(tensorFlowParams.getPsDockerImage()));
    }
    TensorFlowCommons.addCommonEnvironments(component, role);
    generateLaunchCommand(component);

    return component;
  }

  public  TensorFlowPsComponent(FileSystemOperations fsOperations,
                               RemoteDirectoryManager remoteDirectoryManager,
                               TensorFlowLaunchCommandFactory launchCommandFactory,
                               RunJobParameters parameters,
                               Configuration yarnConfig);

}