From 159c41abd91f8acefe60c110bbcdec28c0ed7eac Mon Sep 17 00:00:00 2001 From: Markus Fanebust Dregi Date: Fri, 6 Dec 2019 13:18:15 +0100 Subject: [PATCH] Use JOB_QUEUE_SUCCESS to label success While working on the queue system the ultimate sign of success moved from being JOB_QUEUE_SUCCESS to JOB_QUEUE_DONE. This is reverted with this commit. --- python/res/enkf/enkf_state.py | 4 ++-- python/res/job_queue/job_queue_manager.py | 7 ++----- python/res/job_queue/job_queue_node.py | 12 +++++++++++- python/tests/res/simulator/test_batch_sim.py | 3 ++- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/python/res/enkf/enkf_state.py b/python/res/enkf/enkf_state.py index 371ed35ad7..44c093aeee 100644 --- a/python/res/enkf/enkf_state.py +++ b/python/res/enkf/enkf_state.py @@ -49,8 +49,8 @@ def initialize( self , fs , param_list = None , init_mode = EnkfInitModeEnum.INI @classmethod def forward_model_exit_callback(cls, args): - cls._forward_model_EXIT(args[0]) + return cls._forward_model_EXIT(args[0]) @classmethod def forward_model_ok_callback(cls, args): - cls._forward_model_OK(args[1], args[0]) + return cls._forward_model_OK(args[1], args[0]) diff --git a/python/res/job_queue/job_queue_manager.py b/python/res/job_queue/job_queue_manager.py index 58c9cac686..9f5816efd3 100644 --- a/python/res/job_queue/job_queue_manager.py +++ b/python/res/job_queue/job_queue_manager.py @@ -79,15 +79,12 @@ def getNumWaiting(self): def getNumPending(self): return self.queue.count_status(JobStatusType.JOB_QUEUE_PENDING) - def getNumSuccess(self): - return self.queue.count_status(JobStatusType.JOB_QUEUE_DONE) - + return self.queue.count_status(JobStatusType.JOB_QUEUE_SUCCESS) def getNumFailed(self): return self.queue.count_status(JobStatusType.JOB_QUEUE_FAILED) - def isRunning(self): return self.queue.is_active() @@ -108,7 +105,7 @@ def didJobFail(self, job_index): return self.queue.job_list[job_index].status == JobStatusType.JOB_QUEUE_FAILED def didJobSucceed(self, job_index): - return self.queue.job_list[job_index].status == JobStatusType.JOB_QUEUE_DONE + return self.queue.job_list[job_index].status == JobStatusType.JOB_QUEUE_SUCCEED def getJobStatus(self, job_index): # See comment about return type in the prototype section at diff --git a/python/res/job_queue/job_queue_node.py b/python/res/job_queue/job_queue_node.py index 800d827a6d..d1c33f1d82 100644 --- a/python/res/job_queue/job_queue_node.py +++ b/python/res/job_queue/job_queue_node.py @@ -75,7 +75,14 @@ def submit(self, driver): self._submit(driver) def run_done_callback(self): - return self.done_callback_function(self.callback_arguments) + callback_status = self.done_callback_function(self.callback_arguments) + + if callback_status: + self._set_status(JobStatusType.JOB_QUEUE_SUCCESS) + else: + self._set_status(JobStatusType.JOB_QUEUE_EXIT) + + return callback_status def run_exit_callback(self): return self.exit_callback_function(self.callback_arguments) @@ -119,6 +126,9 @@ def _job_monitor(self, driver, pool_sema, max_submit): if self.status == JobStatusType.JOB_QUEUE_DONE: with pool_sema: self.run_done_callback() + + if self.status == JobStatusType.JOB_QUEUE_SUCCESS: + pass elif self.status == JobStatusType.JOB_QUEUE_EXIT: if self.submit_attempt < max_submit: self._set_thread_status(ThreadStatus.READY) diff --git a/python/tests/res/simulator/test_batch_sim.py b/python/tests/res/simulator/test_batch_sim.py index edaee4eb1d..42eef8ed68 100644 --- a/python/tests/res/simulator/test_batch_sim.py +++ b/python/tests/res/simulator/test_batch_sim.py @@ -419,6 +419,7 @@ def assertContextStatusOddFailures(self, batch_ctx, final_state_only=False): JobStatusType.JOB_QUEUE_RUNNING, JobStatusType.JOB_QUEUE_UNKNOWN, JobStatusType.JOB_QUEUE_EXIT, + JobStatusType.JOB_QUEUE_DONE, )) for idx in range(len(batch_ctx)): @@ -426,7 +427,7 @@ def assertContextStatusOddFailures(self, batch_ctx, final_state_only=False): if not final_state_only and status in running_status: continue elif idx%2 == 0: - self.assertEqual(JobStatusType.JOB_QUEUE_DONE, status) + self.assertEqual(JobStatusType.JOB_QUEUE_SUCCESS, status) else: self.assertEqual(JobStatusType.JOB_QUEUE_FAILED, status)