Skip to content

Commit

Permalink
Merge pull request #9 from mild-blue/fix-shepherd-not-working-after-e…
Browse files Browse the repository at this point in the history
…rror-old-shepherd

Fix shepherd not working after error during computation - old-shepherd
  • Loading branch information
jakubmonhart authored Jan 31, 2024
2 parents 0847c98 + 4877acf commit 319698e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions shepherd/shepherd/shepherd.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,22 +293,22 @@ async def _listen(self) -> None:
status.finished_at = datetime.utcnow()
await self._job_status_update_queue.enqueue_task(self._storage.set_job_status(job_id, status.copy()))
logging.info('Job `%s` from sheep `%s` done', job_id, sheep_id)

# notify about the finished job
async with self.job_done_condition:
self.job_done_condition.notify_all()

elif isinstance(message, ErrorMessage):
error = ErrorModel({
"message": message.message,
"exception_type": message.exception_type,
"exception_traceback": message.exception_traceback
})
await self._report_job_failed(job_id, error, sheep)
self._job_status.pop(job_id)
logging.info('Job `%s` from sheep `%s` failed (%s)', job_id, sheep_id, message.short_error)
logging.info('Job `%s` from sheep `%s` failed (%s)', job_id, sheep_id, message.message)

# notify about the finished job
sheep.in_progress.remove(job_id)

async with self.job_done_condition:
self.job_done_condition.notify_all()


def get_status(self) -> Generator[Tuple[str, SheepModel], None, None]:
"""
Get status information for all sheep
Expand Down

0 comments on commit 319698e

Please sign in to comment.