public MeleeAttack(BaseJob job) { _Job = job; Damage = 100; Target = AttackTarget.DRAGON; }
/// <summary> /// Schedules multiple jobs extracted from file given via user input /// (in case of incorrect format, error message should be displyed in console) /// </summary> public static void ProcessBatchScheduleCommand(string lowerCaseInput) { string[] commandLine = lowerCaseInput.Split(); int length = commandLine.Length; //try //{ if (CheckInputData(commandLine, length)) { using (StreamReader file = new StreamReader(Paths.BatchProcessJob(commandLine[1]))) { List <BaseJob> jobList = new List <BaseJob>(); string line; while ((line = file.ReadLine()) != null) { BaseJob job = ProcessScheduleCommand(line, false); // what happens, if one of the items is not correct? if (job != null) { jobList.Add(job); } } JobScheduler.ScheduleJobs(jobList.ToArray()); } } //} //catch (Exception) // better exception handler //{ //Console.WriteLine("File not found."); //} }
public static bool ProcessJob(Guid mailboxGuid, bool mustExist, MailboxSyncerJobs.JobProcessingDelegate del) { bool result; lock (MailboxSyncerJobs.syncRoot) { BaseJob job = null; if (!MailboxSyncerJobs.activeJobs.TryGetValue(mailboxGuid, out job)) { if (mustExist) { MrsTracer.Service.Error("Job for mailbox {0} was not found.", new object[] { mailboxGuid }); throw new MailboxNotSyncedPermanentException(mailboxGuid); } result = false; } else { del(job); result = true; } } return(result); }
private static void JobStateChangedHandler(object sender, JobEventArgs args) { BaseJob baseJob = args.Job as BaseJob; if (baseJob != null) { Guid objectGuid = baseJob.RequestJobStoringMDB.ObjectGuid; switch (args.State) { case JobState.Failed: case JobState.Finished: baseJob.Disconnect(); baseJob.JobCompletedCallback(); lock (MailboxSyncerJobs.syncRoot) { MailboxSyncerJobs.activeJobs.Remove(baseJob.GetRequestKeyGuid()); ((IDisposable)baseJob).Dispose(); if (MailboxSyncerJobs.activeJobs.Count == 0) { MailboxSyncerJobs.activeJobsIsEmpty.Set(); } } MRSService.Tickle(baseJob.RequestJobGuid, baseJob.RequestJobStoringMDB.ObjectGuid, MoveRequestNotification.Canceled); break; case JobState.Waiting: break; default: return; } } }
public static XElement GetJobsDiagnosticInfo(MRSDiagnosticArgument arguments) { int num = arguments.GetArgumentOrDefault <int>("maxsize", int.MaxValue); Guid empty = Guid.Empty; string text = null; string argument = arguments.GetArgument <string>("job"); if (!string.IsNullOrEmpty(argument) && !Guid.TryParse(argument, out empty)) { text = argument; } MRSRequestType?argumentOrDefault = arguments.GetArgumentOrDefault <MRSRequestType?>("requesttype", null); XElement xelement = new XElement("Jobs"); lock (MailboxSyncerJobs.syncRoot) { using (Dictionary <Guid, BaseJob> .ValueCollection.Enumerator enumerator = MailboxSyncerJobs.activeJobs.Values.GetEnumerator()) { while (enumerator.MoveNext()) { BaseJob baseJob = enumerator.Current; if (num == 0) { break; } if ((empty == Guid.Empty || empty == baseJob.RequestJobGuid) && (argumentOrDefault == null || argumentOrDefault == baseJob.CachedRequestJob.RequestType) && (string.IsNullOrEmpty(text) || CommonUtils.IsValueInWildcardedList(baseJob.RequestJobStoringMDB.ToString(), text))) { xelement.Add(arguments.RunDiagnosticOperation(() => baseJob.GetJobDiagnosticInfo(arguments))); num--; } } } } return(xelement); }
protected QueryResponse CreateJob(BaseJob model, Type jobType, Dictionary <string, object> dataMap, string description = null) { var response = new QueryResponse { Valid = true }; try { var id = _schedulerCore.CreateJob(model.JobName, model.JobGroup, jobType, dataMap, description, model.Id == Guid.Empty ? (Guid?)null : model.Id); response.Id = id; } catch (Exception ex) { response.Valid = false; response.Errors = new List <Error> { new Error { Code = "ErrorCreatingJob", Type = "Server", Message = string.Format("Error: {0}", ex.Message) } }; } return(response); }
public JobBuilder(JobType type) { long id = JobIdAssigner.AssignId(); string name = type.ToString() + "Job"; _job = CreateInstance(name, id); }
public void Execute(IJobExecutionContext context) { string className = context.JobDetail.JobDataMap.Get(Consts.JobClassName).ToString(); string assemblyPath = context.JobDetail.JobDataMap.Get(Consts.JobAssemblyPath).ToString(); try { Assembly assembly = Consts.GetAssembly(assemblyPath); BaseJob job = assembly.CreateInstance(className) as BaseJob; object p = context.JobDetail.JobDataMap.Get(Consts.JobParameter); string ps = p == null ? string.Empty : p.ToString(); job.Execute(ps); WriteJobLog((JobDetailImpl)context.JobDetail); } catch (Exception ex) { Exception wrapper = new Exception(string.Format("Job异常, assembly:{0}; class:{1}", assemblyPath, className), ex); // LogManager.LogException(wrapper); WriteJobLog((JobDetailImpl)context.JobDetail, ex); } }
private void AutoSuspendJob() { DateTime?timestamp = base.TimeTracker.GetTimestamp(RequestJobTimestamp.CompleteAfter); DateTime?timestamp2 = base.TimeTracker.GetTimestamp(RequestJobTimestamp.StartAfter); TimeSpan incrementalSyncInterval = base.CachedRequestJob.IncrementalSyncInterval; DateTime?nextSchedule = BaseJob.GetNextScheduledTime(timestamp2, timestamp, incrementalSyncInterval); if (nextSchedule != null) { base.Report.Append(MrsStrings.ReportSyncedJob(nextSchedule.Value.ToLocalTime())); base.SaveState(SaveStateFlags.Regular, delegate(TransactionalRequestJob mergeRequest) { mergeRequest.Status = RequestStatus.Synced; this.TimeTracker.CurrentState = RequestState.AutoSuspended; this.TimeTracker.SetTimestamp(RequestJobTimestamp.DoNotPickUntil, new DateTime?(nextSchedule.Value)); mergeRequest.Message = MrsStrings.MoveRequestMessageInformational(MrsStrings.JobHasBeenSynced); }); return; } base.SaveState(SaveStateFlags.Regular, delegate(TransactionalRequestJob mergeRequest) { mergeRequest.Status = RequestStatus.Completed; base.TimeTracker.CurrentState = RequestState.Completed; mergeRequest.Message = MrsStrings.MoveRequestMessageInformational(MrsStrings.ReportRequestCompleted); }); }
public void CancelCurrentJob() { StopWatch.Stop(); ProcessJob.ExecutionTime = StopWatch.Elapsed.Ticks; ProcessJob.SwitchToCancelledState(); ProcessJob = null; }
static void Main(string[] args) { BaseJob.Initialize(new List <BaseJob> { }); BaseJob.Run(); Console.ReadKey(); }
protected virtual void AutoSuspendJob() { if (base.CachedRequestJob.SuspendWhenReadyToComplete || base.CachedRequestJob.PreventCompletion) { base.Report.Append(MrsStrings.ReportAutoSuspendingJob); base.TimeTracker.CurrentState = RequestState.AutoSuspended; base.TimeTracker.SetTimestamp(RequestJobTimestamp.Suspended, new DateTime?(DateTime.UtcNow)); base.SaveState(SaveStateFlags.Regular, delegate(TransactionalRequestJob mergeRequest) { mergeRequest.Status = RequestStatus.AutoSuspended; mergeRequest.Suspend = true; mergeRequest.Message = MrsStrings.MoveRequestMessageInformational(MrsStrings.JobHasBeenAutoSuspended); }); return; } DateTime?timestamp = base.TimeTracker.GetTimestamp(RequestJobTimestamp.CompleteAfter); DateTime?timestamp2 = base.TimeTracker.GetTimestamp(RequestJobTimestamp.StartAfter); TimeSpan incrementalSyncInterval = base.CachedRequestJob.IncrementalSyncInterval; DateTime utcNow = DateTime.UtcNow; DateTime?nextSchedule = BaseJob.GetNextScheduledTime(timestamp2, timestamp, incrementalSyncInterval); base.Report.Append(MrsStrings.ReportSyncedJob(nextSchedule.Value.ToLocalTime())); base.SaveState(SaveStateFlags.Regular, delegate(TransactionalRequestJob mergeRequest) { mergeRequest.Status = RequestStatus.Synced; this.TimeTracker.CurrentState = RequestState.AutoSuspended; this.TimeTracker.SetTimestamp(RequestJobTimestamp.DoNotPickUntil, new DateTime?(nextSchedule.Value)); mergeRequest.Message = MrsStrings.MoveRequestMessageInformational(MrsStrings.JobHasBeenSynced); }); }
/// <summary> /// Schedules baseJob extracted from user input /// (in case of incorrect format, error message should be displyed in console) /// </summary> /// <param name="input">user input</param> /// <param name="scheduleJob">Perform schedule for parsed job</param> /// <returns>Parsed job from user input</returns> public static BaseJob ProcessScheduleCommand(string input, bool scheduleJob = true) { BaseJob processedJob = null; string[] line = input.Trim().Split(); // command line int length = line.Length; if (!line[0].ToLower().Contains(ScheduleJobCommand)) { Console.WriteLine($"Command {ScheduleJobCommand} not present."); return(null); } JobType jobType; if (!Enum.TryParse(line[1], true, out jobType)) { Console.WriteLine("Bad jobtype."); return(null); } processedJob = InstanceJob(jobType, line, length); if (scheduleJob) { JobScheduler.ScheduleJobs(new BaseJob[] { processedJob }); } return(processedJob); }
public static BaseJob CreateJob(TableConfig item) { BaseJob baseJob = null; if (item == null) { throw new Exception("配置对象为空!"); } if (item.RefreshCycle == 0) { throw new Exception("配置刷新频率不能为零!"); } if (item.RefreshCycle == 0) { throw new Exception("配置刷新频率不能为零!"); } if (string.IsNullOrEmpty(item.S_DBConnstr) || string.IsNullOrEmpty(item.S_DBConnstr)) { throw new Exception("连接字符串不能为空!"); } if (string.IsNullOrEmpty(item.SelectSql)) { throw new Exception("表字段配置错误!"); } switch (item.JobType) { case JobType.FullCopy: //baseJob = new Plugin.Job_FullCopy(); break; case JobType.FilterInsert: //baseJob = new Plugin.Job_FilterInsert(); break; case JobType.FilterInsertByDel: //baseJob = new Plugin.Job_FilterInsertByDel(); break; ///定制的需要反射出来 case JobType.CustomJob: baseJob = (BaseJob)ReflectFactory.CreateFullNameObject(item.DllName, item.ClassName); break; default: throw new Exception("未知类型的任务"); } baseJob.Task_Fre = item.RefreshCycle; baseJob.Task_DelayedTime = item.DelayedTime; baseJob.S_DBSource = new DatabaseSource { Connstr = item.S_DBConnstr, DBType = item.s_DBType }; baseJob.T_DBSource = new DatabaseSource { Connstr = item.T_DBConnstr, DBType = item.t_DBType }; baseJob.SelectSql = item.SelectSql; baseJob.Columns = item.columnNames; baseJob.tableConfig = item; return(baseJob); }
internal override JobVerificationResults VerifyOtherJobsOnStack(BaseJob alternative) { if (alternative.GetIdentifier() == this.GetIdentifier()) { return(JobVerificationResults.FutureJobRendersCurrentJobRedundant); } return(JobVerificationResults.None); }
public void ProcessJobsInBatches(Restriction restriction, bool applyManualSort, SortOrder sort, MapiTable contentsTable, MapiStore systemMbx, Func <MoveJob, bool> stoppingCondition) { List <MoveJob> allMoveJobs = SystemMailboxJobs.GetAllMoveJobs(restriction, sort, contentsTable, this.MdbGuid, stoppingCondition); if (allMoveJobs != null) { if (applyManualSort) { allMoveJobs.Sort(); } MrsTracer.Throttling.Debug("Sorted jobs for Mdb: {0}", new object[] { this.MdbGuid }); SystemMailboxJobs.TraceJobs(allMoveJobs); using (List <MoveJob> .Enumerator enumerator = allMoveJobs.GetEnumerator()) { while (enumerator.MoveNext()) { MoveJob moveJob = enumerator.Current; try { using (SettingsContextBase.ActivateContext(moveJob)) { JobPickupRec pickupResult = null; CommonUtils.CatchKnownExceptions(delegate { pickupResult = moveJob.AttemptToPick(systemMbx); this.PerformPickupAccounting(moveJob.Status, pickupResult); }, delegate(Exception failure) { LocalizedString localizedString = CommonUtils.FullExceptionMessage(failure); pickupResult = new JobPickupRec(moveJob, JobPickupResult.PickupFailure, DateTime.UtcNow + MoveJob.JobPickupRetryInterval, localizedString, null); MrsTracer.Service.Error("Unexpected failure occurred trying to pick up MoveJob '{0}' from database '{1}', skipping it. {2}", new object[] { moveJob.RequestGuid, this.MdbGuid, localizedString }); MailboxReplicationService.LogEvent(MRSEventLogConstants.Tuple_UnableToProcessRequest, new object[] { moveJob.RequestGuid.ToString(), this.MdbGuid.ToString(), localizedString }); }); this.ProcessPickupResults(pickupResult); } } catch (Exception exception) { BaseJob.PerformCrashingFailureActions(moveJob.IdentifyingGuid, moveJob.RequestGuid, exception, RequestState.None, SyncStage.None); throw; } } } } }
public void Enqueue(BaseJob job) { lock (queue) // need lock? { queue.ForEach(x => x.IncreaseStarvationLevel()); queue.Add(job); queue.Sort(comparer); } }
/// <summary> /// 初始化 /// 包括 定时器的初始化 作业的初始化 配置的初始化 /// </summary> internal void Init() { #region 清空 if (mainTimer != null) { mainTimer.Stop(); mainTimer.Elapsed -= MainTimer_Elapsed; mainTimer.Dispose(); mainTimer = null; } mainTimer = new Timer { Interval = 1000, Enabled = false, }; if (taskModelList != null) { foreach (BaseJob item in taskModelList) { item.Dispose(); } } if (taskCollection != null) { foreach (Task item in taskCollection) { item.Dispose(); } } #endregion ReadConfig readConfig = new ReadConfig(); //判断是否有异常 if (readConfig.IsException) { return; } GlobalObject.RichTextLog.AppendTextByAsync("配置加载完成!", Color.Black); BaseJob model = null; //根据配置数量进行初始化作业 foreach (SourceConfig item in readConfig._SourceConfig) { foreach (TableConfig tableConfig in item.TableConfigList) { model = JobFactory.CreateJob(tableConfig); model.InitTask(); taskModelList.Add(model); } } GlobalObject.RichTextLog.AppendTextByAsync("任务初始化完成!", Color.Black); mainTimer.Elapsed += MainTimer_Elapsed; }
/// <summary> /// Получить следующую порцию работы. /// </summary> /// <returns></returns> BaseJob IJobIterator.NextJob() { byte[] buffer = new byte[_bufferSize]; int readCount = _srcStream.Read(buffer, 0, _bufferSize); BaseJob worker = null; if (readCount > 0) { worker = new GzipCompressWorker(buffer, readCount); } return(worker); }
public BaseJob Dequeue() { lock (queue) // need lock? { if (GetScheduledJobsCount() == 0) { return(null); } BaseJob inTurn = queue.First(); queue.RemoveAt(0); return(inTurn); } }
private static void QueueMergeJob(BaseJob job, IDbConnection connection, string outputFolder, string fileNameWithoutExtension, string fileExtension, JobRequest jobRequest) { ICollection <FfmpegPart> chunks = connection.Query <FfmpegPart>( "SELECT Filename, Number, Target, (SELECT VideoSourceFilename FROM FfmpegVideoRequest WHERE JobCorrelationId = @Id) AS VideoSourceFilename, Width, Height, Bitrate FROM FfmpegVideoParts WHERE JobCorrelationId = @Id ORDER BY Target, Number;", new { Id = job.JobCorrelationId }) .ToList(); foreach (IEnumerable <FfmpegPart> chunk in chunks.GroupBy(x => x.Target, x => x, (key, values) => values)) { var FfmpegVideoParts = chunk as IList <FfmpegPart> ?? chunk.ToList(); int targetNumber = FfmpegVideoParts.First().Target; DestinationFormat target = jobRequest.Targets[targetNumber]; string targetFilename = $@"{outputFolder}{Path.DirectorySeparatorChar}{fileNameWithoutExtension}_{target.Width}x{target.Height}_{target.VideoBitrate}_{target.AudioBitrate}{fileExtension}"; // TODO Implement proper detection if files are already merged if (File.Exists(targetFilename)) { continue; } string path = $"{outputFolder}{Path.DirectorySeparatorChar}{job.JobCorrelationId.ToString("N")}{Path.DirectorySeparatorChar}{fileNameWithoutExtension}_{targetNumber}.list"; using (TextWriter tw = new StreamWriter(path)) { foreach (FfmpegPart part in FfmpegVideoParts.Where(x => x.IsAudio == false)) { tw.WriteLine($"file '{part.Filename}'"); } } string audioSource = chunks.Single(x => x.IsAudio && x.Bitrate == target.AudioBitrate).Filename; string arguments = $@"-y -f concat -safe 0 -i ""{path}"" -i ""{audioSource}"" -c copy {targetFilename}"; connection.Execute( "INSERT INTO FfmpegMergeJobs (JobCorrelationId, Arguments, Needed, State, Target) VALUES(@JobCorrelationId, @Arguments, @Needed, @State, @Target);", new { JobCorrelationId = job.JobCorrelationId, Arguments = arguments, Needed = jobRequest.Needed, State = TranscodingJobState.Queued, Target = targetNumber }); } }
protected virtual void Die() { //lower the number of cultists if (myCareer != null) { } if (myJob != null) { myJob.Done(); myJob = null; } }
private static void Executor_JobDone(object sender, BaseJob job) { if (job.State == JobState.Created || job.State == JobState.InProgress) { throw new InvalidOperationException("Job is not completed yet"); } var log = $"{job.State} job: {job.JobStatus ?? string.Empty}, ID: {job.Id}"; var executionTime = $" in {job.ExecutionTime} ms."; Debug.WriteLine(log + executionTime + Environment.NewLine); LogHelper.WriteLog(log); // TODO perform some operation/s here }
public Task ExecuteJob(BaseJob baseJob) //async { ProcessJob = baseJob; StopWatch.Start(); Progress <string> progress = new Progress <string>(print); Task task = Task.Run(() => { //await baseJob.Execute(progress, CancellationToken.None); }); task.Wait(); StopWatch.Stop(); ProcessJob.ExecutionTime = StopWatch.Elapsed.Ticks; JobDone?.Invoke(this, ProcessJob); ProcessJob = null; return(task); }
public override void UnscheduleJob(BaseJob scheduleJob) { var metadata = Metadata.ExtractData(scheduleJob); if (metadata != null) { var details = _quartzScheduler.GetJobDetail(metadata.Name, metadata.Group); if (details != null) { _quartzScheduler.DeleteJob(details.Key); OnJobUnscheduled(JobInfo.Create(metadata.Group, metadata.Name)); } } }
public static BaseJob FindJob(Guid mailboxGuid, bool mustExist) { BaseJob result = null; lock (MailboxSyncerJobs.syncRoot) { if (!MailboxSyncerJobs.activeJobs.TryGetValue(mailboxGuid, out result) && mustExist) { MrsTracer.Service.Error("Job for mailbox {0} was not found.", new object[] { mailboxGuid }); throw new MailboxNotSyncedPermanentException(mailboxGuid); } } return(result); }
private void DumpIgnoredVerificationError(BaseJob job) { // By default if job is enumerate, type is directory DirectoryEntryType type = DirectoryEntryType.DIRECTORY; string fullName = ""; if (job is VerifyChangeAclJob) { type = ((VerifyChangeAclJob)job).EntryType; fullName = ((VerifyChangeAclJob)job).FullPath; } else if (job is EnumerateDirectoryChangeAclJob) { fullName = ((EnumerateDirectoryChangeAclJob)job).FullPath; } IncrementIncorrectCount(type, fullName, "Exception"); }
protected virtual void UpdateIndex(BulkLoadContext context, ICollection <ItemChange> itemChanges, Database database, ISearchIndex index) { BaseJob job = null; var indexSummary = index.RequestSummary(); if (indexSummary == null) { context.Log.Warn($"Skipping updating index '{index.Name}' because we could not get its summary."); return; } if (!context.ShouldUpdateIndex(index, indexSummary)) { context.Log.Warn($"Skipping updating index '{index.Name}' because it's empty."); return; } var touchedPercentage = (uint)Math.Ceiling((double)itemChanges.Count / Math.Max(1, indexSummary.NumberOfDocuments) * 100); if (context.IndexRebuildThresholdPercentage.HasValue && touchedPercentage > context.IndexRebuildThresholdPercentage.Value) { context.Log.Info($"Rebuilding index '{index.Name}' because {touchedPercentage}% is changed."); job = IndexCustodian.FullRebuild(index); } else if (context.Destination != null && !itemChanges.Any(ic => ic.Deleted) && // Refresh doesn't do deletes. context.IndexRefreshThresholdPercentage.HasValue && touchedPercentage > context.IndexRefreshThresholdPercentage.Value) { context.Log.Info( $"Refreshing index '{index.Name}' from '{context.Destination.ItemPath}' because {touchedPercentage}% is changed."); job = IndexCustodian.Refresh(index, new SitecoreIndexableItem(database.GetItem(new ID(context.Destination.ItemId)))); } else { var sitecoreIds = GetItemsToIndex(itemChanges, database); context.Log.Info($"Updating index '{index.Name}' with {sitecoreIds.Count} items."); job = IndexCustodian.IncrementalUpdate(index, sitecoreIds); } job.Wait(); }
public override void ScheduleJob(BaseJob scheduleJob) { var metadata = Metadata.ExtractData(scheduleJob); var jobKey = new JobKey(metadata.Name, metadata.Group); if (_quartzScheduler.CheckExists(jobKey).Result) { // if the job already scheduled, we don't want to re-schedule it return; } var job = JobBuilder.Create <QuartzJob>() .WithIdentity(metadata.Name, metadata.Group) .WithDescription(metadata.Description) .UsingJobData("TypeFullName", metadata.Type.FullName) .Build(); var trigger = TriggerBuilder.Create() .WithIdentity($"{metadata.Name}Trigger", metadata.Group) .StartNow() .WithCronSchedule(metadata.Schedule, trg => trg .WithMisfireHandlingInstructionDoNothing()) .ForJob(metadata.Name, metadata.Group) .Build(); _quartzScheduler.ScheduleJob(job, trigger); OnJobScheduled(JobInfo.Create(metadata.Group, metadata.Name, logger: scheduleJob.GetLogger(), scheduleExp: metadata.Schedule, schedule: CronExpressionDescriptor.ExpressionDescriptor.GetDescription(metadata.Schedule, new Options() { Locale = "en" }), nextFire: trigger.GetNextFireTimeUtc() )); // TODO: Find better way to schedule paused job if (metadata.State == (byte)JobState.Paused) { PauseJob(metadata.Name, metadata.Group); } }
private static void QueueMpegDashMergeJob(BaseJob job, string destinationFilename, IDbConnection connection, JobRequest jobRequest, string fileNameWithoutExtension, string outputFolder, string fileExtension) { string destinationFolder = Path.GetDirectoryName(destinationFilename); ICollection <TranscodingJobState> totalJobs = connection.Query <TranscodingJobState>("SELECT State FROM Mp4boxJobs WHERE JobCorrelationId = @Id;", new { Id = jobRequest.JobCorrelationId }) .ToList(); // One MPEG DASH merge job is already queued. Do nothing if (totalJobs.Any()) { return; } string arguments = $@"-dash 4000 -rap -frag-rap -profile onDemand -out {destinationFolder}{Path.DirectorySeparatorChar}{fileNameWithoutExtension}.mpd"; var chunks = connection.Query <FfmpegPart>( "SELECT Filename, Number, Target, (SELECT VideoSourceFilename FROM FfmpegVideoRequest WHERE JobCorrelationId = @Id) AS VideoSourceFilename FROM FfmpegVideoParts WHERE JobCorrelationId = @Id ORDER BY Target, Number;", new { Id = job.JobCorrelationId }); foreach (var chunk in chunks.GroupBy(x => x.Target, x => x, (key, values) => values)) { int targetNumber = chunk.First().Target; DestinationFormat target = jobRequest.Targets[targetNumber]; string targetFilename = $@"{outputFolder}{Path.DirectorySeparatorChar}{fileNameWithoutExtension}_{target.Width}x{target .Height}_{target.VideoBitrate}_{target.AudioBitrate}{fileExtension}"; arguments += $@" {targetFilename}"; } connection.Execute( "INSERT INTO Mp4boxJobs (JobCorrelationId, Arguments, Needed, State) VALUES(@JobCorrelationId, @Arguments, @Needed, @State);", new { JobCorrelationId = jobRequest.JobCorrelationId, Arguments = arguments, Needed = jobRequest.Needed, State = TranscodingJobState.Queued }); }
public JobMetadata ExtractData(BaseJob job) { if (!IsScheduleExpressionValid(job.Schedule)) { throw new ArgumentNullException(nameof(job.Schedule)); } Type = job.GetType(); Name = job.GetName(); Group = job.GetGroup(); var jobDetail = JobDetailService.GetJobDetail(Name, Group); Schedule = jobDetail?.JobSchedule ?? job.Schedule; Description = jobDetail?.JobDescription ?? job.GetDescription(); State = jobDetail?.StatusId ?? (byte)JobState.Normal; return(this); }
/// <summary> /// Erase the given work from the work pool. /// </summary> /// <param name="work">the work to erase from the work pool</param> /// <returns>true if successful, otherwise false.</returns> public bool Erase(BaseJob work) { return m_workPool.Erase(work); }
/// <summary> /// Push in the new work to the work pool. /// </summary> /// <param name="work">the new work to put into the work pool.</param> public void Push(BaseJob work) { m_workPool.Enqueue(work); if(m_lifePolicy==ThreadLifePolicy.SUSPEND_AFTER_WORK) Resume(); }
/// <summary> /// Process the job given, subclasses must implement this function. /// </summary> /// <param name="workerThread">The worker thread which called the DoJob.</param> /// <param name="data">The job given to this object.</param> public abstract void DoJob(BaseWorkerThread workerThread, BaseJob data);