WaitForRecentJob() публичный статический Метод

Waits for a recent job on a job schedule and returns its id. If a previous job is specified, this method waits until a new job is created.
public static WaitForRecentJob ( BatchController controller, BatchAccountContext context, string jobScheduleId, string previousJob = null ) : string
controller BatchController
context BatchAccountContext
jobScheduleId string
previousJob string
Результат string
Пример #1
0
        public void TestListJobsUnderSchedule()
        {
            BatchController controller    = BatchController.NewInstance;
            string          jobScheduleId = "testJobSchedule";
            string          jobId         = null;
            string          jobId2        = null;
            string          runOnceJob    = "runOnceId";

            BatchAccountContext context = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListJobsUnderSchedule '{0}' '{1}' '{2}'", jobScheduleId, jobId, 2) }); },
                () =>
            {
                TimeSpan recurrence = TimeSpan.FromMinutes(1);
                context             = new ScenarioTestContext();
                ScenarioTestHelpers.CreateTestJob(controller, context, runOnceJob);
                ScenarioTestHelpers.CreateTestJobSchedule(controller, context, jobScheduleId, recurrence);
                jobId = ScenarioTestHelpers.WaitForRecentJob(controller, context, jobScheduleId);
                ScenarioTestHelpers.TerminateJob(controller, context, jobId);
                jobId2 = ScenarioTestHelpers.WaitForRecentJob(controller, context, jobScheduleId, jobId);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteJob(controller, context, runOnceJob);
                ScenarioTestHelpers.DeleteJob(controller, context, jobId);
                ScenarioTestHelpers.DeleteJob(controller, context, jobId2);
                ScenarioTestHelpers.DeleteJobSchedule(controller, context, jobScheduleId);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Пример #2
0
        public void TestListAllJobs()
        {
            BatchController     controller        = BatchController.NewInstance;
            string              resourceGroupName = "test-list-job";
            string              accountName       = "testlistjob";
            string              location          = "eastus";
            string              workItemName      = "testWorkItem";
            int                 count             = 2;
            BatchAccountContext context           = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListAllJobs '{0}' '{1}' '{2}'", accountName, workItemName, count) }); },
                () =>
            {
                TimeSpan recurrence = TimeSpan.FromMinutes(1);
                context             = ScenarioTestHelpers.CreateTestAccountAndResourceGroup(controller, resourceGroupName, accountName, location);
                ScenarioTestHelpers.CreateTestWorkItem(context, workItemName, recurrence);
                string jobName = ScenarioTestHelpers.WaitForRecentJob(controller, context, workItemName);
                ScenarioTestHelpers.TerminateJob(context, workItemName, jobName);
                ScenarioTestHelpers.WaitForRecentJob(controller, context, workItemName, jobName);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteWorkItem(context, workItemName);
                ScenarioTestHelpers.CleanupTestAccount(controller, resourceGroupName, accountName);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Пример #3
0
        public void TestListTasksByFilter()
        {
            BatchController     controller        = BatchController.NewInstance;
            string              resourceGroupName = "test-list-task-filter";
            string              accountName       = "testlisttaskfilter";
            string              location          = "eastus";
            string              workItemName      = "testWorkItem";
            string              jobName           = null;
            string              taskName1         = "testTask1";
            string              taskName2         = "testTask2";
            string              taskName3         = "thirdTestTask";
            string              taskPrefix        = "testTask";
            int                 matches           = 2;
            BatchAccountContext context           = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListTasksByFilter '{0}' '{1}' '{2}' '{3}' '{4}'", accountName, workItemName, jobName, taskPrefix, matches) }); },
                () =>
            {
                context = ScenarioTestHelpers.CreateTestAccountAndResourceGroup(controller, resourceGroupName, accountName, location);
                ScenarioTestHelpers.CreateTestWorkItem(context, workItemName);
                jobName = ScenarioTestHelpers.WaitForRecentJob(controller, context, workItemName);
                ScenarioTestHelpers.CreateTestTask(context, workItemName, jobName, taskName1);
                ScenarioTestHelpers.CreateTestTask(context, workItemName, jobName, taskName2);
                ScenarioTestHelpers.CreateTestTask(context, workItemName, jobName, taskName3);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteWorkItem(context, workItemName);
                ScenarioTestHelpers.CleanupTestAccount(controller, resourceGroupName, accountName);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Пример #4
0
        public void TestGetTaskByName()
        {
            BatchController     controller        = BatchController.NewInstance;
            string              resourceGroupName = "test-get-task";
            string              accountName       = "testgettaskbyname";
            string              location          = "eastus";
            string              workItemName      = "testName";
            string              jobName           = null;
            string              taskName          = "testTask";
            BatchAccountContext context           = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-GetTaskByName '{0}' '{1}' '{2}' '{3}'", accountName, workItemName, jobName, taskName) }); },
                () =>
            {
                context = ScenarioTestHelpers.CreateTestAccountAndResourceGroup(controller, resourceGroupName, accountName, location);
                ScenarioTestHelpers.CreateTestWorkItem(context, workItemName);
                jobName = ScenarioTestHelpers.WaitForRecentJob(controller, context, workItemName);
                ScenarioTestHelpers.CreateTestTask(context, workItemName, jobName, taskName);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteWorkItem(context, workItemName);
                ScenarioTestHelpers.CleanupTestAccount(controller, resourceGroupName, accountName);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Пример #5
0
        public void TestListTaskFilesByFilter()
        {
            BatchController     controller     = BatchController.NewInstance;
            string              workItemName   = "testListTaskFileFilterWI";
            string              jobName        = null;
            string              taskName       = "testTask";
            string              taskFilePrefix = "std";
            int                 matches        = 2;
            BatchAccountContext context        = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListTaskFilesByFilter '{0}' '{1}' '{2}' '{3}' '{4}' '{5}'", accountName, workItemName, jobName, taskName, taskFilePrefix, matches) }); },
                () =>
            {
                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());
        }
Пример #6
0
        public void TestGetTaskFileContentPipeline()
        {
            BatchController     controller   = BatchController.NewInstance;
            string              workItemName = "testGetTFContentPipeWI";
            string              jobName      = null;
            string              taskName     = "testTask";
            string              fileName     = "testFile.txt";
            string              taskFileName = string.Format("wd\\{0}", fileName);
            string              fileContents = "test file contents";
            BatchAccountContext context      = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-GetTaskFileContentPipeline '{0}' '{1}' '{2}' '{3}' '{4}' '{5}'", accountName, workItemName, jobName, taskName, taskFileName, fileContents) }); },
                () =>
            {
                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 {0} > {1}", fileContents, fileName));
                ScenarioTestHelpers.WaitForTaskCompletion(controller, context, workItemName, jobName, taskName);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteWorkItem(controller, context, workItemName);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }
Пример #7
0
        public void TestListTaskFilePipeline()
        {
            BatchController     controller   = BatchController.NewInstance;
            string              workItemName = "testListTaskPipeWI";
            string              jobName      = null;
            string              taskName     = "testTask";
            int                 count        = 4; // ProcessEnv, stdout, stderr, wd
            BatchAccountContext context      = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-ListTaskFilePipeline '{0}' '{1}' '{2}' '{3}' '{4}'", accountName, workItemName, jobName, taskName, count) }); },
                () =>
            {
                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());
        }
Пример #8
0
        public void TestGetJobByName()
        {
            BatchController     controller   = BatchController.NewInstance;
            string              workItemName = "testName";
            string              jobName      = null;
            BatchAccountContext context      = null;

            controller.RunPsTestWorkflow(
                () => { return(new string[] { string.Format("Test-GetJobByName '{0}' '{1}' '{2}'", accountName, workItemName, jobName) }); },
                () =>
            {
                context = ScenarioTestHelpers.GetBatchAccountContextWithKeys(controller, accountName);
                ScenarioTestHelpers.CreateTestWorkItem(controller, context, workItemName);
                jobName = ScenarioTestHelpers.WaitForRecentJob(controller, context, workItemName);
            },
                () =>
            {
                ScenarioTestHelpers.DeleteWorkItem(controller, context, workItemName);
            },
                TestUtilities.GetCallingClass(),
                TestUtilities.GetCurrentMethodName());
        }