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;
 }
Пример #2
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;
 }
Пример #3
0
 internal SubtaskInformation(int?id, ComputeNodeInformation nodeInfo, DateTimeOffset?startTime, DateTimeOffset?endTime, int?exitCode, TaskContainerExecutionInformation containerInfo, TaskFailureInformation failureInfo, SubtaskState?state, DateTimeOffset?stateTransitionTime, SubtaskState?previousState, DateTimeOffset?previousStateTransitionTime, TaskExecutionResult?result)
 {
     Id                          = id;
     NodeInfo                    = nodeInfo;
     StartTime                   = startTime;
     EndTime                     = endTime;
     ExitCode                    = exitCode;
     ContainerInfo               = containerInfo;
     FailureInfo                 = failureInfo;
     State                       = state;
     StateTransitionTime         = stateTransitionTime;
     PreviousState               = previousState;
     PreviousStateTransitionTime = previousStateTransitionTime;
     Result                      = result;
 }
Пример #4
0
        internal static TaskExecutionInformation DeserializeTaskExecutionInformation(JsonElement element)
        {
            DateTimeOffset?startTime = default;
            DateTimeOffset?endTime   = default;
            int?           exitCode  = default;
            TaskContainerExecutionInformation containerInfo = default;
            TaskFailureInformation            failureInfo   = default;
            int                 retryCount      = default;
            DateTimeOffset?     lastRetryTime   = default;
            int                 requeueCount    = default;
            DateTimeOffset?     lastRequeueTime = default;
            TaskExecutionResult?result          = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("startTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    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("requeueCount"))
                {
                    requeueCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("lastRequeueTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    lastRequeueTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("result"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result = property.Value.GetString().ToTaskExecutionResult();
                    continue;
                }
            }
            return(new TaskExecutionInformation(startTime, endTime, exitCode, containerInfo, failureInfo, retryCount, lastRetryTime, requeueCount, lastRequeueTime, result));
        }
        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));
        }
        internal static SubtaskInformation DeserializeSubtaskInformation(JsonElement element)
        {
            int?id = default;
            ComputeNodeInformation nodeInfo  = default;
            DateTimeOffset?        startTime = default;
            DateTimeOffset?        endTime   = default;
            int?exitCode = default;
            TaskContainerExecutionInformation containerInfo = default;
            TaskFailureInformation            failureInfo   = default;
            SubtaskState?       state = default;
            DateTimeOffset?     stateTransitionTime         = default;
            SubtaskState?       previousState               = default;
            DateTimeOffset?     previousStateTransitionTime = default;
            TaskExecutionResult?result = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("nodeInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    nodeInfo = ComputeNodeInformation.DeserializeComputeNodeInformation(property.Value);
                    continue;
                }
                if (property.NameEquals("startTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    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("state"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    state = property.Value.GetString().ToSubtaskState();
                    continue;
                }
                if (property.NameEquals("stateTransitionTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    stateTransitionTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("previousState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    previousState = property.Value.GetString().ToSubtaskState();
                    continue;
                }
                if (property.NameEquals("previousStateTransitionTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    previousStateTransitionTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("result"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    result = property.Value.GetString().ToTaskExecutionResult();
                    continue;
                }
            }
            return(new SubtaskInformation(id, nodeInfo, startTime, endTime, exitCode, containerInfo, failureInfo, state, stateTransitionTime, previousState, previousStateTransitionTime, result));
        }