WaitForTaskCompletion() public static méthode

Waits for the specified task to complete
public static WaitForTaskCompletion ( BatchController controller, BatchAccountContext context, string jobId, string taskId ) : void
controller BatchController
context BatchAccountContext
jobId string
taskId string
Résultat void
Exemple #1
0
        public void TestGetNodeFileContentByTask()
        {
            BatchController     controller   = BatchController.NewInstance;
            string              jobId        = "nodeFileContentByTask";
            string              taskId       = "testTask";
            string              fileName     = "testFile.txt";
            string              nodeFilePath = string.Format("wd\\{0}", fileName);
            string              fileContents = "test file contents";
            BatchAccountContext context      = null;

            controller.RunPsTestWorkflow(
                _logger,
                () => { return(new string[] { string.Format("Test-GetNodeFileContentByTask '{0}' '{1}' '{2}' '{3}'", jobId, taskId, nodeFilePath, fileContents) }); },
                () =>
            {
                context = new ScenarioTestContext();
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId, string.Format("cmd /c echo {0} > {1}", fileContents, fileName));
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                MethodBase.GetCurrentMethod().ReflectedType?.ToString(),
                MethodBase.GetCurrentMethod().Name);
        }
        public void TestListAllSubtasks()
        {
            BatchController     controller   = BatchController.NewInstance;
            string              jobId        = "listSubtaskJob";
            string              taskId       = "testTask";
            int                 numInstances = 3;
            BatchAccountContext context      = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListAllSubtasks '{0}' '{1}' '{2}'", jobId, taskId, numInstances) }); },
                () =>
            {
                context = new ScenarioTestContext();
                ScenarioTestHelpers.CreateMpiPoolIfNotExists(controller, context);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId, ScenarioTestHelpers.MpiPoolId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId, "cmd /c hostname", numInstances);
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
        public void TestListNodeFilesByTaskByFilter()
        {
            BatchController     controller     = BatchController.NewInstance;
            string              jobId          = "listNodeFileByTaskFilterJob";
            string              taskId         = "testTask";
            string              nodeFilePrefix = "std";
            int                 matches        = 2;
            BatchAccountContext context        = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListNodeFilesByTaskByFilter '{0}' '{1}' '{2}' '{3}' '{4}'", accountName, jobId, taskId, nodeFilePrefix, matches) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId);
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #4
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);
        }
Exemple #5
0
        public void TestListTaskFilesWithMaxCount()
        {
            BatchController     controller   = BatchController.NewInstance;
            string              workItemName = "testTaskFileMaxWI";
            string              jobName      = null;
            string              taskName     = "testTask";
            int                 maxCount     = 1;
            BatchAccountContext context      = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListTaskFilesWithMaxCount '{0}' '{1}' '{2}' '{3}' '{4}'", accountName, workItemName, jobName, taskName, maxCount) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestWorkItem(controller, context, workItemName);
                jobName = ScenarioTestHelpers.WaitForRecentJob(controller, context, workItemName);
                ScenarioTestHelpers.CreateTestTask(controller, context, workItemName, jobName, taskName);
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, workItemName, jobName, taskName);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteWorkItem(controller, context, workItemName);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
        public void TestGetNodeFileContentByTaskPipeline()
        {
            BatchController     controller   = BatchController.NewInstance;
            string              jobId        = "nodeFileContentByTaskPipe";
            string              taskId       = "testTask";
            string              fileName     = "testFile.txt";
            string              nodeFileName = string.Format("wd\\{0}", fileName);
            string              fileContents = "test file contents";
            BatchAccountContext context      = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-GetNodeFileContentByTaskPipeline '{0}' '{1}' '{2}' '{3}' '{4}'", accountName, jobId, taskId, nodeFileName, fileContents) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId, string.Format("cmd /c echo {0} > {1}", fileContents, fileName));
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
        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);
        }
Exemple #8
0
        public void TestListTaskFilesRecursive()
        {
            BatchController     controller   = BatchController.NewInstance;
            string              workItemName = "testListTFRecursiveWI";
            string              jobName      = null;
            string              taskName     = "testTask";
            string              newFile      = "testFile.txt";
            BatchAccountContext context      = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListTaskFilesRecursive '{0}' '{1}' '{2}' '{3}' '{4}'", accountName, workItemName, jobName, taskName, newFile) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestWorkItem(controller, context, workItemName);
                jobName = ScenarioTestHelpers.WaitForRecentJob(controller, context, workItemName);
                ScenarioTestHelpers.CreateTestTask(controller, context, workItemName, jobName, taskName, string.Format("cmd /c echo \"test file\" > {0}", newFile));
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, workItemName, jobName, taskName);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteWorkItem(controller, context, workItemName);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
        public void TestDeleteNodeFileByTask()
        {
            BatchController     controller = BatchController.NewInstance;
            BatchAccountContext context    = null;
            string jobId    = "deletetaskFile";
            string taskId   = "task1";
            string fileName = "testFile.txt";
            string filePath = string.Format("wd\\{0}", fileName);

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-DeleteNodeFileByTask '{0}' '{1}' '{2}'", jobId, taskId, 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);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
        public void TestListNodeFileByTaskPipeline()
        {
            BatchController     controller = BatchController.NewInstance;
            string              jobId      = "nodeFileByTaskPipe";
            string              taskId     = "testTask";
            int                 count      = 4; // ProcessEnv, stdout, stderr, wd
            BatchAccountContext context    = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListNodeFileByTaskPipeline '{0}' '{1}' '{2}' '{3}'", accountName, jobId, taskId, count) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId);
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #11
0
        public void TestListNodeFilesByTaskWithMaxCount()
        {
            BatchController     controller = BatchController.NewInstance;
            string              jobId      = "nodeFileByTaskMaxJob";
            string              taskId     = "testTask";
            int                 maxCount   = 1;
            BatchAccountContext context    = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListNodeFilesByTaskWithMaxCount '{0}' '{1}' '{2}'", jobId, taskId, maxCount) }); },
                () =>
            {
                context = new ScenarioTestContext();
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId);
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #12
0
        public void TestGetNodeFileByTaskByName()
        {
            BatchController     controller   = BatchController.NewInstance;
            string              jobId        = "testGetNodeFileByTaskJob";
            string              taskId       = "testTask";
            string              nodeFileName = "stdout.txt";
            BatchAccountContext context      = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-GetNodeFileByTaskByName '{0}' '{1}' '{2}'", jobId, taskId, nodeFileName) }); },
                () =>
            {
                context = new ScenarioTestContext();
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId);
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Exemple #13
0
        public void TestListNodeFilesByTaskRecursive()
        {
            BatchController     controller = BatchController.NewInstance;
            string              jobId      = "listNodeFileByTaskRecursiveJob";
            string              taskId     = "testTask";
            string              newFile    = "testFile.txt";
            BatchAccountContext context    = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListNodeFilesByTaskRecursive '{0}' '{1}' '{2}'", jobId, taskId, newFile) }); },
                () =>
            {
                context = new ScenarioTestContext();
                ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
                ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId, string.Format("cmd /c echo \"test file\" > {0}", newFile));
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }