コード例 #1
0
ファイル: AgentDomainAgent.cs プロジェクト: lulzzz/Photon
        public void RunDeployTask(IAgentDeployContext context, RemoteTaskCompletionSource completeEvent)
        {
            if (deployTaskRegistry.TryGetDescription(context.TaskName, out var taskDesc))
            {
                if (taskDesc.Roles?.Any() ?? false)
                {
                    var isInRole = context.Agent?.Roles?.ContainsAny(taskDesc.Roles, StringComparer.OrdinalIgnoreCase) ?? false;

                    if (!isInRole)
                    {
                        // Task is not in agent roles
                        completeEvent.SetResult();
                        return;
                    }
                }
            }

            using (var block = context.Output.WriteBlock()) {
                block.Write("Running deployment task ", ConsoleColor.DarkCyan);
                block.Write(context.TaskName, ConsoleColor.Cyan);
                block.Write(" on agent ", ConsoleColor.DarkCyan);
                block.Write(context.Agent?.Name, ConsoleColor.Cyan);
                block.WriteLine("...", ConsoleColor.DarkCyan);
            }

            deployTaskRegistry.ExecuteTask(context, CancellationToken.None)
            .ContinueWith(completeEvent.FromTask);
        }
コード例 #2
0
ファイル: AgentDomainAgent.cs プロジェクト: brhoten/Photon
 public void RunDeployTask(IAgentDeployContext context, RemoteTaskCompletionSource <object> completeEvent)
 {
     Task.Run(async() => {
         await deployTaskRegistry.ExecuteTask(context, CancellationToken.None);
         return((object)null);
     }).ContinueWith(completeEvent.FromTask);
 }
コード例 #3
0
        public void RunDeployTask(IAgentDeployContext context, RemoteTaskCompletionSource completeEvent)
        {
            using (var block = context.Output.WriteBlock()) {
                block.Write("Running deployment task ", ConsoleColor.DarkCyan);
                block.Write(context.TaskName, ConsoleColor.Cyan);
                block.Write(" on agent ", ConsoleColor.DarkCyan);
                block.Write(context.Agent?.Name, ConsoleColor.Cyan);
                block.WriteLine("...", ConsoleColor.DarkCyan);
            }

            deployTaskRegistry.ExecuteTask(context, CancellationToken.None)
            .ContinueWith(completeEvent.FromTask);
        }