Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Commit

Permalink
Use JOB_QUEUE_SUCCESS to label success
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Markus Fanebust Dregi authored and markusdregi committed Dec 6, 2019
1 parent c52ebc1 commit 159c41a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions python/res/enkf/enkf_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
7 changes: 2 additions & 5 deletions python/res/job_queue/job_queue_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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
Expand Down
12 changes: 11 additions & 1 deletion python/res/job_queue/job_queue_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion python/tests/res/simulator/test_batch_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,14 +419,15 @@ 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)):
status = batch_ctx.job_status(idx)
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)

Expand Down

0 comments on commit 159c41a

Please sign in to comment.