public AeTitleJobProcessor(
            ClaraApplicationEntity configuration,
            IInstanceStoredNotificationService instanceStoredNotificationService,
            ILoggerFactory loggerFactory,
            IJobs jobsApi,
            IJobStore jobStore,
            IInstanceCleanupQueue cleanupQueue,
            IDicomToolkit dicomToolkit,
            CancellationToken cancellationToken) : base(instanceStoredNotificationService, loggerFactory, jobsApi, jobStore, cleanupQueue, cancellationToken)
        {
            if (loggerFactory is null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
            _dicomToolkit  = dicomToolkit ?? throw new ArgumentNullException(nameof(dicomToolkit));
            _instances     = new Dictionary <string, InstanceCollection>();
            _pipelines     = new Dictionary <string, string>();

            _logger = loggerFactory.CreateLogger <AeTitleJobProcessor>();

            _timer           = new System.Timers.Timer(1000);
            _timer.AutoReset = false;
            _timer.Elapsed  += OnTimedEvent;
            _timer.Enabled   = true;

            _jobs = new BlockingCollection <InstanceCollection>();

            InitializeSettings();
            _jobProcessingTask = ProcessJobs();
        }
Exemplo n.º 2
0
 public JobSpeechEN(IJobStore _store)
 {
     this.StoreJob  = _store;
     this.queue     = new QueueThreadSafe <string>();
     this.storeUrl  = new DictionaryThreadSafe <string, string>();
     this.storePath = new DictionaryThreadSafe <string, string>();
 }
Exemplo n.º 3
0
 public ExaminationController(ExaminationPlanManager examManager, CandidateManager candidateManager, IRecruitmentPlanStore recruitmentPlanStore, IJobStore jobStore)
 {
     this.examManager          = examManager;
     this.candidateManager     = candidateManager;
     this.recruitmentPlanStore = recruitmentPlanStore;
     this.jobStore             = jobStore;
 }
Exemplo n.º 4
0
 public JobLink(IJobStore _store)
 {
     this.StoreJob = _store;
     list          = new ListThreadSafe <oLink>();
     msg           = new QueueThreadSafe <Message>();
     urlData       = new DictionaryThreadSafe <string, string>();
 }
Exemplo n.º 5
0
		public override void SetUp()
		{
			base.SetUp();

			mockJobStore = Mocks.CreateMock<IJobStore>();
			mockJobRunner = Mocks.CreateMock<IJobRunner>();
			mockLogger = Mocks.CreateMock<ILogger>();
			mockTrigger = Mocks.PartialMock<Trigger>();
			scheduler = new DefaultScheduler(mockJobStore, mockJobRunner);

			dummyJobData = new JobData();
			dummyJobSpec = new JobSpec("foo", "bar", "key", mockTrigger);
			dummyJobDetails = new JobDetails(dummyJobSpec, DateTime.UtcNow);

			isWoken = false;

			// Ensure the scheduler is initialized.
			mockJobStore.RegisterScheduler(scheduler.Guid, scheduler.Name);
			Mocks.Replay(mockJobStore);
			scheduler.Initialize();
			Mocks.Verify(mockJobStore);
			Mocks.BackToRecord(mockJobStore);

			mockJobStore.UnregisterScheduler(scheduler.Guid);

			// Create a separate uninitialized scheduler for certain tests.
			uninitializedScheduler = new DefaultScheduler(mockJobStore, mockJobRunner);
		}
Exemplo n.º 6
0
 public RecruitmentController(RecruitmentPlanManager recruitmentPlanManager, ApplicationFormManager enrollmentManager, ApplicationUserManager userManager, IJobStore jobStore)
 {
     this.recruitmentManager     = recruitmentPlanManager;
     this.applicationFormManager = enrollmentManager;
     this.targetUserManager      = userManager;
     this.jobStore = jobStore;
 }
Exemplo n.º 7
0
        private static TimeSpan ComputeDelayForRepeatedErrors(IJobStore jobStore, int acquiresFailed)
        {
            var delay = TimeSpan.FromMilliseconds(100);

            try
            {
                // TODO v4, use interface
                if (jobStore is JobStoreSupport jobStoreSupport)
                {
                    delay = jobStoreSupport.GetAcquireRetryDelay(acquiresFailed);
                }
                else if (jobStore is RAMJobStore ramJobStore)
                {
                    delay = ramJobStore.GetAcquireRetryDelay(acquiresFailed);
                }
            }
            catch
            {
                // we're trying to be useful in case of error states, not cause
                // additional errors..
            }

            // sanity check per getAcquireRetryDelay specification
            if (delay < minDelay)
            {
                delay = minDelay;
            }

            if (delay > maxDelay)
            {
                delay = maxDelay;
            }

            return(delay);
        }
Exemplo n.º 8
0
 public JobDispatcher(IJobStore jobStore)
 {
     if (jobStore == null)
         throw new ArgumentNullException(nameof(jobStore));
     this.jobStore = jobStore;
     this.webClient = new HttpWebClient();
 }
 public QuartzNetHostedService(QuartzNetConfig config, IScheduler scheduler, IJobStore jobStore, ISchedulerManager schedulerManager)
 {
     _config           = config;
     _scheduler        = scheduler;
     _jobStore         = jobStore;
     _schedulerManager = schedulerManager;
 }
 /// <summary>
 /// Creates a scheduler using the specified thread pool and job store and
 /// binds it for remote access.
 /// </summary>
 /// <param name="schedulerName">The name for the scheduler.</param>
 /// <param name="schedulerInstanceId">The instance ID for the scheduler.</param>
 /// <param name="threadPool">The thread pool for executing jobs</param>
 /// <param name="jobStore">The type of job store</param>
 /// <param name="schedulerPluginMap"></param>
 /// <param name="idleWaitTime">The idle wait time. You can specify TimeSpan.Zero for
 /// the default value, which is currently 30000 ms.</param>
 public virtual void CreateScheduler(string schedulerName, string schedulerInstanceId, IThreadPool threadPool,
                                     IJobStore jobStore, IDictionary <string, ISchedulerPlugin> schedulerPluginMap, TimeSpan idleWaitTime)
 {
     CreateScheduler(
         schedulerName, schedulerInstanceId, threadPool, DefaultThreadExecutor,
         jobStore, schedulerPluginMap, idleWaitTime);
 }
Exemplo n.º 11
0
 public SchedulerManager(QuartzNetConfig config, IScheduler scheduler, IJobStore jobStore, IServiceRoute serviceRoute)
 {
     _config       = config;
     _scheduler    = scheduler;
     _jobStore     = jobStore;
     _serviceRoute = serviceRoute;
 }
Exemplo n.º 12
0
        public override void SetUp()
        {
            base.SetUp();

            mockJobStore  = Mocks.CreateMock <IJobStore>();
            mockJobRunner = Mocks.CreateMock <IJobRunner>();
            mockLogger    = Mocks.CreateMock <ILogger>();
            mockTrigger   = Mocks.PartialMock <Trigger>();
            scheduler     = new DefaultScheduler(mockJobStore, mockJobRunner);

            dummyJobData    = new JobData();
            dummyJobSpec    = new JobSpec("foo", "bar", "key", mockTrigger);
            dummyJobDetails = new JobDetails(dummyJobSpec, DateTime.UtcNow);

            isWoken = false;

            // Ensure the scheduler is initialized.
            mockJobStore.RegisterScheduler(scheduler.Guid, scheduler.Name);
            Mocks.Replay(mockJobStore);
            scheduler.Initialize();
            Mocks.Verify(mockJobStore);
            Mocks.BackToRecord(mockJobStore);

            mockJobStore.UnregisterScheduler(scheduler.Guid);

            // Create a separate uninitialized scheduler for certain tests.
            uninitializedScheduler = new DefaultScheduler(mockJobStore, mockJobRunner);
        }
Exemplo n.º 13
0
 public SignalRProgressLog(JobInfo jobInfo, IJobStore jobRepository, HubConnection hubConnection)
 {
     _jobInfo       = jobInfo;
     _jobRepository = jobRepository;
     _hubConnection = hubConnection;
     _log           = Log.ForContext("JobId", jobInfo.JobId);
     _fullLog       = new StringBuilder();
 }
Exemplo n.º 14
0
 public static IJob Create(this IJobStore jobStore, string url, DateTime scheduledOn, string method = null)
 {
     if (jobStore == null)
     {
         throw new ArgumentNullException(nameof(jobStore));
     }
     return(jobStore.Queue(new JobDetails(url, scheduledOn, method)));
 }
Exemplo n.º 15
0
 private void Initialize(IJobStore jobStore, ISettingsProvider settingsProvider, ILoggingProvider loggingProvider)
 {
     this.jobStore = jobStore;
     this.logger   = loggingProvider;
     this.settings = settingsProvider;
     this.jobStore.JobActionRequired += new EventHandler <JobActionRequiredEventArgs>(jobStore_JobActionRequired);
     this.jobStore.JobDeleted        += new EventHandler <JobActionRequiredEventArgs>(jobStore_JobDeleted);
 }
Exemplo n.º 16
0
        public JobController(ILogger <JobController> logger, IJobStore jobStore, ISchedulerRemoting schedulerRemoting, ILoadBalancerFactory loadBalancerFactory)
        {
            _logger = logger;

            _jobStore            = jobStore;
            _schedulerRemoting   = schedulerRemoting;
            _loadBalancerFactory = loadBalancerFactory;
        }
Exemplo n.º 17
0
 public JobDispatcher(IJobStore jobStore)
 {
     if (jobStore == null)
     {
         throw new ArgumentNullException(nameof(jobStore));
     }
     this.jobStore  = jobStore;
     this.webClient = new HttpWebClient();
 }
        public JobProgressUpdaterFactory(
            IJobStore jobStore,
            ILoggerFactory loggerFactory)
        {
            EnsureArg.IsNotNull(jobStore, nameof(jobStore));

            _jobStore      = jobStore;
            _loggerFactory = loggerFactory;
        }
Exemplo n.º 19
0
 public DefaultClusterStateMonitor(
     ISchedulerMetadataStore <TSchedulerKey> schedulerMetadataStore,
     IJobStore <TJobKey, TSchedulerKey> jobStore,
     ILogger <DefaultClusterStateMonitor <TSchedulerKey, TJobKey> > logger)
 {
     this.schedulerMetadataStore = schedulerMetadataStore;
     this.jobStore = jobStore;
     this.logger   = logger;
 }
Exemplo n.º 20
0
 public DefaultJobProcessor(
     ISingleJobProcessor <TSchedulerKey, TJobKey> singleJobProcessor,
     IJobStore <TJobKey, TSchedulerKey> jobStore,
     ILogger <DefaultJobProcessor <TSchedulerKey, TJobKey> > logger)
 {
     this.singleJobProcessor = singleJobProcessor;
     this.jobStore           = jobStore;
     this.logger             = logger;
 }
Exemplo n.º 21
0
        protected void SetUp()
        {
            fJobStore = new RAMJobStore();
            fSignaler = new SampleSignaler();
            fJobStore.Initialize(null, fSignaler);

            fJobDetail         = new JobDetail("job1", "jobGroup1", typeof(NoOpJob));
            fJobDetail.Durable = true;
            fJobStore.StoreJob(null, fJobDetail, false);
        }
Exemplo n.º 22
0
        public void SetUp()
        {
            fJobStore = new RAMJobStore();
            fSignaler = new SampleSignaler();
            fJobStore.Initialize(null, fSignaler);

            fJobDetail = new JobDetailImpl("job1", "jobGroup1", typeof (NoOpJob));
            fJobDetail.Durable = true;
            fJobStore.StoreJob(fJobDetail, false);
        }
Exemplo n.º 23
0
 public DataController(IUserStore userStore,
                       IJobStore jobStore,
                       IImportFormParser parser,
                       IImportService importService)
 {
     _userStore     = userStore;
     _jobStore      = jobStore;
     _parser        = parser;
     _importService = importService;
 }
Exemplo n.º 24
0
        public fChromium(IJobStore store) : base(store)
        {
            this.Text              = "English";
            this.OnReceiveMessage += f_event_OnReceiveMessage;
            this.Shown            += f_form_Shown;
            this.FormClosing      += f_form_Closing;

            f_brow_Init();
            f_tab_Init();
        }
 public MockJobProcessor(
     ClaraApplicationEntity configuration,
     IInstanceStoredNotificationService instanceStoredNotificationService,
     ILoggerFactory loggerFactory,
     IJobs jobsApi,
     IJobStore jobStore,
     IInstanceCleanupQueue cleanupQueue,
     CancellationToken cancellationToken) : base(instanceStoredNotificationService, loggerFactory, jobsApi, jobStore, cleanupQueue, cancellationToken)
 {
     _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
 }
 public DefaultSingleJobProcessor(
     IJobStore <TJobKey, TSchedulerKey> jobStore,
     ISyncHelper syncHelper,
     IJobFactory jobFactory,
     ILogger <DefaultSingleJobProcessor <TSchedulerKey, TJobKey> > logger)
 {
     this.jobStore   = jobStore;
     this.syncHelper = syncHelper;
     this.jobFactory = jobFactory;
     this.logger     = logger;
 }
Exemplo n.º 27
0
        public void SetUp()
        {
            fJobStore = new RAMJobStore();
            fSignaler = new SampleSignaler();
            fJobStore.Initialize(null, fSignaler);
            fJobStore.SchedulerStarted();

            fJobDetail         = new JobDetailImpl("job1", "jobGroup1", typeof(NoOpJob));
            fJobDetail.Durable = true;
            fJobStore.StoreJob(fJobDetail, false);
        }
Exemplo n.º 28
0
 /// <summary>
 /// Creates a scheduler using the specified thread pool and job store and
 /// binds it for remote access.
 /// </summary>
 /// <param name="schedulerName">The name for the scheduler.</param>
 /// <param name="schedulerInstanceId">The instance ID for the scheduler.</param>
 /// <param name="threadPool">The thread pool for executing jobs</param>
 /// <param name="jobStore">The type of job store</param>
 /// <param name="schedulerPluginMap"></param>
 /// <param name="idleWaitTime">The idle wait time. You can specify TimeSpan.Zero for
 ///     the default value, which is currently 30000 ms.</param>
 /// <param name="maxBatchSize">The maximum batch size of triggers, when acquiring them</param>
 /// <param name="batchTimeWindow">The time window for which it is allowed to "pre-acquire" triggers to fire</param>
 public virtual void CreateScheduler(
     string schedulerName,
     string schedulerInstanceId,
     IThreadPool threadPool,
     IJobStore jobStore,
     IDictionary <string, ISchedulerPlugin> schedulerPluginMap,
     TimeSpan idleWaitTime,
     int maxBatchSize,
     TimeSpan batchTimeWindow)
 {
     CreateScheduler(schedulerName, schedulerInstanceId, threadPool, jobStore, schedulerPluginMap, idleWaitTime, maxBatchSize, batchTimeWindow, null);
 }
Exemplo n.º 29
0
        private void InitJobStore()
        {
            fJobStore = new RavenJobStore();

            fJobStore.ClearAllSchedulingData();
            fSignaler = new SampleSignaler();
            fJobStore.Initialize(null, fSignaler);
            fJobStore.SchedulerStarted();

            fJobDetail         = new JobDetailImpl("job1", "jobGroup1", typeof(NoOpJob));
            fJobDetail.Durable = true;
            fJobStore.StoreJob(fJobDetail, true);
        }
Exemplo n.º 30
0
 public AccountController(IUserStore userStore,
                          IOwnerSettingsStore ownerSettingsStore,
                          IRepoSettingsStore repoSettingsStore,
                          IDatasetStore datasetStore,
                          IJobStore jobStore,
                          ISchemaStore schemaStore)
 {
     _userStore          = userStore;
     _ownerSettingsStore = ownerSettingsStore;
     _repoSettingsStore  = repoSettingsStore;
     _datasetStore       = datasetStore;
     _jobStore           = jobStore;
     _schemaStore        = schemaStore;
 }
Exemplo n.º 31
0
        public static void Initialize(TestContext context)
        {
            originalHeartbeat = BlueCollarSection.Current.Heartbeat;
            originalRetryTimeout = BlueCollarSection.Current.RetryTimeout;
            BlueCollarSection.Current.Heartbeat = Heartbeat;
            BlueCollarSection.Current.RetryTimeout = RetryTimeout;

            jobStore = JobStore.Create();
            jobStore.DeleteAllJobs();

            jobRunner = new JobRunner(jobStore, Guid.NewGuid().ToString() + ".bin", false, Heartbeat, MaximumConcurrency, RetryTimeout, true, new JobScheduleElement[0]);
            jobRunner.Error += new EventHandler<JobErrorEventArgs>(JobRunnerError);
            jobRunner.Start();
        }
 public JobSubmissionService(
     IInstanceCleanupQueue cleanupQueue,
     ILogger <JobSubmissionService> logger,
     IJobs jobsApi,
     IPayloads payloadsApi,
     IJobStore jobStore,
     IFileSystem fileSystem)
 {
     _cleanupQueue = cleanupQueue ?? throw new ArgumentNullException(nameof(cleanupQueue));
     _logger       = logger ?? throw new ArgumentNullException(nameof(logger));
     _jobsApi      = jobsApi ?? throw new ArgumentNullException(nameof(jobsApi));
     _payloadsApi  = payloadsApi ?? throw new ArgumentNullException(nameof(payloadsApi));
     _jobStore     = jobStore ?? throw new ArgumentNullException(nameof(jobStore));
     _fileSystem   = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
 }
Exemplo n.º 33
0
 public DataRetrievalService(
     IDicomWebClientFactory dicomWebClientFactory,
     ILogger <DataRetrievalService> logger,
     IInferenceRequestStore inferenceRequestStore,
     IFileSystem fileSystem,
     IDicomToolkit dicomToolkit,
     IJobStore jobStore)
 {
     _dicomWebClientFactory = dicomWebClientFactory ?? throw new ArgumentNullException(nameof(dicomWebClientFactory));
     _inferenceRequestStore = inferenceRequestStore ?? throw new ArgumentNullException(nameof(inferenceRequestStore));
     _fileSystem            = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
     _dicomToolkit          = dicomToolkit ?? throw new ArgumentNullException(nameof(dicomToolkit));
     _jobStore = jobStore ?? throw new ArgumentNullException(nameof(jobStore));
     _logger   = logger ?? throw new ArgumentNullException(nameof(logger));
 }
        public JobProgressUpdater(
            IJobStore jobStore,
            Job job,
            ILogger <JobProgressUpdater> logger)
        {
            _jobStore = EnsureArg.IsNotNull(jobStore, nameof(jobStore));
            _job      = EnsureArg.IsNotNull(job, nameof(job));
            _logger   = EnsureArg.IsNotNull(logger, nameof(logger));
            var channelOptions = new UnboundedChannelOptions
            {
                SingleReader = true,
                SingleWriter = false,
            };

            _progressChannel = Channel.CreateUnbounded <TaskContext>(channelOptions);
        }
		/// <summary>
		/// Creates a scheduler with a default name.
		/// </summary>
		/// <param name="jobStore">The job store</param>
		/// <param name="jobRunner">The job runner</param>
		/// <exception cref="ArgumentNullException">Thrown if <paramref name="jobStore"/> or
		/// <paramref name="jobRunner"/> is null</exception>
		public DefaultScheduler(IJobStore jobStore, IJobRunner jobRunner)
		{
			if (jobStore == null)
				throw new ArgumentNullException("jobStore");
			if (jobRunner == null)
				throw new ArgumentNullException("jobRunner");

			this.jobStore = jobStore;
			this.jobRunner = jobRunner;

			logger = NullLogger.Instance;
			errorRecoveryDelayInSeconds = DefaultErrorRecoveryDelayInSeconds;

			guid = Guid.NewGuid();
			name = GetDefaultName();
		}
Exemplo n.º 36
0
	    /// <summary>
	    /// Creates a scheduler using the specified thread pool and job store and
	    /// binds it for remote access.
	    /// </summary>
	    /// <param name="schedulerName">The name for the scheduler.</param>
	    /// <param name="schedulerInstanceId">The instance ID for the scheduler.</param>
	    /// <param name="threadPool">The thread pool for executing jobs</param>
	    /// <param name="jobStore">The type of job store</param>
	    /// <param name="schedulerPluginMap"></param>
	    /// <param name="idleWaitTime">The idle wait time. You can specify TimeSpan.Zero for
	    ///     the default value, which is currently 30000 ms.</param>
	    /// <param name="maxBatchSize">The maximum batch size of triggers, when acquiring them</param>
	    /// <param name="batchTimeWindow">The time window for which it is allowed to "pre-acquire" triggers to fire</param>
	    public virtual void CreateScheduler(
	        string schedulerName,
	        string schedulerInstanceId,
	        IThreadPool threadPool,
	        IJobStore jobStore,
	        IDictionary<string, ISchedulerPlugin> schedulerPluginMap,
	        TimeSpan idleWaitTime,
	        int maxBatchSize,
	        TimeSpan batchTimeWindow)
	    {
	        CreateScheduler(schedulerName, schedulerInstanceId, threadPool, jobStore, schedulerPluginMap, idleWaitTime, maxBatchSize, batchTimeWindow, null);
	    }
Exemplo n.º 37
0
        /// <summary>
        /// Creates a scheduler using the specified thread pool and job store and
        /// binds it for remote access.
        /// </summary>
        /// <param name="schedulerName">The name for the scheduler.</param>
        /// <param name="schedulerInstanceId">The instance ID for the scheduler.</param>
        /// <param name="threadPool">The thread pool for executing jobs</param>
        /// <param name="threadExecutor">Thread executor.</param>
        /// <param name="jobStore">The type of job store</param>
        /// <param name="schedulerPluginMap"></param>
        /// <param name="idleWaitTime">The idle wait time. You can specify TimeSpan.Zero for
        /// the default value, which is currently 30000 ms.</param>
        /// <param name="dbFailureRetryInterval">The db failure retry interval.</param>
        /// <param name="maxBatchSize">The maximum batch size of triggers, when acquiring them</param>
        /// <param name="batchTimeWindow">The time window for which it is allowed to "pre-acquire" triggers to fire</param>
        public virtual void CreateScheduler(string schedulerName, string schedulerInstanceId, IThreadPool threadPool, IThreadExecutor threadExecutor,
                                            IJobStore jobStore, IDictionary<string, ISchedulerPlugin> schedulerPluginMap, TimeSpan idleWaitTime,
                                            TimeSpan dbFailureRetryInterval, int maxBatchSize, TimeSpan batchTimeWindow)
        {
            // Currently only one run-shell factory is available...
            IJobRunShellFactory jrsf = new StdJobRunShellFactory();

            // Fire everything u
            // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            threadPool.Initialize();

            QuartzSchedulerResources qrs = new QuartzSchedulerResources();

            qrs.Name = schedulerName;
            qrs.InstanceId = schedulerInstanceId;

            SchedulerDetailsSetter.SetDetails(threadPool, schedulerName, schedulerInstanceId);

            qrs.JobRunShellFactory = jrsf;
            qrs.ThreadPool = threadPool;
            qrs.ThreadExecutor= threadExecutor;
            qrs.JobStore = jobStore;
            qrs.MaxBatchSize = maxBatchSize;
            qrs.BatchTimeWindow = batchTimeWindow;

            // add plugins
            if (schedulerPluginMap != null)
            {
                foreach (ISchedulerPlugin plugin in schedulerPluginMap.Values)
                {
                    qrs.AddSchedulerPlugin(plugin);
                }
            }

            QuartzScheduler qs = new QuartzScheduler(qrs, idleWaitTime, dbFailureRetryInterval);

            ITypeLoadHelper cch = new SimpleTypeLoadHelper();
            cch.Initialize();

            SchedulerDetailsSetter.SetDetails(jobStore, schedulerName, schedulerInstanceId);
            jobStore.Initialize(cch, qs.SchedulerSignaler);

            IScheduler scheduler = new StdScheduler(qs);

            jrsf.Initialize(scheduler);

            qs.Initialize();

            // Initialize plugins now that we have a Scheduler instance.
            if (schedulerPluginMap != null)
            {
                foreach (var pluginEntry in schedulerPluginMap)
                {
                    pluginEntry.Value.Initialize(pluginEntry.Key, scheduler);
                }
            }

            Log.Info(string.Format(CultureInfo.InvariantCulture, "Quartz scheduler '{0}", scheduler.SchedulerName));

            Log.Info(string.Format(CultureInfo.InvariantCulture, "Quartz scheduler version: {0}", qs.Version));

            SchedulerRepository schedRep = SchedulerRepository.Instance;

            qs.AddNoGCObject(schedRep); // prevents the repository from being
            // garbage collected

            schedRep.Bind(scheduler);

            initialized = true;
        }
Exemplo n.º 38
0
 /// <summary>
 /// Creates a scheduler using the specified thread pool and job store and
 /// binds it for remote access.
 /// </summary>
 /// <param name="schedulerName">The name for the scheduler.</param>
 /// <param name="schedulerInstanceId">The instance ID for the scheduler.</param>
 /// <param name="threadPool">The thread pool for executing jobs</param>
 /// <param name="threadExecutor">Thread executor.</param>
 /// <param name="jobStore">The type of job store</param>
 /// <param name="schedulerPluginMap"></param>
 /// <param name="idleWaitTime">The idle wait time. You can specify TimeSpan.Zero for
 /// the default value, which is currently 30000 ms.</param>
 /// <param name="dbFailureRetryInterval">The db failure retry interval.</param>
 public virtual void CreateScheduler(string schedulerName, string schedulerInstanceId, IThreadPool threadPool, IThreadExecutor threadExecutor,
                                     IJobStore jobStore, IDictionary<string, ISchedulerPlugin> schedulerPluginMap, TimeSpan idleWaitTime,
                                     TimeSpan dbFailureRetryInterval)
 {
     CreateScheduler(schedulerName, schedulerInstanceId, threadPool, threadExecutor, jobStore, schedulerPluginMap, idleWaitTime, dbFailureRetryInterval, DefaultBatchMaxSize, DefaultBatchTimeWindow);
 }
Exemplo n.º 39
0
 /// <summary>
 /// Creates a scheduler using the specified thread pool and job store and
 /// binds it for remote access.
 /// </summary>
 /// <param name="schedulerName">The name for the scheduler.</param>
 /// <param name="schedulerInstanceId">The instance ID for the scheduler.</param>
 /// <param name="threadPool">The thread pool for executing jobs</param>
 /// <param name="jobStore">The type of job store</param>
 /// <param name="idleWaitTime">The idle wait time. You can specify "-1" for
 /// the default value, which is currently 30000 ms.</param>
 /// <param name="dbFailureRetryInterval">The db failure retry interval.</param>
 public virtual void CreateScheduler(string schedulerName, string schedulerInstanceId, IThreadPool threadPool,
                                     IJobStore jobStore, TimeSpan idleWaitTime,
                                     TimeSpan dbFailureRetryInterval)
 {
     CreateScheduler(schedulerName, schedulerInstanceId, threadPool, jobStore, null, idleWaitTime, dbFailureRetryInterval);
 }
Exemplo n.º 40
0
        /// <summary>
        /// Same as DirectSchedulerFactory#createScheduler(ThreadPool threadPool, JobStore jobStore),
        /// with the addition of specifying the scheduler name and instance ID. This
        /// scheduler can only be retrieved via DirectSchedulerFactory#getScheduler(String)
        /// </summary>
        /// <param name="schedulerName">The name for the scheduler.</param>
        /// <param name="schedulerInstanceId">The instance ID for the scheduler.</param>
        /// <param name="threadPool">The thread pool for executing jobs</param>
        /// <param name="jobStore">The type of job store</param>
        public virtual void CreateScheduler(string schedulerName, string schedulerInstanceId, IThreadPool threadPool,
		                                    IJobStore jobStore)
        {
            CreateScheduler(schedulerName, schedulerInstanceId, threadPool, jobStore, TimeSpan.Zero, TimeSpan.Zero);
        }
Exemplo n.º 41
0
 /// <summary> 
 /// Creates a scheduler using the specified thread pool and job store. This
 /// scheduler can be retrieved via DirectSchedulerFactory#GetScheduler()
 /// </summary>
 /// <param name="threadPool">
 /// The thread pool for executing jobs
 /// </param>
 /// <param name="jobStore">
 /// The type of job store
 /// </param>
 /// <throws>  SchedulerException </throws>
 /// <summary>           if initialization failed
 /// </summary>
 public virtual void CreateScheduler(IThreadPool threadPool, IJobStore jobStore)
 {
     CreateScheduler(DefaultSchedulerName, DefaultInstanceId, threadPool, jobStore);
     initialized = true;
 }
Exemplo n.º 42
0
        /// <summary>
        /// Enqueues the job for execution using the given <see cref="IJobStore"/>.
        /// </summary>
        /// <param name="store">The job store to use when queueing the job.</param>
        /// <returns>The job record that was persisted.</returns>
        public virtual JobRecord Enqueue(IJobStore store)
        {
            if (store == null)
            {
                throw new ArgumentNullException("store", "store cannot be null.");
            }

            JobRecord record = this.CreateRecord();
            store.SaveJob(record);

            return record;
        }
Exemplo n.º 43
0
 /// <summary>
 /// Initializes a new instance of the JobRunner class.
 /// </summary>
 /// <param name="store">The <see cref="IJobStore"/> to use when accessing job data.</param>
 public JobRunner(IJobStore store)
     : this(store, BlueCollarSection.Current.PersistencePathResolved)
 {
 }
 /// <summary>
 /// Initializes a new instance of the JobStoreTestBase class.
 /// </summary>
 /// <param name="store">The store to use for the tests.</param>
 protected JobStoreTestBase(IJobStore store)
 {
     this.Store = store;
 }
Exemplo n.º 45
0
 /// <summary>
 /// Initializes a new instance of the JobRunner class.
 /// </summary>
 /// <param name="store">The <see cref="IJobStore"/> to use when accessing job data.</param>
 /// <param name="runningJobsPersistencePath">The path to use when saving running jobs state to disk.</param>
 public JobRunner(IJobStore store, string runningJobsPersistencePath)
     : this(store, runningJobsPersistencePath, BlueCollarSection.Current.Store.DeleteRecordsOnSuccess, BlueCollarSection.Current.Heartbeat, BlueCollarSection.Current.MaximumConcurrency, BlueCollarSection.Current.RetryTimeout, BlueCollarSection.Current.Enabled)
 {
 }
Exemplo n.º 46
0
 /// <summary>
 /// Initializes a new instance of the JobRunner class.
 /// </summary>
 /// <param name="store">The <see cref="IJobStore"/> to use when accessing job data.</param>
 /// <param name="runningJobsPersistencePath">The path to use when saving running jobs state to disk.</param>
 /// <param name="deleteRecordsOnSuccess">A value indicating whether to delete records after successful job runs.</param>
 /// <param name="heartbeat">The heartbeat, in milliseconds, to poll for jobs with.</param>
 /// <param name="maximumConcurrency">The maximum number of simultaneous jobs to run.</param>
 /// <param name="retryTimeout">The timeout, in milliseconds, to use for failed job retries.</param>
 /// <param name="enabled">A value indicating whether dequeueing new jobs is enabled.</param>
 public JobRunner(IJobStore store, string runningJobsPersistencePath, bool deleteRecordsOnSuccess, int heartbeat, int maximumConcurrency, int retryTimeout, bool enabled)
     : this(store, runningJobsPersistencePath, deleteRecordsOnSuccess, heartbeat, maximumConcurrency, retryTimeout, enabled, BlueCollarSection.Current.Schedules)
 {
 }
Exemplo n.º 47
0
 /// <summary>
 /// Initializes a new instance of the JobRunner class.
 /// </summary>
 /// <param name="store">The <see cref="IJobStore"/> to use when accessing job data.</param>
 /// <param name="runningJobsPersistencePath">The path to use when saving running jobs state to disk.</param>
 /// <param name="deleteRecordsOnSuccess">A value indicating whether to delete records after successful job runs.</param>
 /// <param name="heartbeat">The heartbeat, in milliseconds, to poll for jobs with.</param>
 /// <param name="maximumConcurrency">The maximum number of simultaneous jobs to run.</param>
 /// <param name="retryTimeout">The timeout, in milliseconds, to use for failed job retries.</param>
 /// <param name="enabled">A value indicating whether dequeueing new jobs is enabled.</param>
 /// <param name="schedules">The collection of scheduled jobs to run.</param>
 public JobRunner(IJobStore store, string runningJobsPersistencePath, bool deleteRecordsOnSuccess, int heartbeat, int maximumConcurrency, int retryTimeout, bool enabled, IEnumerable<JobScheduleElement> schedules)
 {
     this.store = store ?? JobStore.Current;
     this.runs = new RunningJobs(runningJobsPersistencePath);
     this.deleteRecordsOnSuccess = deleteRecordsOnSuccess;
     this.heartbeat = heartbeat < 1 ? 10000 : heartbeat;
     this.maximumConcurrency = maximumConcurrency < 1 ? 25 : maximumConcurrency;
     this.retryTimeout = retryTimeout < 1 ? 60000 : retryTimeout;
     this.isEnabled = enabled;
     this.SetSchedules(schedules);
 }
Exemplo n.º 48
0
	    /// <summary>
	    /// Creates a scheduler using the specified thread pool and job store and
	    /// binds it for remote access.
	    /// </summary>
	    /// <param name="schedulerName">The name for the scheduler.</param>
	    /// <param name="schedulerInstanceId">The instance ID for the scheduler.</param>
	    /// <param name="threadPool">The thread pool for executing jobs</param>
	    /// <param name="jobStore">The type of job store</param>
	    /// <param name="schedulerPluginMap"></param>
	    /// <param name="idleWaitTime">The idle wait time. You can specify TimeSpan.Zero for
	    /// the default value, which is currently 30000 ms.</param>
	    public virtual void CreateScheduler(string schedulerName, string schedulerInstanceId, IThreadPool threadPool,
                                            IJobStore jobStore, IDictionary<string, ISchedulerPlugin> schedulerPluginMap, TimeSpan idleWaitTime)
		{
			CreateScheduler(
                schedulerName, schedulerInstanceId, threadPool, jobStore, schedulerPluginMap, idleWaitTime, DefaultBatchMaxSize, DefaultBatchTimeWindow);
		}
Exemplo n.º 49
0
	    /// <summary>
	    /// Creates a scheduler using the specified thread pool and job store and
	    /// binds it for remote access.
	    /// </summary>
	    /// <param name="schedulerName">The name for the scheduler.</param>
	    /// <param name="schedulerInstanceId">The instance ID for the scheduler.</param>
	    /// <param name="threadPool">The thread pool for executing jobs</param>
	    /// <param name="jobStore">The type of job store</param>
	    /// <param name="idleWaitTime">The idle wait time. You can specify "-1" for
	    /// the default value, which is currently 30000 ms.</param>
	    public virtual void CreateScheduler(string schedulerName, string schedulerInstanceId, IThreadPool threadPool,
                                            IJobStore jobStore, TimeSpan idleWaitTime)
        {
            CreateScheduler(schedulerName, schedulerInstanceId, threadPool, jobStore, null, idleWaitTime);
        }
Exemplo n.º 50
0
	    /// <summary>
		/// Creates a scheduler using the specified thread pool and job store and
		/// binds it to RMI.
		/// </summary>
		/// <param name="schedulerName">The name for the scheduler.</param>
		/// <param name="schedulerInstanceId">The instance ID for the scheduler.</param>
		/// <param name="threadPool">The thread pool for executing jobs</param>
		/// <param name="jobStore">The type of job store</param>
		/// <param name="schedulerPluginMap"></param>
		/// <param name="idleWaitTime">The idle wait time. You can specify TimeSpan.Zero for
		/// the default value, which is currently 30000 ms.</param>
		/// <param name="dbFailureRetryInterval">The db failure retry interval.</param>
		public virtual void CreateScheduler(string schedulerName, string schedulerInstanceId, IThreadPool threadPool,
                                            IJobStore jobStore, IDictionary schedulerPluginMap, TimeSpan idleWaitTime,
		                                    TimeSpan dbFailureRetryInterval)
		{
			// Currently only one run-shell factory is available...
			IJobRunShellFactory jrsf = new StdJobRunShellFactory();

			// Fire everything up
			// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
			SchedulingContext schedCtxt = new SchedulingContext();
			schedCtxt.InstanceId = schedulerInstanceId;

			SchedulerSchedulerResources qrs = new SchedulerSchedulerResources();

			qrs.Name = schedulerName;
			qrs.InstanceId = schedulerInstanceId;
			qrs.JobRunShellFactory = jrsf;
			qrs.ThreadPool = threadPool;
			qrs.JobStore = jobStore;


            // add plugins
            if (schedulerPluginMap != null)
            {
                foreach (ISchedulerPlugin plugin in schedulerPluginMap.Values)
                {
                    qrs.AddSchedulerPlugin(plugin);
                }
            }

			SchedulerScheduler qs = new SchedulerScheduler(qrs, schedCtxt, idleWaitTime, dbFailureRetryInterval);

			ITypeLoadHelper cch = new CascadingClassLoadHelper();
			cch.Initialize();

			jobStore.Initialize(cch, qs.SchedulerSignaler);

			IScheduler scheduler = new StdScheduler(qs, schedCtxt);

            // Initialize plugins now that we have a Scheduler instance.
            if (schedulerPluginMap != null)
            {
                foreach (DictionaryEntry pluginEntry in schedulerPluginMap)
                {
                    ((ISchedulerPlugin)pluginEntry.Value).Initialize(
                            (string) pluginEntry.Key, scheduler);
                }
            }

			jrsf.Initialize(scheduler, schedCtxt);

			Log.Info(string.Format(CultureInfo.InvariantCulture, "Scheduler scheduler '{0}", scheduler.SchedulerName));

			Log.Info(string.Format(CultureInfo.InvariantCulture, "Scheduler scheduler version: {0}", qs.Version));

			SchedulerRepository schedRep = SchedulerRepository.Instance;

			qs.AddNoGCObject(schedRep); // prevents the repository from being
			// garbage collected

			schedRep.Bind(scheduler);
		}