Ejemplo n.º 1
0
 public static Job Create(
     string containerName,
     JobStatus status,
     DataPeriod dataPeriod,
     FilterInfo filterInfo,
     IEnumerable <PatientWrapper> patients = null,
     int nextTaskIndex = 0,
     Dictionary <string, TaskContext> runningTasks    = null,
     Dictionary <string, int> totalResourceCounts     = null,
     Dictionary <string, int> processedResourceCounts = null,
     Dictionary <string, int> skippedResourceCounts   = null,
     Dictionary <string, int> patientVersionId        = null,
     string resumedJobId = null)
 {
     return(new Job(
                Guid.NewGuid().ToString("N"),
                containerName,
                status,
                dataPeriod,
                filterInfo,
                DateTimeOffset.UtcNow,
                DateTimeOffset.UtcNow,
                patients,
                nextTaskIndex,
                runningTasks,
                totalResourceCounts,
                processedResourceCounts,
                skippedResourceCounts,
                patientVersionId,
                resumedJobId));
 }
Ejemplo n.º 2
0
        public Job(
            string id,
            string containerName,
            JobStatus status,
            DataPeriod dataPeriod,
            FilterInfo filterInfo,
            DateTimeOffset createdTime,
            DateTimeOffset lastHeartBeat,
            IEnumerable <PatientWrapper> patients = null,
            int nextTaskIndex = 0,
            Dictionary <string, TaskContext> runningTasks    = null,
            Dictionary <string, int> totalResourceCounts     = null,
            Dictionary <string, int> processedResourceCounts = null,
            Dictionary <string, int> skippedResourceCounts   = null,
            Dictionary <string, int> patientVersionId        = null,
            string resumedJobId = null)
        {
            // immutable fields
            Id            = id;
            CreatedTime   = createdTime;
            ContainerName = containerName;
            DataPeriod    = dataPeriod;
            FilterInfo    = filterInfo;
            ResumedJobId  = resumedJobId;

            // fields will be assigned in the process of job executing
            Patients = patients ?? new List <PatientWrapper>();

            // fields to record job status
            // the following two fields "CompletedTime" and "FailedReason" are set when a job is completed
            Status        = status;
            LastHeartBeat = lastHeartBeat;

            // fields to record job progress
            NextTaskIndex = nextTaskIndex;
            RunningTasks  = runningTasks ?? new Dictionary <string, TaskContext>();

            // statistical fields
            TotalResourceCounts     = totalResourceCounts ?? new Dictionary <string, int>();
            ProcessedResourceCounts = processedResourceCounts ?? new Dictionary <string, int>();
            SkippedResourceCounts   = skippedResourceCounts ?? new Dictionary <string, int>();
            PatientVersionId        = patientVersionId ?? new Dictionary <string, int>();
        }