diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs b/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs index 293e0bcc6..c29ec8319 100644 --- a/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs +++ b/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs @@ -318,23 +318,30 @@ namespace Tango.Integration.JobRuns //TODO: Needs to resubmit this to Azure! Then in Azure Distinct by job run ID, by job guid, by latest! - try + JobRunInfo jobRunInfo = null; + + if (CreateJobRunsFiles) { - String jobInfoPath = Path.Combine(JobRunsFolder, $"{run.ID}.run"); + try + { + String jobInfoPath = Path.Combine(JobRunsFolder, $"{run.ID}.run"); - if (File.Exists(jobInfoPath)) + if (File.Exists(jobInfoPath)) + { + String json = File.ReadAllText(jobInfoPath); + jobRunInfo = JsonConvert.DeserializeObject<JobRunInfo>(json); + jobRunInfo.Events.AddRange(_currentJobEvents.Select(x => MachinesEventDTO.FromObservable(x)).ToList()); + jobRunInfo.EndMachineStatus = MachineOperator.MachineStatus?.Clone(); + File.WriteAllText(jobInfoPath, jobRunInfo.ToJsonString()); + } + } + catch (Exception ex) { - String json = File.ReadAllText(jobInfoPath); - JobRunInfo info = JsonConvert.DeserializeObject<JobRunInfo>(json); - info.Events.AddRange(_currentJobEvents.Select(x => MachinesEventDTO.FromObservable(x)).ToList()); - info.EndMachineStatus = MachineOperator.MachineStatus?.Clone(); - File.WriteAllText(jobInfoPath, info.ToJsonString()); + LogManager.Log(ex, "Error while trying to update jobrun info file after job resume."); } } - catch (Exception ex) - { - LogManager.Log(ex, "Error while trying to update jobrun info file after job resume."); - } + + JobRunAvailable?.Invoke(this, new JobRunAvailableEventArgs() { JobRunInfo = jobRunInfo, JobRun = run }); } catch (Exception ex) { |
