public IHttpActionResult JobFailed([FromBody] JobFailed jobFailed) { var isValidRequest = _validator.ValidateObject(jobFailed); if (!isValidRequest.Success) { return(BadRequest(isValidRequest.Message)); } Task.Factory.StartNew(() => { var workerNodeUri = Request.RequestUri.GetLeftPart(UriPartial.Authority); this.Log().InfoWithLineNumber(WhoAmI(Request) + ": Received job failed from a Node ( jobId, Node ) : ( " + jobFailed.JobId + ", " + workerNodeUri + " )"); var progress = new JobDetail { JobId = jobFailed.JobId, Created = DateTime.UtcNow, Detail = jobFailed.AggregateException.ToString() }; _jobManager.CreateJobDetail(progress); _jobManager.UpdateResultForJob(jobFailed.JobId, "Failed", DateTime.UtcNow); _jobManager.AssignJobToWorkerNodes(); }); return(Ok()); }
public void ShouldReturnBadRequestIfJobFailedGetsInvalidJobFailedModel() { var jobFailed = new JobFailed(); var response = ManagerController.JobFailed(jobFailed); Assert.IsInstanceOf(typeof(BadRequestErrorMessageResult), response); }
public void DoJob() { try { OnDoJob(); JobFinished?.Invoke(this, EventArgs.Empty); } catch (Exception err) { JobFailed?.Invoke(this, err); throw; } }
public void OnJobFailed(JobInfo job, string reason, string details = null, bool notifyUser = false) { using var scope = scopeFactory.CreateScope(); using var dataContext = scope.ServiceProvider.GetRequiredService <DataContext>(); job.State = JobState.Failed; job.Completed = DateTimeOffset.UtcNow; dataContext.SaveChanges(); userLogger.LogInfo("Job failed", reason, userId: job.UserId, jobId: job.Id); JobFailed?.Invoke(this, new JobFailedEventArgs() { Job = job, Reason = reason, Details = details }); }
public void InvokeJobFailed(TranslationJob job) { JobFailed?.Invoke(job); }
/// <summary> /// Method to handle action taken when a job is put in retry. /// This method is called after the retry has been marked in storage. /// </summary> /// <param name="msg">the Job retry message</param> protected virtual void OnJobRetry(JobFailed msg) { }
private void OnJobFailed(JobFailedEventArgs eventArgs) => JobFailed?.Invoke(this, eventArgs);