aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.JobRunsGenerator/Program.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2020-01-12 15:56:50 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2020-01-12 15:56:50 +0200
commit9949e351e152a929da696ef2f0a1f8b1668e83fa (patch)
tree40212bc488ea64cbaf137455c6a2280333c997dc /Software/Visual_Studio/Utilities/Tango.JobRunsGenerator/Program.cs
parent9016d57f876a70952dda4419d68b568b586ef0ec (diff)
downloadTango-9949e351e152a929da696ef2f0a1f8b1668e83fa.tar.gz
Tango-9949e351e152a929da696ef2f0a1f8b1668e83fa.zip
Merged Beta+ fixes to master.
Diffstat (limited to 'Software/Visual_Studio/Utilities/Tango.JobRunsGenerator/Program.cs')
-rw-r--r--Software/Visual_Studio/Utilities/Tango.JobRunsGenerator/Program.cs22
1 files changed, 19 insertions, 3 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.JobRunsGenerator/Program.cs b/Software/Visual_Studio/Utilities/Tango.JobRunsGenerator/Program.cs
index 61e74957c..960795da0 100644
--- a/Software/Visual_Studio/Utilities/Tango.JobRunsGenerator/Program.cs
+++ b/Software/Visual_Studio/Utilities/Tango.JobRunsGenerator/Program.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -15,7 +16,7 @@ namespace Tango.JobRunsGenerator
static void Main(string[] args)
{
DataSource dataSource = new DataSource();
- dataSource.Catalog = "Tango_DEV";
+ dataSource.Catalog = "Tango_TEST";
dataSource.Address = "twine.database.windows.net";
dataSource.IntegratedSecurity = false;
dataSource.UserName = "Roy";
@@ -23,11 +24,26 @@ namespace Tango.JobRunsGenerator
using (ObservablesContext db = ObservablesContext.CreateDefault(dataSource))
{
- foreach (var run in db.JobRuns.OrderBy(x => x.JobGuid))
+ var count = db.JobRuns.Where(x => x.MachineGuid == null).Count();
+
+ int index = 0;
+ int saveIndex = 0;
+
+ var runs = db.JobRuns.Where(x => x.MachineGuid == null).OrderBy(x => x.JobGuid).ToList();
+
+ foreach (var run in runs)
{
var job = db.Jobs.SingleOrDefault(x => x.Guid == run.JobGuid);
- Console.WriteLine($"Fixing job {job.Name}...");
+ Console.WriteLine($"Fixing job {job.Name}... ({index++}/{count})");
run.MachineGuid = job.MachineGuid;
+
+ saveIndex++;
+
+ if (saveIndex > 100)
+ {
+ saveIndex = 0;
+ db.SaveChanges();
+ }
}
Console.WriteLine("Saving changed...");