示例#1
0
 /// <summary>
 /// Initializes a new instance of the StartTaskInformation class.
 /// </summary>
 /// <param name="state">The state of the start task on the compute
 /// node.</param>
 /// <param name="startTime">The time at which the start task started
 /// running.</param>
 /// <param name="retryCount">The number of times the task has been
 /// retried by the Batch service.</param>
 /// <param name="endTime">The time at which the start task stopped
 /// running.</param>
 /// <param name="exitCode">The exit code of the program specified on
 /// the task command line.</param>
 /// <param name="schedulingError">Any error encountered scheduling the
 /// start task.</param>
 /// <param name="lastRetryTime">The most recent time at which a retry
 /// of the task started running.</param>
 public StartTaskInformation(StartTaskState state, System.DateTime startTime, int retryCount, System.DateTime?endTime = default(System.DateTime?), int?exitCode = default(int?), TaskSchedulingError schedulingError = default(TaskSchedulingError), System.DateTime?lastRetryTime = default(System.DateTime?))
 {
     State           = state;
     StartTime       = startTime;
     EndTime         = endTime;
     ExitCode        = exitCode;
     SchedulingError = schedulingError;
     RetryCount      = retryCount;
     LastRetryTime   = lastRetryTime;
 }
        internal static string ToSerializedValue(this StartTaskState value)
        {
            switch (value)
            {
            case StartTaskState.Running:
                return("running");

            case StartTaskState.Completed:
                return("completed");
            }
            return(null);
        }
 internal StartTaskInformation(StartTaskState state, DateTimeOffset startTime, DateTimeOffset?endTime, int?exitCode, TaskContainerExecutionInformation containerInfo, TaskFailureInformation failureInfo, int retryCount, DateTimeOffset?lastRetryTime, TaskExecutionResult?result)
 {
     State         = state;
     StartTime     = startTime;
     EndTime       = endTime;
     ExitCode      = exitCode;
     ContainerInfo = containerInfo;
     FailureInfo   = failureInfo;
     RetryCount    = retryCount;
     LastRetryTime = lastRetryTime;
     Result        = result;
 }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the StartTaskInformation class.
 /// </summary>
 /// <param name="state">The state of the start task on the compute
 /// node.</param>
 /// <param name="startTime">The time at which the start task started
 /// running.</param>
 /// <param name="retryCount">The number of times the task has been
 /// retried by the Batch service.</param>
 /// <param name="endTime">The time at which the start task stopped
 /// running.</param>
 /// <param name="exitCode">The exit code of the program specified on
 /// the start 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 task started running.</param>
 /// <param name="result">The result of the task execution.</param>
 public StartTaskInformation(StartTaskState state, System.DateTime startTime, int retryCount, System.DateTime?endTime = default(System.DateTime?), int?exitCode = default(int?), TaskContainerExecutionInformation containerInfo = default(TaskContainerExecutionInformation), TaskFailureInformation failureInfo = default(TaskFailureInformation), System.DateTime?lastRetryTime = default(System.DateTime?), TaskExecutionResult?result = default(TaskExecutionResult?))
 {
     State         = state;
     StartTime     = startTime;
     EndTime       = endTime;
     ExitCode      = exitCode;
     ContainerInfo = containerInfo;
     FailureInfo   = failureInfo;
     RetryCount    = retryCount;
     LastRetryTime = lastRetryTime;
     Result        = result;
     CustomInit();
 }
 internal StartTaskInformation(StartTaskState state, DateTimeOffset startTime, int retryCount)
 {
     State      = state;
     StartTime  = startTime;
     RetryCount = retryCount;
 }
 public static string ToSerialString(this StartTaskState value) => value switch
 {
        internal static StartTaskInformation DeserializeStartTaskInformation(JsonElement element)
        {
            StartTaskState state     = default;
            DateTimeOffset startTime = default;
            DateTimeOffset?endTime   = 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("state"))
                {
                    state = property.Value.GetString().ToStartTaskState();
                    continue;
                }
                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("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 StartTaskInformation(state, startTime, endTime, exitCode, containerInfo, failureInfo, retryCount, lastRetryTime, result));
        }