Exemple #1
0
 public void OnJobFinished(FinishedJobInfo[] jobFinishedInfo)
 {
     using (LocaleThreadState.EnsurePrimaryLocale())
     {
         if (this.parent.IsServiceDown)
         {
             JobSchedulerEventsService.log.InfoFormat("Core Service Engine is in an invalid state.  Job results will be discarded.", Array.Empty <object>());
         }
         else
         {
             this.resultsManager.AddJobResults(jobFinishedInfo);
             for (FinishedJobInfo jobResult = this.resultsManager.GetJobResult(); jobResult != null; jobResult = this.resultsManager.GetJobResult())
             {
                 try
                 {
                     this.ProcessJobResult(jobResult);
                 }
                 catch (Exception ex)
                 {
                     JobSchedulerEventsService.log.Error((object)"Error processing job", ex);
                 }
                 finally
                 {
                     this.resultsManager.FinishProcessingJobResult(jobResult);
                 }
             }
         }
     }
 }
        // Token: 0x060002CE RID: 718 RVA: 0x00011788 File Offset: 0x0000F988
        public void OnJobFinished(FinishedJobInfo[] jobFinishedInfo)
        {
            IServiceStateProvider serviceStateProvider = this.parentService;

            if (serviceStateProvider != null && serviceStateProvider.IsServiceDown)
            {
                JobSchedulerEventServicev2.log.InfoFormat("Parent Service Engine is in an invalid state.  Job results will be discarded.", Array.Empty <object>());
                return;
            }
            this.resultsManager.AddJobResults(jobFinishedInfo);
            for (FinishedJobInfo jobResult = this.resultsManager.GetJobResult(); jobResult != null; jobResult = this.resultsManager.GetJobResult())
            {
                try
                {
                    this.ProcessJobResult(jobResult);
                }
                catch (Exception ex)
                {
                    JobSchedulerEventServicev2.log.Error("Error processing job", ex);
                }
                finally
                {
                    this.resultsManager.FinishProcessingJobResult(jobResult);
                }
            }
        }
        // Token: 0x060005A9 RID: 1449 RVA: 0x00022360 File Offset: 0x00020560
        protected override void ProcessJobResult(FinishedJobInfo jobResult)
        {
            Guid scheduledJobId = jobResult.ScheduledJobId;

            OneTimeJobManager.PendingJobItem pendingJobItem;
            if (this.pendingJobs.TryGetValue(scheduledJobId, out pendingJobItem))
            {
                OneTimeJobRawResult result = default(OneTimeJobRawResult);
                try
                {
                    result.Success = (jobResult.Result.State == 6 && string.IsNullOrEmpty(jobResult.Result.Error));
                    if (jobResult.Result.IsResultStreamed)
                    {
                        using (IJobSchedulerHelper jobSchedulerHelper = this.jobSchedulerHelperFactory())
                        {
                            using (Stream jobResultStream = jobSchedulerHelper.GetJobResultStream(jobResult.Result.JobId, "JobResult"))
                            {
                                result.JobResultStream = new DynamicStream();
                                jobResultStream.CopyTo(result.JobResultStream);
                                result.JobResultStream.Position = 0L;
                            }
                            jobSchedulerHelper.DeleteJobResult(jobResult.Result.JobId);
                            goto IL_100;
                        }
                    }
                    if (jobResult.Result.Output != null && jobResult.Result.Output.Length != 0)
                    {
                        result.JobResultStream = new MemoryStream(jobResult.Result.Output);
                    }
IL_100:
                    result.Error = jobResult.Result.Error;
                    OneTimeJobManager.Logger.InfoFormat("Result of one time job {0} received", scheduledJobId);
                }
                catch (Exception ex)
                {
                    result.Success = false;
                    result.Error   = Resources.TestErrorInvalidResult;
                    OneTimeJobManager.Logger.ErrorFormat("Failed to process result of one time job {0}: {1}", scheduledJobId, ex);
                }
                pendingJobItem.Done(result);
                return;
            }
            OneTimeJobManager.Logger.ErrorFormat("Result of unknown job {0} received", scheduledJobId);
            if (jobResult.Result != null && jobResult.Result.IsResultStreamed)
            {
                using (IJobSchedulerHelper jobSchedulerHelper2 = this.jobSchedulerHelperFactory())
                {
                    jobSchedulerHelper2.DeleteJobResult(jobResult.Result.JobId);
                }
            }
        }
Exemple #4
0
        protected override void ProcessJobResult(FinishedJobInfo jobResult)
        {
            Guid scheduledJobId = jobResult.get_ScheduledJobId();

            OneTimeJobManager.PendingJobItem pendingJobItem;
            if (this.pendingJobs.TryGetValue(scheduledJobId, out pendingJobItem))
            {
                OneTimeJobRawResult result = new OneTimeJobRawResult();
                try
                {
                    result.Success = jobResult.get_Result().get_State() == 6 && string.IsNullOrEmpty(jobResult.get_Result().get_Error());
                    if (jobResult.get_Result().get_IsResultStreamed())
                    {
                        using (IJobSchedulerHelper ijobSchedulerHelper = this.jobSchedulerHelperFactory())
                        {
                            using (Stream jobResultStream = ((IJobScheduler)ijobSchedulerHelper).GetJobResultStream(jobResult.get_Result().get_JobId(), "JobResult"))
                            {
                                result.JobResultStream = (Stream) new DynamicStream();
                                jobResultStream.CopyTo(result.JobResultStream);
                                result.JobResultStream.Position = 0L;
                            }
                            ((IJobScheduler)ijobSchedulerHelper).DeleteJobResult(jobResult.get_Result().get_JobId());
                        }
                    }
                    else if (jobResult.get_Result().get_Output() != null && jobResult.get_Result().get_Output().Length != 0)
                    {
                        result.JobResultStream = (Stream) new MemoryStream(jobResult.get_Result().get_Output());
                    }
                    result.Error = jobResult.get_Result().get_Error();
                    OneTimeJobManager.Logger.InfoFormat("Result of one time job {0} received", (object)scheduledJobId);
                }
                catch (Exception ex)
                {
                    result.Success = false;
                    result.Error   = Resources.get_TestErrorInvalidResult();
                    OneTimeJobManager.Logger.ErrorFormat("Failed to process result of one time job {0}: {1}", (object)scheduledJobId, (object)ex);
                }
                pendingJobItem.Done(result);
            }
            else
            {
                OneTimeJobManager.Logger.ErrorFormat("Result of unknown job {0} received", (object)scheduledJobId);
                if (jobResult.get_Result() == null || !jobResult.get_Result().get_IsResultStreamed())
                {
                    return;
                }
                using (IJobSchedulerHelper ijobSchedulerHelper = this.jobSchedulerHelperFactory())
                    ((IJobScheduler)ijobSchedulerHelper).DeleteJobResult(jobResult.get_Result().get_JobId());
            }
        }
        // Token: 0x060005A8 RID: 1448 RVA: 0x000222E0 File Offset: 0x000204E0
        protected override void ProcessJobFailure(FinishedJobInfo jobResult)
        {
            Guid scheduledJobId = jobResult.ScheduledJobId;

            OneTimeJobManager.PendingJobItem pendingJobItem;
            if (this.pendingJobs.TryGetValue(scheduledJobId, out pendingJobItem))
            {
                OneTimeJobRawResult result = new OneTimeJobRawResult
                {
                    Success = false,
                    Error   = Resources.TestErrorJobFailed
                };
                OneTimeJobManager.Logger.WarnFormat("Job {0} failed with error: {1}", scheduledJobId, jobResult.Result.Error);
                pendingJobItem.Done(result);
                return;
            }
            OneTimeJobManager.Logger.ErrorFormat("Failure of unknown job {0} received", scheduledJobId);
        }
Exemple #6
0
        protected override void ProcessJobFailure(FinishedJobInfo jobResult)
        {
            Guid scheduledJobId = jobResult.get_ScheduledJobId();

            OneTimeJobManager.PendingJobItem pendingJobItem;
            if (this.pendingJobs.TryGetValue(scheduledJobId, out pendingJobItem))
            {
                OneTimeJobRawResult result = new OneTimeJobRawResult()
                {
                    Success = false,
                    Error   = Resources.get_TestErrorJobFailed()
                };
                OneTimeJobManager.Logger.WarnFormat("Job {0} failed with error: {1}", (object)scheduledJobId, (object)jobResult.get_Result().get_Error());
                pendingJobItem.Done(result);
            }
            else
            {
                OneTimeJobManager.Logger.ErrorFormat("Failure of unknown job {0} received", (object)scheduledJobId);
            }
        }
Exemple #7
0
 protected abstract void ProcessJobResult(FinishedJobInfo jobResult);
Exemple #8
0
 protected override void ProcessJobFailure(FinishedJobInfo jobInfo)
 {
     this.RemoveOldDiscoveryJob(jobInfo.get_ScheduledJobId());
 }
 // Token: 0x06000326 RID: 806 RVA: 0x00013E67 File Offset: 0x00012067
 protected override void ProcessJobResult(FinishedJobInfo jobInfo)
 {
     this.RemoveOldDiscoveryJob(jobInfo.ScheduledJobId);
 }