public Job(JobConf conf) : this(conf.Name) { this.Conf = conf; conf.WorkerFiles.Each(confFile => { WorkerConf workerConf = WorkerConf.Load(confFile); this.AddWorker(workerConf.CreateWorker(this)); }); }
public virtual bool WorkerExists(string jobName, string workerName) { bool result = false; if (JobExists(jobName)) { JobConf conf = GetJob(jobName); result = conf.WorkerExists(workerName); } return(result); }
/// <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); }
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); }
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)); } }
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(); } }
/// <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); }
public void AddWorker(JobConf conf, Type type, string name) { conf.AddWorker(type, name); }
public void AddWorker <T>(JobConf conf, string name) { AddWorker(conf, typeof(T), name); }