diff --git a/python/res/job_queue/workflow.py b/python/res/job_queue/workflow.py index c0a6648d63..b69458b799 100644 --- a/python/res/job_queue/workflow.py +++ b/python/res/job_queue/workflow.py @@ -1,4 +1,5 @@ import time +import sys from res.config import ConfigError from cwrap import BaseCClass from res import ResPrototype @@ -66,7 +67,7 @@ def run(self, ert, verbose=False, context=None): if not success: msg = "** Warning: The workflow file {} is not valid - "\ "make sure the workflow jobs are defined accordingly\n" - sys.stderr.write(msg.format(workflow.src_file)) + sys.stderr.write(msg.format(self.src_file)) self.__running = False return False diff --git a/python/tests/res/job_queue/test_workflow.py b/python/tests/res/job_queue/test_workflow.py index 1d8b058842..36ea271e98 100644 --- a/python/tests/res/job_queue/test_workflow.py +++ b/python/tests/res/job_queue/test_workflow.py @@ -55,3 +55,17 @@ def test_workflow_run(self): with open("dump2", "r") as f: self.assertEqual(f.read(), "dump_text_2") + + + def test_failing_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("undefined", joblist) + context = SubstitutionList() + + self.assertFalse(workflow.run(None, verbose=True, context=context))