コード例 #1
0
        public async Task EnsureTasksHaveOwnership()
        {
            var healthChecks = AllPeers().Select(async x =>
            {
                var status = await x.CheckStatusOfOwnedTasks().ConfigureAwait(false);
                return(new { Peer = x, Response = status });
            }).ToArray();

            var checks = await Task.WhenAll(healthChecks).ConfigureAwait(false);


            var planner = new TaskHealthAssignmentPlanner(_permanentTasks);

            foreach (var check in checks)
            {
                planner.Add(check.Peer, check.Response);
            }


            var corrections = planner.ToCorrectionTasks(this);

            await Task.WhenAll(corrections).ConfigureAwait(false);

            _logger.Info(() => "Finished running task health monitoring on node " + NodeId);
        }
コード例 #2
0
        public Task EnsureTasksHaveOwnership()
        {
            var healthChecks = allPeers().Select(x => x.CheckStatusOfOwnedTasks().ContinueWith(_ => {
                return(new { Peer = x, Response = _.Result });
            }));

            return(Task.WhenAll(healthChecks).ContinueWith(checks => {
                var planner = new TaskHealthAssignmentPlanner(_permanentTasks);
                checks.Result.Each(_ => planner.Add(_.Peer, _.Response));

                var corrections = planner.ToCorrectionTasks(this);

                return Task.WhenAll(corrections).ContinueWith(_ => {
                    _logger.Info(() => "Finished running task health monitoring on node " + NodeId);
                }, TaskContinuationOptions.AttachedToParent);
            }, TaskContinuationOptions.AttachedToParent));
        }
コード例 #3
0
        public Task EnsureTasksHaveOwnership()
        {
            var healthChecks = allPeers().Select(x => x.CheckStatusOfOwnedTasks().ContinueWith(_ => {
                return new {Peer = x, Response = _.Result};
            }));

            return Task.WhenAll(healthChecks).ContinueWith(checks => {
                var planner = new TaskHealthAssignmentPlanner(_permanentTasks);
                checks.Result.Each(_ => planner.Add(_.Peer, _.Response));

                var corrections = planner.ToCorrectionTasks(this);

                return Task.WhenAll(corrections).ContinueWith(_ => {

                    _logger.Info(() => "Finished running task health monitoring on node " + NodeId);

                }, TaskContinuationOptions.AttachedToParent);
            }, TaskContinuationOptions.AttachedToParent);
        }
コード例 #4
0
        public async Task EnsureTasksHaveOwnership()
        {
            var healthChecks = AllPeers().Select(async x =>
            {
                var status = await x.CheckStatusOfOwnedTasks().ConfigureAwait(false);
                return new { Peer = x, Response = status };
            }).ToArray();

            var checks = await Task.WhenAll(healthChecks).ConfigureAwait(false);


            var planner = new TaskHealthAssignmentPlanner(_permanentTasks);
            foreach (var check in checks)
            {
                planner.Add(check.Peer, check.Response);
            }


            var corrections = planner.ToCorrectionTasks(this);

            await Task.WhenAll(corrections).ConfigureAwait(false);

            _logger.Info(() => "Finished running task health monitoring on node " + NodeId);
        }