Inheritance: IValidatableObject
Beispiel #1
0
		public void CreateJobDetail(JobDetail jobDetail)
		{
			_jobRepository.CreateJobDetailByJobId(jobDetail.JobId,
			                                      jobDetail.Detail,
												  jobDetail.Created);
		}
Beispiel #2
0
		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().ErrorWithLineNumber(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();
		}
Beispiel #3
0
		private JobDetail CreateJobDetailFromSqlDataReader(SqlDataReader sqlDataReader)
		{
			var jobDetail = new JobDetail
			{
				Id = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("Id")),
				JobId = sqlDataReader.GetGuid(sqlDataReader.GetOrdinal("JobId")),
				Created = sqlDataReader.GetDateTime(sqlDataReader.GetOrdinal("Created")),
				Detail = sqlDataReader.GetNullableString(sqlDataReader.GetOrdinal("Detail"))
			};
			return jobDetail;
		}