/// <summary> /// Create a job out of this wrapper /// </summary> public Job CreateJob(string hash) { var jobInputString = JobObjectSerializer.Serialize(JobInput); var job = new Job(Id, HandlerId, jobInputString, hash); return(job); }
/// <summary> /// Converts the result to the generic result object and calls the abstract method /// to process the data /// </summary> public void ProcessResult(IJobInput jobInput, string jobResultString) { var output = JobObjectSerializer.Deserialize <TOut>(jobResultString); ProcessResult((TIn)jobInput, output); Interlocked.Decrement(ref _jobCount); }
/// <summary> /// Converts the result to the generic result object and calls the abstract method /// to process the data /// </summary> public void ProcessResult(IJobInput jobInput, string jobResultString, object additionalData) { var output = JobObjectSerializer.Deserialize <TOut>(jobResultString); ProcessResult((TIn)jobInput, output, additionalData); Interlocked.Decrement(ref _jobCount); // Finish if no more jobs are pending if (Interlocked.Read(ref _jobCount) == 0) { IsFinished = true; } }
public JobResult Process(Job job, Guid clientId) { var inputString = job.GetInput(); var inputObject = JobObjectSerializer.Deserialize <TIn>(inputString); try { var outputObject = Process(inputObject); var outputString = JobObjectSerializer.Serialize(outputObject); var result = new JobResult(job, clientId, outputString); return(result); } catch (Exception ex) { return(new JobResult(job, clientId, ex)); } }
public PackageInfo GetInfo(string packageName) { var content = File.ReadAllText(BuildInfoFileName(packageName)); return(JobObjectSerializer.Deserialize <PackageInfo>(content)); }
public void Save(PackageInfo packageInfo) { var serializedInfo = JobObjectSerializer.Serialize(packageInfo); File.WriteAllText(BuildInfoFileName(packageInfo.PackageName), serializedInfo); }