/// <summary>
 /// Initializes a new instance of the
 /// JobPreparationTaskExecutionInformation class.
 /// </summary>
 /// <param name="startTime">The time at which the task started
 /// running.</param>
 /// <param name="state">The current state of the Job Preparation
 /// task.</param>
 /// <param name="retryCount">The number of times the task has been
 /// retried by the Batch service. Every time the task exits with a
 /// non-zero exit code, it is deemed a task failure. The Batch
 /// service will retry the task up to the limit specified by the
 /// constraints.</param>
 /// <param name="endTime">The time at which the Job Preparation task
 /// completed.</param>
 /// <param name="taskRootDirectory">The root directory of the Job
 /// Preparation task on the compute node. You can use this path to
 /// retrieve files created by the task, such as log files.</param>
 /// <param name="taskRootDirectoryUrl">The URL to the root directory
 /// of the Job Preparation task on the compute node.</param>
 /// <param name="exitCode">The exit code of the program specified on
 /// the task command line.</param>
 /// <param name="schedulingError">The error encountered by the Batch
 /// service when starting the task.</param>
 /// <param name="lastRetryTime">The most recent time at which a retry
 /// of the Job Preparation task started running.</param>
 public JobPreparationTaskExecutionInformation(System.DateTime startTime, JobPreparationTaskState state, int retryCount, System.DateTime?endTime = default(System.DateTime?), string taskRootDirectory = default(string), string taskRootDirectoryUrl = default(string), int?exitCode = default(int?), TaskSchedulingError schedulingError = default(TaskSchedulingError), System.DateTime?lastRetryTime = default(System.DateTime?))
 {
     StartTime            = startTime;
     EndTime              = endTime;
     State                = state;
     TaskRootDirectory    = taskRootDirectory;
     TaskRootDirectoryUrl = taskRootDirectoryUrl;
     ExitCode             = exitCode;
     SchedulingError      = schedulingError;
     RetryCount           = retryCount;
     LastRetryTime        = lastRetryTime;
 }
示例#2
0
        internal static string ToSerializedValue(this JobPreparationTaskState value)
        {
            switch (value)
            {
            case JobPreparationTaskState.Running:
                return("running");

            case JobPreparationTaskState.Completed:
                return("completed");
            }
            return(null);
        }
示例#3
0
 internal JobPreparationTaskExecutionInformation(DateTimeOffset startTime, DateTimeOffset?endTime, JobPreparationTaskState state, string taskRootDirectory, string taskRootDirectoryUrl, int?exitCode, TaskContainerExecutionInformation containerInfo, TaskFailureInformation failureInfo, int retryCount, DateTimeOffset?lastRetryTime, TaskExecutionResult?result)
 {
     StartTime            = startTime;
     EndTime              = endTime;
     State                = state;
     TaskRootDirectory    = taskRootDirectory;
     TaskRootDirectoryUrl = taskRootDirectoryUrl;
     ExitCode             = exitCode;
     ContainerInfo        = containerInfo;
     FailureInfo          = failureInfo;
     RetryCount           = retryCount;
     LastRetryTime        = lastRetryTime;
     Result               = result;
 }
 /// <summary>
 /// Initializes a new instance of the
 /// JobPreparationTaskExecutionInformation class.
 /// </summary>
 /// <param name="startTime">The time at which the task started
 /// running.</param>
 /// <param name="state">The current state of the Job Preparation task
 /// on the compute node.</param>
 /// <param name="retryCount">The number of times the task has been
 /// retried by the Batch service. Task application failures (non-zero
 /// exit code) are retried, pre-processing errors (the task could not
 /// be run) and file upload errors are not retried. The Batch service
 /// will retry the task up to the limit specified by the
 /// constraints.</param>
 /// <param name="endTime">The time at which the Job Preparation task
 /// completed.</param>
 /// <param name="taskRootDirectory">The root directory of the Job
 /// Preparation task on the compute node. You can use this path to
 /// retrieve files created by the task, such as log files.</param>
 /// <param name="taskRootDirectoryUrl">The URL to the root directory of
 /// the Job Preparation task on the compute node.</param>
 /// <param name="exitCode">The exit code of the program specified on
 /// the task command line.</param>
 /// <param name="containerInfo">Information about the container under
 /// which the task is executing.</param>
 /// <param name="failureInfo">Information describing the task failure,
 /// if any.</param>
 /// <param name="lastRetryTime">The most recent time at which a retry
 /// of the Job Preparation task started running.</param>
 /// <param name="result">The result of the task execution.</param>
 public JobPreparationTaskExecutionInformation(System.DateTime startTime, JobPreparationTaskState state, int retryCount, System.DateTime?endTime = default(System.DateTime?), string taskRootDirectory = default(string), string taskRootDirectoryUrl = default(string), int?exitCode = default(int?), TaskContainerExecutionInformation containerInfo = default(TaskContainerExecutionInformation), TaskFailureInformation failureInfo = default(TaskFailureInformation), System.DateTime?lastRetryTime = default(System.DateTime?), TaskExecutionResult?result = default(TaskExecutionResult?))
 {
     StartTime            = startTime;
     EndTime              = endTime;
     State                = state;
     TaskRootDirectory    = taskRootDirectory;
     TaskRootDirectoryUrl = taskRootDirectoryUrl;
     ExitCode             = exitCode;
     ContainerInfo        = containerInfo;
     FailureInfo          = failureInfo;
     RetryCount           = retryCount;
     LastRetryTime        = lastRetryTime;
     Result               = result;
     CustomInit();
 }
示例#5
0
 public static string ToSerialString(this JobPreparationTaskState value) => value switch
 {
示例#6
0
 internal JobPreparationTaskExecutionInformation(DateTimeOffset startTime, JobPreparationTaskState state, int retryCount)
 {
     StartTime  = startTime;
     State      = state;
     RetryCount = retryCount;
 }
        internal static JobPreparationTaskExecutionInformation DeserializeJobPreparationTaskExecutionInformation(JsonElement element)
        {
            DateTimeOffset          startTime = default;
            DateTimeOffset?         endTime   = default;
            JobPreparationTaskState state     = default;
            string taskRootDirectory          = default;
            string taskRootDirectoryUrl       = default;
            int?   exitCode = default;
            TaskContainerExecutionInformation containerInfo = default;
            TaskFailureInformation            failureInfo   = default;
            int                 retryCount    = default;
            DateTimeOffset?     lastRetryTime = default;
            TaskExecutionResult?result        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("startTime"))
                {
                    startTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("endTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    endTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("state"))
                {
                    state = property.Value.GetString().ToJobPreparationTaskState();
                    continue;
                }
                if (property.NameEquals("taskRootDirectory"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    taskRootDirectory = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("taskRootDirectoryUrl"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    taskRootDirectoryUrl = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("exitCode"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    exitCode = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("containerInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    containerInfo = TaskContainerExecutionInformation.DeserializeTaskContainerExecutionInformation(property.Value);
                    continue;
                }
                if (property.NameEquals("failureInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    failureInfo = TaskFailureInformation.DeserializeTaskFailureInformation(property.Value);
                    continue;
                }
                if (property.NameEquals("retryCount"))
                {
                    retryCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("lastRetryTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    lastRetryTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("result"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result = property.Value.GetString().ToTaskExecutionResult();
                    continue;
                }
            }
            return(new JobPreparationTaskExecutionInformation(startTime, endTime, state, taskRootDirectory, taskRootDirectoryUrl, exitCode, containerInfo, failureInfo, retryCount, lastRetryTime, result));
        }