public void RunGsJob() { SetUpGhostscript(); InitMissingData(); _jobRunner.RunJob(Job); }
public async void ExecuteWorkflowStep(Job job) { ProgressPercentage = 0; await Task.Run(() => { try { job.OnJobCompleted += OnJobCompleted; job.OnJobProgressChanged += OnJobProgressChanged; job.OnJobHasError += OnAnErrorOccurredInJob; // TODO: Maybe move to a more resonable place, i.e. trigger conversion as result of the task? var preCheck = _profileChecker.ProfileCheck(job.Profile, job.Accounts); if (!preCheck) { throw new ProcessingException("Invalid Profile", preCheck[0]); } _jobRunner.RunJob(job, _outputFileMover); _finishedEvent.WaitOne(); StepFinished?.Invoke(this, EventArgs.Empty); } finally { job.OnJobCompleted -= OnJobCompleted; job.OnJobProgressChanged -= OnJobProgressChanged; job.OnJobHasError -= OnAnErrorOccurredInJob; } }); }
public async Task ExecuteWorkflowStep(Job job) { ProgressPercentage = 0; try { _taskCompletionSource = new TaskCompletionSource <JobCompletedEventArgs>(); job.OnJobCompleted += OnJobCompleted; job.OnJobProgressChanged += OnJobProgressChanged; job.OnJobHasError += OnAnErrorOccurredInJob; await _jobRunner.RunJob(job, _outputFileMover); await _taskCompletionSource.Task; StepFinished?.Invoke(this, EventArgs.Empty); } finally { job.OnJobCompleted -= OnJobCompleted; job.OnJobProgressChanged -= OnJobProgressChanged; job.OnJobHasError -= OnAnErrorOccurredInJob; } }
public async void ExecuteWorkflowStep(Job job) { ProgressPercentage = 0; await Task.Run(() => { try { job.OnJobCompleted += OnJobCompleted; job.OnJobProgressChanged += OnJobProgressChanged; job.OnJobHasError += OnAnErrorOccurredInJob; _jobRunner.RunJob(job, _outputFileMover); _finishedEvent.WaitOne(); StepFinished?.Invoke(this, EventArgs.Empty); } finally { job.OnJobCompleted -= OnJobCompleted; job.OnJobProgressChanged -= OnJobProgressChanged; job.OnJobHasError -= OnAnErrorOccurredInJob; } }); }
public void RunGsJob() { SetUpGhostscript(); InitMissingData(); var outputFileMover = new AutosaveOutputFileMover(new DirectoryWrap(), new FileWrap(), new PathUtil(new PathWrap(), new DirectoryWrap()), new DirectoryHelper(new DirectoryWrap())); _jobRunner.RunJob(Job, outputFileMover); }
public async Task <ActionResult <string> > StartJob([FromBody] JobDescription jobDescription) { //string project = Guid.NewGuid().ToString("N"); var personGenerator = new PersonNameGenerator(); string project = $"{personGenerator.GenerateRandomFirstName()}_{personGenerator.GenerateRandomLastName()}"; await _jobRunner.RunJob(jobDescription, $"{project}"); return($"STARTED: jobDescription.Build"); }
public async Task Handle(RunPullRequestsJob command) { if (command.IsReset) { await _repository.UpdateFieldValue <TeamMember, DateTime?>(m => command.Members.Contains(m.Id), m => m.LastPullRequestsFetchDate, null); } var parameters = new Dictionary <string, object> { { PullRequestsSyncJob.MembersParameterName, command.Members } }; await _jobRunner.RunJob <PullRequestsSyncJob>(parameters); }
public void RunWorkFlow_CheckOrderOfCallsAndActionAssignmentsForCompleteProcess() { SetUpConditionsForCompleteWorkflow(); _workflow.RunWorkflow(_job); Received.InOrder(() => { _jobDataUpdater.UpdateTokensAndMetadata(_job); _query.ComposeTargetFileName(_job); _profileChecker.ProfileCheck(_job.Profile, Arg.Any <Accounts>()); _jobRunner.RunJob(_job); }); }
public async Task Handle(RunWorkitemsJob command) { if (command.IsReset) { await _repository.UpdateFieldValue <TeamMember, DateTime?>(m => command.Members.Contains(m.Id), m => m.LastWorkitemsFetchDate, DateTime.UtcNow.AddYears(-10)); await _repository.UpdateFieldValue <TeamMember, int[]>(m => command.Members.Contains(m.Id), m => m.RelatedWorkItems, new int[0]); } var parameters = new Dictionary <string, object> { { WorkItemsSyncJob.MembersParameterName, command.Members } }; await _jobRunner.RunJob <WorkItemsSyncJob>(parameters); }
private void DoWorkflowWork() { _workflowResult = WorkflowResult.Init; _logger.Debug("Starting conversion..."); var originalMetadata = Job.JobInfo.Metadata.Copy(); Job.InitMetadataWithTemplates(); _jobDataUpdater.UpdateTokensAndMetadata(Job); _logger.Debug("Querying the place to save the file"); try { _targetFileNameComposer.ComposeTargetFileName(Job); } catch (ManagePrintJobsException) { // revert metadata changes and rethrow exception Job.JobInfo.Metadata = originalMetadata; throw; } var preCheck = _profileChecker.ProfileCheck(Job.Profile, Job.Accounts); if (!preCheck) { throw new ProcessingException("Invalid Profile", preCheck[0]); } _logger.Debug("Output filename template is: {0}", Job.OutputFilenameTemplate); _logger.Debug("Output format is: {0}", Job.Profile.OutputFormat); _logger.Info("Converting " + Job.OutputFilenameTemplate); // Can throw ProcessingException _jobRunner.RunJob(Job); _workflowResult = WorkflowResult.Finished; OnJobFinished(EventArgs.Empty); }
protected override void DoWorkflowWork(Job job) { job.OutputFilenameTemplate = _targetFileNameComposer.ComposeTargetFileName(job); var preCheck = _profileChecker.ProfileCheck(job.Profile, job.Accounts); if (!preCheck) { throw new ProcessingException("Invalid Profile", preCheck[0]); } job.Passwords = JobPasswordHelper.GetJobPasswords(job.Profile, job.Accounts); // Can throw ProcessingException _jobRunner.RunJob(job, _outputFileMover); WorkflowResult = WorkflowResult.Finished; OnJobFinished(EventArgs.Empty); }
protected override void DoWorkflowWork(Job job) { var documentName = job.JobInfo.Metadata.Title; var currentProfile = job.Profile; try { job.OutputFileTemplate = _targetFilePathComposer.ComposeTargetFilePath(job); var result = _profileChecker.CheckJob(job); if (!result) { throw new ProcessingException("Invalid Profile", result[0]); } job.Passwords = JobPasswordHelper.GetJobPasswords(job.Profile, job.Accounts); job.CleanUpOnError = true; // Can throw ProcessingException. Use GetAwaiter().GetResult() to unwrap an occuring AggregateException. _jobRunner.RunJob(job, _outputFileMover).GetAwaiter().GetResult(); WorkflowResult = WorkflowResult.Finished; OnJobFinished(EventArgs.Empty); documentName = Path.GetFileName(job.OutputFiles.First()); if (currentProfile.ShowAllNotifications && !currentProfile.ShowOnlyErrorNotifications) { _notificationService?.ShowInfoNotification(documentName, job.OutputFiles.First()); } } catch (Exception) { if (currentProfile.ShowAllNotifications || currentProfile.ShowOnlyErrorNotifications) { _notificationService?.ShowErrorNotification(documentName); } throw; } }