예제 #1
0
        public List<JobExecutionStatus> GetJobFireTimes()
        {
            //TODO: Get next fire time for jobs which are not currently running
            List<JobExecutionStatus> jobStatusList = new List<JobExecutionStatus>();
            var jobKeys = scheduler.GetJobKeys(GroupMatcher<JobKey>.AnyGroup());
            foreach (var job in jobKeys)
            {
                var triggers = scheduler.GetTriggersOfJob(job);

                foreach (var trigger in triggers)
                {
                    var jobStatus = new JobExecutionStatus();
                    jobStatus.JobKey = job.Name;
                    jobStatus.TriggerName = trigger.Key.Name;
                    jobStatus.PreviousFireTime = GetLocalDateTime(trigger.GetPreviousFireTimeUtc());
                    jobStatus.NextFireTime = GetLocalDateTime(trigger.GetNextFireTimeUtc());

                    jobStatusList.Add(jobStatus);
                }
            }

            return jobStatusList;
        }
예제 #2
0
        public List<JobExecutionStatus> GetCurrentJobStatus()
        {
            var executingJobs = scheduler.GetCurrentlyExecutingJobs();
            List<JobExecutionStatus> jobStatusList = new List<JobExecutionStatus>();

            foreach(var exJob in executingJobs)
            {
                var jobStatus = new JobExecutionStatus();

                jobStatus.JobKey = exJob.JobDetail.Key.Name;
                jobStatus.TriggerName = exJob.Trigger.Key.Name;
                jobStatus.FireTime = GetLocalDateTime(exJob.FireTimeUtc);
                jobStatus.PreviousFireTime = GetLocalDateTime(exJob.PreviousFireTimeUtc);
                jobStatus.ScheduledFireTime = GetLocalDateTime(exJob.ScheduledFireTimeUtc);
                jobStatus.NextFireTime = GetLocalDateTime(exJob.NextFireTimeUtc);
                jobStatus.JobRunTime = exJob.JobRunTime.TotalSeconds;
                jobStatus.State = scheduler.GetTriggerState(exJob.Trigger.Key).ToString();

                jobStatusList.Add(jobStatus);
            }

            return jobStatusList;
        }