public void OnIOCompleted(IIORequest request) { if (JobStatus == NodeJobStatus.Blocked) { if (IOs.Contains(request)) { if (Waitings.All(w => w.IsComplete) && IOs.All(i => i.IsComplete)) { JobStatus = NodeJobStatus.Ready; ReadyTime = DateTime.Now; } } } }
public void OnJobStatusChanged(IJobRecord record) { if (JobStatus == NodeJobStatus.Blocked) { bool hasChanges = false; foreach (var w in Waitings) { hasChanges = hasChanges || w.OnJobStatusChanged(record); } if (Waitings.All(w => w.IsComplete) && IOs.All(i => i.IsComplete)) { JobStatus = NodeJobStatus.Ready; ReadyTime = DateTime.Now; } } }
public void Continue() { if (JobStatus == NodeJobStatus.Blocked) { throw new InvalidOperationException("Cannot continue blocked task"); } JobStatus = NodeJobStatus.Running; foreach (var w in Waitings.ToArray()) { w.Unblock(); } Waitings.Clear(); foreach (var i in IOs.ToArray()) { i.Unblock(); } IOs.Clear(); }