# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.

module Azure::BatchAI::Mgmt::V2018_05_01
  module Models
    #
    # Information about a Job.
    #
    class Job < ProxyResource

      include MsRestAzure

      # @return [JobPriority] Scheduling priority. Scheduling priority
      # associated with the job. Possible values include: 'low', 'normal',
      # 'high'. Default value: 'normal' .
      attr_accessor :scheduling_priority

      # @return [ResourceId] Cluster. Resource ID of the cluster associated
      # with the job.
      attr_accessor :cluster

      # @return [MountVolumes] Mount volumes. Collection of mount volumes
      # available to the job during execution. These volumes are mounted before
      # the job execution and unmounted after the job completion. The volumes
      # are mounted at location specified by $AZ_BATCHAI_JOB_MOUNT_ROOT
      # environment variable.
      attr_accessor :mount_volumes

      # @return [Integer] Number of compute nodes to run the job on. The job
      # will be gang scheduled on that many compute nodes
      attr_accessor :node_count

      # @return [ContainerSettings] If provided the job will run in the
      # specified container. If the container was downloaded as part of cluster
      # setup then the same container image will be used. If not provided, the
      # job will run on the VM.
      attr_accessor :container_settings

      # @return [ToolType] The toolkit type of this job. Possible values are:
      # cntk, tensorflow, caffe, caffe2, chainer, pytorch, custom, custommpi,
      # horovod. Possible values include: 'cntk', 'tensorflow', 'caffe',
      # 'caffe2', 'chainer', 'horovod', 'custommpi', 'custom'
      attr_accessor :tool_type

      # @return [CNTKsettings] Specifies the settings for CNTK (aka Microsoft
      # Cognitive Toolkit) job.
      attr_accessor :cntk_settings

      # @return [PyTorchSettings] Specifies the settings for pyTorch job.
      attr_accessor :py_torch_settings

      # @return [TensorFlowSettings] Specifies the settings for Tensor Flow
      # job.
      attr_accessor :tensor_flow_settings

      # @return [CaffeSettings] Specifies the settings for Caffe job.
      attr_accessor :caffe_settings

      # @return [Caffe2Settings] Specifies the settings for Caffe2 job.
      attr_accessor :caffe2settings

      # @return [ChainerSettings] Specifies the settings for Chainer job.
      attr_accessor :chainer_settings

      # @return [CustomToolkitSettings] Specifies the settings for custom tool
      # kit job.
      attr_accessor :custom_toolkit_settings

      # @return [CustomMpiSettings] Specifies the settings for custom MPI job.
      attr_accessor :custom_mpi_settings

      # @return [HorovodSettings] Specifies the settings for Horovod job.
      attr_accessor :horovod_settings

      # @return [JobPreparation] Specifies the actions to be performed before
      # tool kit is launched. The specified actions will run on all the nodes
      # that are part of the job
      attr_accessor :job_preparation

      # @return [String] Output directory path segment. A segment of job's
      # output directories path created by Batch AI. Batch AI creates job's
      # output directories under an unique path to avoid conflicts between
      # jobs. This value contains a path segment generated by Batch AI to make
      # the path unique and can be used to find the output directory on the
      # node or mounted filesystem.
      attr_accessor :job_output_directory_path_segment

      # @return [String] Standard output directory path prefix. The path where
      # the Batch AI service stores stdout, stderror and execution log of the
      # job.
      attr_accessor :std_out_err_path_prefix

      # @return [Array<InputDirectory>] Input directories. A list of input
      # directories for the job.
      attr_accessor :input_directories

      # @return [Array<OutputDirectory>] Output directories. A list of output
      # directories for the job.
      attr_accessor :output_directories

      # @return [Array<EnvironmentVariable>] Environment variables. A
      # collection of user defined environment variables to be setup for the
      # job.
      attr_accessor :environment_variables

      # @return [Array<EnvironmentVariableWithSecretValue>] Secrets. A
      # collection of user defined environment variables with secret values to
      # be setup for the job. Server will never report values of these
      # variables back.
      attr_accessor :secrets

      # @return [JobPropertiesConstraints] Constraints associated with the Job.
      attr_accessor :constraints

      # @return [DateTime] Creation time. The creation time of the job.
      attr_accessor :creation_time

      # @return [ProvisioningState] Provisioning state. The provisioned state
      # of the Batch AI job. Possible values include: 'creating', 'succeeded',
      # 'failed', 'deleting'
      attr_accessor :provisioning_state

      # @return [DateTime] Provisioning state transition time. The time at
      # which the job entered its current provisioning state.
      attr_accessor :provisioning_state_transition_time

      # @return [ExecutionState] Execution state. The current state of the job.
      # Possible values are: queued - The job is queued and able to run. A job
      # enters this state when it is created, or when it is awaiting a retry
      # after a failed run. running - The job is running on a compute cluster.
      # This includes job-level preparation such as downloading resource files
      # or set up container specified on the job - it does not necessarily mean
      # that the job command line has started executing. terminating - The job
      # is terminated by the user, the terminate operation is in progress.
      # succeeded - The job has completed running successfully and exited with
      # exit code 0. failed - The job has finished unsuccessfully (failed with
      # a non-zero exit code) and has exhausted its retry limit. A job is also
      # marked as failed if an error occurred launching the job. Possible
      # values include: 'queued', 'running', 'terminating', 'succeeded',
      # 'failed'
      attr_accessor :execution_state

      # @return [DateTime] Execution state transition time. The time at which
      # the job entered its current execution state.
      attr_accessor :execution_state_transition_time

      # @return [JobPropertiesExecutionInfo] Information about the execution of
      # a job.
      attr_accessor :execution_info


      #
      # Mapper for Job class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'Job',
          type: {
            name: 'Composite',
            class_name: 'Job',
            model_properties: {
              id: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'id',
                type: {
                  name: 'String'
                }
              },
              name: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'name',
                type: {
                  name: 'String'
                }
              },
              type: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'type',
                type: {
                  name: 'String'
                }
              },
              scheduling_priority: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.schedulingPriority',
                default_value: 'normal',
                type: {
                  name: 'String'
                }
              },
              cluster: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.cluster',
                type: {
                  name: 'Composite',
                  class_name: 'ResourceId'
                }
              },
              mount_volumes: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.mountVolumes',
                type: {
                  name: 'Composite',
                  class_name: 'MountVolumes'
                }
              },
              node_count: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.nodeCount',
                type: {
                  name: 'Number'
                }
              },
              container_settings: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.containerSettings',
                type: {
                  name: 'Composite',
                  class_name: 'ContainerSettings'
                }
              },
              tool_type: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.toolType',
                type: {
                  name: 'String'
                }
              },
              cntk_settings: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.cntkSettings',
                type: {
                  name: 'Composite',
                  class_name: 'CNTKsettings'
                }
              },
              py_torch_settings: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.pyTorchSettings',
                type: {
                  name: 'Composite',
                  class_name: 'PyTorchSettings'
                }
              },
              tensor_flow_settings: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.tensorFlowSettings',
                type: {
                  name: 'Composite',
                  class_name: 'TensorFlowSettings'
                }
              },
              caffe_settings: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.caffeSettings',
                type: {
                  name: 'Composite',
                  class_name: 'CaffeSettings'
                }
              },
              caffe2settings: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.caffe2Settings',
                type: {
                  name: 'Composite',
                  class_name: 'Caffe2Settings'
                }
              },
              chainer_settings: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.chainerSettings',
                type: {
                  name: 'Composite',
                  class_name: 'ChainerSettings'
                }
              },
              custom_toolkit_settings: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.customToolkitSettings',
                type: {
                  name: 'Composite',
                  class_name: 'CustomToolkitSettings'
                }
              },
              custom_mpi_settings: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.customMpiSettings',
                type: {
                  name: 'Composite',
                  class_name: 'CustomMpiSettings'
                }
              },
              horovod_settings: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.horovodSettings',
                type: {
                  name: 'Composite',
                  class_name: 'HorovodSettings'
                }
              },
              job_preparation: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.jobPreparation',
                type: {
                  name: 'Composite',
                  class_name: 'JobPreparation'
                }
              },
              job_output_directory_path_segment: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.jobOutputDirectoryPathSegment',
                type: {
                  name: 'String'
                }
              },
              std_out_err_path_prefix: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.stdOutErrPathPrefix',
                type: {
                  name: 'String'
                }
              },
              input_directories: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.inputDirectories',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'InputDirectoryElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'InputDirectory'
                      }
                  }
                }
              },
              output_directories: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.outputDirectories',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'OutputDirectoryElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'OutputDirectory'
                      }
                  }
                }
              },
              environment_variables: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.environmentVariables',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'EnvironmentVariableElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'EnvironmentVariable'
                      }
                  }
                }
              },
              secrets: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.secrets',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'EnvironmentVariableWithSecretValueElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'EnvironmentVariableWithSecretValue'
                      }
                  }
                }
              },
              constraints: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.constraints',
                type: {
                  name: 'Composite',
                  class_name: 'JobPropertiesConstraints'
                }
              },
              creation_time: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.creationTime',
                type: {
                  name: 'DateTime'
                }
              },
              provisioning_state: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.provisioningState',
                type: {
                  name: 'String'
                }
              },
              provisioning_state_transition_time: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.provisioningStateTransitionTime',
                type: {
                  name: 'DateTime'
                }
              },
              execution_state: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.executionState',
                type: {
                  name: 'String'
                }
              },
              execution_state_transition_time: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.executionStateTransitionTime',
                type: {
                  name: 'DateTime'
                }
              },
              execution_info: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.executionInfo',
                type: {
                  name: 'Composite',
                  class_name: 'JobPropertiesExecutionInfo'
                }
              }
            }
          }
        }
      end
    end
  end
end
