static void CreateJobs(ClusterLoadRepository repo, string poolName) { Task <IEnumerable <JobInstance> > tJobs; var J1 = new JobInstance() { id = Guid.NewGuid().ToString(), Nodes = 4, QueueName = poolName, SchedulerId = "124", Status = AutoScaling.Models.JobStatusEnum.Queued }; repo.CreateJobInstanceAsync(J1).Wait(); var J2 = new JobInstance() { id = Guid.NewGuid().ToString(), Nodes = 4, QueueName = poolName, SchedulerId = "127", Status = AutoScaling.Models.JobStatusEnum.Queued }; repo.CreateJobInstanceAsync(J2).Wait(); var J3 = new JobInstance() { id = Guid.NewGuid().ToString(), Nodes = 8, QueueName = poolName, SchedulerId = "130", Status = AutoScaling.Models.JobStatusEnum.Queued }; repo.CreateJobInstanceAsync(J3).Wait(); tJobs = repo.GetJobInstancesAsync(poolName); var jobs = tJobs.Result; foreach (var item in jobs) { Console.WriteLine($"{item.id} {item.Status}"); } }
static void DeleteJobs(ClusterLoadRepository repo, string poolName) { Task <IEnumerable <JobInstance> > tJobs; tJobs = repo.GetJobInstancesAsync(poolName); var jobs = tJobs.Result; // clean up foreach (var item in jobs) { repo.DeleteJobInstanceAsync(item.id).Wait(); } }
public ClusterLoad GetVMLoad(string poolName) { var load = new ClusterLoad(); Task <IEnumerable <JobInstance> > tJobs; Task <IEnumerable <VMInstance> > tVms; tJobs = _repo.GetJobInstancesAsync(poolName); load.Jobs = tJobs.Result; tVms = _repo.GetVMInstancesAsync(poolName); load.Nodes = tVms.Result; return(load); }