Esempio n. 1
0
 public Job(JobConf conf)
     : this(conf.Name)
 {
     this.Conf = conf;
     conf.WorkerFiles.Each(confFile =>
     {
         WorkerConf workerConf = WorkerConf.Load(confFile);
         this.AddWorker(workerConf.CreateWorker(this));
     });
 }
Esempio n. 2
0
        public virtual bool WorkerExists(string jobName, string workerName)
        {
            bool result = false;

            if (JobExists(jobName))
            {
                JobConf conf = GetJob(jobName);
                result = conf.WorkerExists(workerName);
            }

            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// Add a worker of the specified type to the job with the specified
        /// jobName assigning the specified workerName .
        /// </summary>
        /// <param name="jobName"></param>
        /// <param name="workerTypeName"></param>
        /// <param name="workerName"></param>
        /// <returns></returns>
        public virtual void AddWorker(string jobName, string workerTypeName, string workerName)
        {
            Type type = TypeResolver.ResolveType(workerTypeName);

            if (type == null)
            {
                throw new ArgumentNullException("workerTypeName", $"Unable to find the specified WorkerType: {workerTypeName}");
            }

            JobConf jobConf = GetJob(jobName);

            AddWorker(jobConf, type, workerName);
        }
Esempio n. 4
0
        protected internal JobConf CreateJobConf(string name, bool overwrite = false)
        {
            if (JobExists(name))
            {
                throw new InvalidOperationException("The specified job {0} already exists, use GetJob to get the existing job"._Format(name));
            }

            JobConf conf = new JobConf(name)
            {
                JobDirectory = GetJobDirectoryPath(name)
            };

            conf.Save();
            return(conf);
        }
Esempio n. 5
0
 protected internal JobConf GetJobConf(string name)
 {
     if (JobExists(name))
     {
         JobConf conf = new JobConf(name)
         {
             JobDirectory = GetJobDirectoryPath(name)
         };
         return(JobConf.Load(conf.GetFilePath()));
     }
     else
     {
         return(CreateJobConf(name));
     }
 }
Esempio n. 6
0
        protected internal void EnqueueJob(JobConf conf, int stepNumber = 0)
        {
            Args.ThrowIfNull(conf, "JobConf");

            lock (_jobQueueLock)
            {
                if (!_isRunning)
                {
                    StartJobRunnerThread();
                }

                Job job = conf.CreateJob();
                job.StepNumber = stepNumber;
                JobQueue.Enqueue(job);
                _enqueueSignal.Set();
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Enqueue a job to be run next (typically instant if no other
        /// jobs are running).
        /// </summary>
        /// <param name="name"></param>
        /// <param name="stepNumber"></param>
        public virtual void EnqueueJob(string name, int stepNumber = 0)
        {
            JobConf conf = GetJobConf(name);

            EnqueueJob(conf, stepNumber);
        }
Esempio n. 8
0
 public void AddWorker(JobConf conf, Type type, string name)
 {
     conf.AddWorker(type, name);
 }
Esempio n. 9
0
 public void AddWorker <T>(JobConf conf, string name)
 {
     AddWorker(conf, typeof(T), name);
 }