Beispiel #1
0
    def test_run_external_job(self):

        with TestAreaContext("python/job_queue/workflow_job") as work_area:
            WorkflowCommon.createExternalDumpJob()

            config = alloc_config()
            job = alloc_from_file("DUMP", config, "dump_job")

            self.assertFalse(job.isInternal())

            self.assertIsNone(job.run(None, ["test", "text"]))

            with open("test", "r") as f:
                self.assertEqual(f.read(), "text")
Beispiel #2
0
    def test_run_external_job(self):

        with TestAreaContext("python/job_queue/workflow_job") as work_area:
            WorkflowCommon.createExternalDumpJob()

            config = alloc_config()
            job = alloc_from_file("DUMP", config, "dump_job")

            self.assertFalse(job.isInternal())

            self.assertIsNone(job.run(None, ["test", "text"]))

            with open("test", "r") as f:
                self.assertEqual(f.read(), "text")
    def test_workflow_joblist_with_files(self):
        with TestAreaContext("python/job_queue/workflow_joblist") as work_area:
            WorkflowCommon.createErtScriptsJob()
            WorkflowCommon.createExternalDumpJob()
            WorkflowCommon.createInternalFunctionJob()

            joblist = WorkflowJoblist()

            joblist.addJobFromFile("DUMP_JOB", "dump_job")
            joblist.addJobFromFile("SELECT_CASE_JOB", "select_case_job")
            joblist.addJobFromFile("SUBTRACT_SCRIPT_JOB", "subtract_script_job")

            self.assertTrue("DUMP_JOB" in joblist)
            self.assertTrue("SELECT_CASE_JOB" in joblist)
            self.assertTrue("SUBTRACT_SCRIPT_JOB" in joblist)

            self.assertFalse((joblist["DUMP_JOB"]).isInternal())
            self.assertTrue((joblist["SELECT_CASE_JOB"]).isInternal())
            self.assertTrue((joblist["SUBTRACT_SCRIPT_JOB"]).isInternal())
    def test_workflow_joblist_with_files(self):
        with TestAreaContext("python/job_queue/workflow_joblist") as work_area:
            WorkflowCommon.createErtScriptsJob()
            WorkflowCommon.createExternalDumpJob()
            WorkflowCommon.createInternalFunctionJob()

            joblist = WorkflowJoblist()

            joblist.addJobFromFile("DUMP_JOB", "dump_job")
            joblist.addJobFromFile("SELECT_CASE_JOB", "select_case_job")
            joblist.addJobFromFile("SUBTRACT_SCRIPT_JOB",
                                   "subtract_script_job")

            self.assertTrue("DUMP_JOB" in joblist)
            self.assertTrue("SELECT_CASE_JOB" in joblist)
            self.assertTrue("SUBTRACT_SCRIPT_JOB" in joblist)

            self.assertFalse((joblist["DUMP_JOB"]).isInternal())
            self.assertTrue((joblist["SELECT_CASE_JOB"]).isInternal())
            self.assertTrue((joblist["SUBTRACT_SCRIPT_JOB"]).isInternal())
Beispiel #5
0
    def test_workflow_run(self):
        with TestAreaContext("python/job_queue/workflow") as work_area:
            WorkflowCommon.createExternalDumpJob()

            joblist = WorkflowJoblist()
            self.assertTrue(joblist.addJobFromFile("DUMP", "dump_job"))
            self.assertTrue("DUMP" in joblist)

            workflow = Workflow("dump_workflow", joblist)

            self.assertTrue(len(workflow), 2)

            context = SubstitutionList()
            context.addItem("<PARAM>", "text")

            self.assertTrue(workflow.run(None, verbose=True, context=context))

            with open("dump1", "r") as f:
                self.assertEqual(f.read(), "dump_text_1")

            with open("dump2", "r") as f:
                self.assertEqual(f.read(), "dump_text_2")
Beispiel #6
0
    def test_workflow_run(self):
        with TestAreaContext("python/job_queue/workflow") as work_area:
            WorkflowCommon.createExternalDumpJob()

            joblist = WorkflowJoblist()
            self.assertTrue(joblist.addJobFromFile("DUMP", "dump_job"))
            self.assertTrue("DUMP" in joblist)

            workflow = Workflow("dump_workflow", joblist)

            self.assertTrue(len(workflow), 2)

            context = SubstitutionList()
            context.addItem("<PARAM>", "text")

            self.assertTrue(workflow.run(None, verbose=True, context=context))

            with open("dump1", "r") as f:
                self.assertEqual(f.read(), "dump_text_1")

            with open("dump2", "r") as f:
                self.assertEqual(f.read(), "dump_text_2")
Beispiel #7
0
    def test_workflow(self):
        with TestAreaContext("python/job_queue/workflow") as work_area:
            WorkflowCommon.createExternalDumpJob()

            joblist = WorkflowJoblist()
            self.assertTrue(joblist.addJobFromFile("DUMP", "dump_job"))

            with self.assertRaises(UserWarning):
                joblist.addJobFromFile("KNOCK", "knock_job")

            self.assertTrue("DUMP" in joblist)

            workflow = Workflow("dump_workflow", joblist)

            self.assertEqual(len(workflow), 2)

            job, args = workflow[0]
            self.assertEqual(job, joblist["DUMP"])
            self.assertEqual(args[0], "dump1")
            self.assertEqual(args[1], "dump_text_1")

            job, args = workflow[1]
            self.assertEqual(job, joblist["DUMP"])
Beispiel #8
0
    def test_workflow(self):
        with TestAreaContext("python/job_queue/workflow") as work_area:
            WorkflowCommon.createExternalDumpJob()

            joblist = WorkflowJoblist()
            self.assertTrue(joblist.addJobFromFile("DUMP", "dump_job"))

            with self.assertRaises(UserWarning):
                joblist.addJobFromFile("KNOCK", "knock_job")

            self.assertTrue("DUMP" in joblist)


            workflow = Workflow("dump_workflow", joblist)

            self.assertEqual(len(workflow), 2)

            job, args = workflow[0]
            self.assertEqual(job, joblist["DUMP"])
            self.assertEqual(args[0], "dump1")
            self.assertEqual(args[1], "dump_text_1")

            job, args = workflow[1]
            self.assertEqual(job, joblist["DUMP"])