Exemple #1
0
        public IEnumerable <ScheduledJobStatus> Launch(int scheduleId)
        {
            var schedule = m_jobsRepository.GetCompleteScheduler().FirstOrDefault(s => s.Id == scheduleId);

            if (schedule == null)
            {
                throw new InvalidOperationException("Invalid schedule");
            }

            Task.Run(() => m_executor.LaunchJob(schedule));

            return(GetStatus());
        }
Exemple #2
0
        protected override void StartJob(IJob job)
        {
            var elsaJob = job as ElsaJob;

            if (string.IsNullOrWhiteSpace(elsaJob?.Uid))
            {
                throw new InvalidOperationException("ElsaJob expected");
            }

            var jobEntity = m_jobsRepository.GetCompleteScheduler().FirstOrDefault(j => j.Uid == job.Uid);

            if (jobEntity == null)
            {
                throw new InvalidOperationException($"Invalid job Uid {elsaJob.Uid}");
            }

            m_executor.LaunchJob(jobEntity);
        }