/// <summary> /// Initializes a new instance of the /// JobReleaseTaskExecutionInformation class. /// </summary> /// <param name="startTime">The time at which the task started /// running. Note that every time the task is restarted, this value /// is updated.</param> /// <param name="state">The current state of the Job Release /// task.</param> /// <param name="endTime">The time at which the Job Release task /// completed.</param> /// <param name="taskRootDirectory">The root directory of the Job /// Release 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 Release 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 scheduling error encountered by /// the Batch service when starting the task.</param> public JobReleaseTaskExecutionInformation(System.DateTime startTime, JobReleaseTaskState state, System.DateTime?endTime = default(System.DateTime?), string taskRootDirectory = default(string), string taskRootDirectoryUrl = default(string), int?exitCode = default(int?), TaskSchedulingError schedulingError = default(TaskSchedulingError)) { StartTime = startTime; EndTime = endTime; State = state; TaskRootDirectory = taskRootDirectory; TaskRootDirectoryUrl = taskRootDirectoryUrl; ExitCode = exitCode; SchedulingError = schedulingError; }
internal static string ToSerializedValue(this JobReleaseTaskState value) { switch (value) { case JobReleaseTaskState.Running: return("running"); case JobReleaseTaskState.Completed: return("completed"); } return(null); }
/// <summary> /// Initializes a new instance of the /// JobReleaseTaskExecutionInformation class. /// </summary> /// <param name="startTime">The time at which the task started /// running.</param> /// <param name="state">The current state of the Job Release task on /// the compute node.</param> /// <param name="endTime">The time at which the Job Release task /// completed.</param> /// <param name="taskRootDirectory">The root directory of the Job /// Release 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 Release 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="result">The result of the task execution.</param> public JobReleaseTaskExecutionInformation(System.DateTime startTime, JobReleaseTaskState state, 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), TaskExecutionResult?result = default(TaskExecutionResult?)) { StartTime = startTime; EndTime = endTime; State = state; TaskRootDirectory = taskRootDirectory; TaskRootDirectoryUrl = taskRootDirectoryUrl; ExitCode = exitCode; ContainerInfo = containerInfo; FailureInfo = failureInfo; Result = result; CustomInit(); }
public static string ToSerialString(this JobReleaseTaskState value) => value switch {
internal static JobReleaseTaskExecutionInformation DeserializeJobReleaseTaskExecutionInformation(JsonElement element) { DateTimeOffset startTime = default; DateTimeOffset? endTime = default; JobReleaseTaskState state = default; string taskRootDirectory = default; string taskRootDirectoryUrl = default; int? exitCode = default; TaskContainerExecutionInformation containerInfo = default; TaskFailureInformation failureInfo = 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().ToJobReleaseTaskState(); 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("result")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } result = property.Value.GetString().ToTaskExecutionResult(); continue; } } return(new JobReleaseTaskExecutionInformation(startTime, endTime, state, taskRootDirectory, taskRootDirectoryUrl, exitCode, containerInfo, failureInfo, result)); }