GetTaskComputeNodeId() public static method

Gets the id of the compute node that the specified task completed on. Returns null if the task isn't complete.
public static GetTaskComputeNodeId ( BatchController controller, BatchAccountContext context, string jobId, string taskId ) : string
controller BatchController
context BatchAccountContext
jobId string
taskId string
return string
示例#1
0
        public void TestDeleteNodeFileByComputeNode()
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string jobId         = "deleteNodeFile";
            string taskId        = "task1";
            string computeNodeId = null;
            string fileName      = "testFile.txt";
            string filePath      = string.Format("workitems\\{0}\\job-1\\{1}\\wd\\{2}", jobId, taskId, fileName);

            controller.RunPsTestWorkflow(
                _logger,
                () => { return(new string[] { string.Format("Test-DeleteNodeFileByComputeNode '{0}' '{1}' '{2}'", poolId, computeNodeId, filePath) }); },
                () =>
            {
                context = new ScenarioTestContext();
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId, string.Format("cmd /c echo \"test\" > {0}", fileName));
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
                computeNodeId = ScenarioTestHelpers.GetTaskComputeNodeId(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                MethodBase.GetCurrentMethod().ReflectedType?.ToString(),
                MethodBase.GetCurrentMethod().Name);
        }
        private void TestDeleteNodeFileByComputeNode(bool usePipeline, string testMethodName)
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string jobId         = string.Format("deleteNodeByFileComputeNodeBy{0}", usePipeline ? "Pipeline" : "Name");
            string taskId        = "task1";
            string computeNodeId = null;
            string fileName      = "testFile.txt";
            string filePath      = string.Format("workitems\\{0}\\job-1\\{1}\\wd\\{2}", jobId, taskId, fileName);

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-DeleteNodeFileByComputeNode '{0}' '{1}' '{2}' '{3}' '{4}'", accountName, poolId, computeNodeId, filePath, usePipeline ? "1" : "0") }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId, string.Format("cmd /c echo \"test\" > {0}", fileName));
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
                computeNodeId = ScenarioTestHelpers.GetTaskComputeNodeId(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                testMethodName);
        }