aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Integration
diff options
context:
space:
mode:
authorRoy <Roy.mail.net@gmail.com>2022-11-16 04:04:58 +0200
committerRoy <Roy.mail.net@gmail.com>2022-11-16 04:04:58 +0200
commit5dc67f5f613825f9f835b9cfb9790be69f6538a4 (patch)
tree6f23cf177d02a296b88d79ab3b77ee5eeaf3e10a /Software/Visual_Studio/Tango.Integration
parentba8c20b11ce7c94c7e81c4f23302ed97acbc6dcf (diff)
downloadTango-5dc67f5f613825f9f835b9cfb9790be69f6538a4.tar.gz
Tango-5dc67f5f613825f9f835b9cfb9790be69f6538a4.zip
Statistics Streaming.
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration')
-rw-r--r--Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs18
-rw-r--r--Software/Visual_Studio/Tango.Integration/JobRuns/IJobRunsLogger.cs5
-rw-r--r--Software/Visual_Studio/Tango.Integration/JobRuns/JobRunAvailableEventArgs.cs20
-rw-r--r--Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj1
4 files changed, 37 insertions, 7 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs b/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs
index 38fc472bc..40f1d0789 100644
--- a/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs
+++ b/Software/Visual_Studio/Tango.Integration/JobRuns/BasicJobRunsLogger.cs
@@ -31,6 +31,8 @@ namespace Tango.Integration.JobRuns
private MachineStatus _startMachineStatus;
private JobTicket _jobTicket;
+ public event EventHandler<JobRunAvailableEventArgs> JobRunAvailable;
+
#region Properties
/// <summary>
@@ -222,19 +224,19 @@ namespace Tango.Integration.JobRuns
db.SaveChanges();
+ JobRunInfo jobRunInfo = new JobRunInfo();
+ jobRunInfo.JobRunID = run.ID;
+ jobRunInfo.JobTicket = _jobTicket;
+ jobRunInfo.Events = _currentJobEvents.Select(x => MachinesEventDTO.FromObservable(x)).ToList();
+ jobRunInfo.StartMachineStatus = _startMachineStatus;
+ jobRunInfo.EndMachineStatus = MachineOperator.MachineStatus?.Clone();
+
if (CreateJobRunsFiles)
{
try
{
Directory.CreateDirectory(JobRunsFolder);
- JobRunInfo jobRunInfo = new JobRunInfo();
- jobRunInfo.JobRunID = run.ID;
- jobRunInfo.JobTicket = _jobTicket;
- jobRunInfo.Events = _currentJobEvents.Select(x => MachinesEventDTO.FromObservable(x)).ToList();
- jobRunInfo.StartMachineStatus = _startMachineStatus;
- jobRunInfo.EndMachineStatus = MachineOperator.MachineStatus?.Clone();
-
String json = jobRunInfo.ToJsonString();
File.WriteAllText(Path.Combine(JobRunsFolder, $"{run.ID}.run"), json);
@@ -245,6 +247,8 @@ namespace Tango.Integration.JobRuns
LogManager.Log(ex, "Error creating job run extended info file.");
}
}
+
+ JobRunAvailable?.Invoke(this, new JobRunAvailableEventArgs() { JobRunInfo = jobRunInfo, JobRun = run });
}
}
catch (Exception ex)
diff --git a/Software/Visual_Studio/Tango.Integration/JobRuns/IJobRunsLogger.cs b/Software/Visual_Studio/Tango.Integration/JobRuns/IJobRunsLogger.cs
index 386298bb9..46a840a2e 100644
--- a/Software/Visual_Studio/Tango.Integration/JobRuns/IJobRunsLogger.cs
+++ b/Software/Visual_Studio/Tango.Integration/JobRuns/IJobRunsLogger.cs
@@ -15,6 +15,11 @@ namespace Tango.Integration.JobRuns
public interface IJobRunsLogger
{
/// <summary>
+ /// Occurs when a new job run is available.
+ /// </summary>
+ event EventHandler<JobRunAvailableEventArgs> JobRunAvailable;
+
+ /// <summary>
/// Gets the machine operator.
/// </summary>
IMachineOperator MachineOperator { get; }
diff --git a/Software/Visual_Studio/Tango.Integration/JobRuns/JobRunAvailableEventArgs.cs b/Software/Visual_Studio/Tango.Integration/JobRuns/JobRunAvailableEventArgs.cs
new file mode 100644
index 000000000..b3b39109a
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Integration/JobRuns/JobRunAvailableEventArgs.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.Entities;
+
+namespace Tango.Integration.JobRuns
+{
+ public class JobRunAvailableEventArgs : EventArgs
+ {
+ public JobRunInfo JobRunInfo { get; set; }
+ public JobRun JobRun { get; set; }
+
+ public JobRunAvailableEventArgs()
+ {
+ JobRunInfo = new JobRunInfo();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj
index 2834989a7..79baefff0 100644
--- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj
+++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj
@@ -111,6 +111,7 @@
<Compile Include="IntegrationSettings.cs" />
<Compile Include="JobRuns\BasicJobRunsLogger.cs" />
<Compile Include="JobRuns\IJobRunsLogger.cs" />
+ <Compile Include="JobRuns\JobRunAvailableEventArgs.cs" />
<Compile Include="JobRuns\JobRunInfo.cs" />
<Compile Include="Logging\EmbeddedLogFileParser.cs" />
<Compile Include="Operation\AdditionalJobConfiguration.cs" />