// Token: 0x0600037C RID: 892 RVA: 0x000161F8 File Offset: 0x000143F8
        private Guid SubmitScheduledJobToScheduler(Guid jobId, ScheduledJob job, bool executeImmediately, bool useLocal)
        {
            Guid result;

            using (IJobSchedulerHelper jobSchedulerHelper = useLocal ? JobScheduler.GetLocalInstance() : JobScheduler.GetMainInstance())
            {
                if (jobId == Guid.Empty)
                {
                    OrionDiscoveryJobFactory.log.Debug("Adding new job to Job Engine");
                    result = jobSchedulerHelper.AddJob(job);
                }
                else
                {
                    try
                    {
                        OrionDiscoveryJobFactory.log.DebugFormat("Updating job definition in Job Engine ({0})", jobId);
                        jobSchedulerHelper.UpdateJob(jobId, job, executeImmediately);
                        return(jobId);
                    }
                    catch (FaultException <JobEngineConnectionFault> )
                    {
                        OrionDiscoveryJobFactory.log.DebugFormat("Unable to update job definition in Job Engine({0}", jobId);
                        throw;
                    }
                    catch (Exception)
                    {
                        OrionDiscoveryJobFactory.log.DebugFormat("Unable to update job definition in Job Engine({0}", jobId);
                    }
                    OrionDiscoveryJobFactory.log.Debug("Adding new job to Job Engine");
                    result = jobSchedulerHelper.AddJob(job);
                }
            }
            return(result);
        }
Exemple #2
0
 private Guid SubmitScheduledJobToScheduler(ScheduledJob job)
 {
     using (IJobSchedulerHelper ijobSchedulerHelper = this.jobSchedulerHelperFactory())
     {
         OneTimeJobManager.Logger.Debug((object)"Adding new job to Job Engine");
         return(((IJobScheduler)ijobSchedulerHelper).AddJob(job));
     }
 }
        // Token: 0x060005A5 RID: 1445 RVA: 0x000220B4 File Offset: 0x000202B4
        private Guid SubmitScheduledJobToScheduler(ScheduledJob job)
        {
            Guid result;

            using (IJobSchedulerHelper jobSchedulerHelper = this.jobSchedulerHelperFactory())
            {
                OneTimeJobManager.Logger.Debug("Adding new job to Job Engine");
                result = jobSchedulerHelper.AddJob(job);
            }
            return(result);
        }
Exemple #4
0
        private RSACryptoServiceProvider CreateCrypoService()
        {
            if (string.IsNullOrEmpty(this.schedulerPublicKey))
            {
                using (IJobSchedulerHelper ijobSchedulerHelper = this.jobSchedulerHelperFactory())
                    this.schedulerPublicKey = ((IJobScheduler)ijobSchedulerHelper).GetPublicKey();
            }
            RSACryptoServiceProvider cryptoServiceProvider = new RSACryptoServiceProvider();

            cryptoServiceProvider.FromXmlString(this.schedulerPublicKey);
            return(cryptoServiceProvider);
        }
        // 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 #6
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());
            }
        }
Exemple #7
0
 protected void RemoveJob(Guid jobId)
 {
     try
     {
         using (IJobSchedulerHelper instance = JobScheduler.GetInstance())
         {
             JobSchedulerEventsService.log.DebugFormat("Removing job {0}", (object)jobId);
             ((IJobScheduler)instance).RemoveJob(jobId);
         }
     }
     catch (Exception ex)
     {
         JobSchedulerEventsService.log.ErrorFormat("Error removing job {0}.  Exception: {1}", (object)jobId, (object)ex.ToString());
     }
 }
 // Token: 0x060002D2 RID: 722 RVA: 0x00011830 File Offset: 0x0000FA30
 protected void RemoveJob(Guid jobId)
 {
     try
     {
         using (IJobSchedulerHelper localInstance = JobScheduler.GetLocalInstance())
         {
             JobSchedulerEventServicev2.log.DebugFormat("Removing job {0}", jobId);
             localInstance.RemoveJob(jobId);
         }
     }
     catch (Exception ex)
     {
         JobSchedulerEventServicev2.log.ErrorFormat("Error removing job {0}.  Exception: {1}", jobId, ex.ToString());
     }
 }
 public static bool DeleteJob(Guid jobId)
 {
     using (IJobSchedulerHelper instance = JobScheduler.GetInstance())
     {
         try
         {
             ((IJobScheduler)instance).RemoveJob(jobId);
             return(true);
         }
         catch
         {
             DiscoveryJobFactory.log.DebugFormat("Unable to delete job in Job Engine({0}", (object)jobId);
             return(false);
         }
     }
 }
        // Token: 0x06000322 RID: 802 RVA: 0x00013DD8 File Offset: 0x00011FD8
        public static bool DeleteJob(Guid jobId)
        {
            bool result;

            using (IJobSchedulerHelper instance = JobScheduler.GetInstance())
            {
                try
                {
                    instance.RemoveJob(jobId);
                    result = true;
                }
                catch
                {
                    DiscoveryJobFactory.log.DebugFormat("Unable to delete job in Job Engine({0}", jobId);
                    result = false;
                }
            }
            return(result);
        }