Skip to content

Commit

Permalink
Merge branch '80-clean-up-left-over-job-status-progress-and-result-qu…
Browse files Browse the repository at this point in the history
…eues' into 63-delivery-limit-cancel-a-job-if-it-is-started-more-than-a-configurable-threshold
  • Loading branch information
lfse-slafleur committed Sep 11, 2024
2 parents a5189fd + bd2833c commit 3e5fbcb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
5 changes: 3 additions & 2 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ mypy-extensions==1.0.0
# via
# black
# mypy
omotes-sdk-protocol==0.1.1
omotes-sdk-protocol==0.1.4
# via
# -c requirements.txt
# omotes-sdk-python
omotes-sdk-python==3.0.0
omotes-sdk-python==3.1.0
# via
# -c requirements.txt
# orchestrator (pyproject.toml)
Expand All @@ -124,6 +124,7 @@ pamqp==3.3.0
# via
# -c requirements.txt
# aiormq
# omotes-sdk-python
pathspec==0.11.2
# via black
platformdirs==4.1.0
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies = [
"sqlalchemy ~= 2.0.27",
"psycopg2-binary ~= 2.9.9",
"celery ~= 5.3.6",
"omotes-sdk-python ~= 3.0.0",
"omotes-sdk-python ~= 3.1.0",
"alembic ~= 1.13.1",
]

Expand Down
8 changes: 5 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ markupsafe==2.1.5
# via mako
multidict==6.0.5
# via yarl
omotes-sdk-protocol==0.1.1
omotes-sdk-protocol==0.1.4
# via omotes-sdk-python
omotes-sdk-python==3.0.0
omotes-sdk-python==3.1.0
# via orchestrator (pyproject.toml)
pamqp==3.3.0
# via aiormq
# via
# aiormq
# omotes-sdk-python
prompt-toolkit==3.0.41
# via click-repl
protobuf==4.25.2
Expand Down
11 changes: 7 additions & 4 deletions src/omotes_orchestrator/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ class Orchestrator:
"""Cancel and delete the job when it is timed out."""
_init_barriers: LifeCycleBarrierManager

LOGS_LOCAL_DIR: str = "../logs"
"""The local directory path to keep log files."""

def __init__(
self,
config: OrchestratorConfig,
Expand Down Expand Up @@ -408,8 +411,8 @@ def job_cancellation_handler(self, job_cancellation: JobCancel) -> None:
def dead_lettered_job_result_handler(self, job_result: JobResult) -> None:
"""Handle the received dead lettered job result.
When the log level is set at the DEBUG level, the dead lettered job result will be written
to a local file.
When the log level is set at the DEBUG level or below,
the dead lettered job result will be written to a local file.
:param job_result: Job result message.
"""
Expand All @@ -420,9 +423,9 @@ def dead_lettered_job_result_handler(self, job_result: JobResult) -> None:
)

log_level = logger.getEffectiveLevel()
if log_level == logging.DEBUG:
if log_level <= logging.DEBUG:
try:
log_dir = "../logs"
log_dir = self.LOGS_LOCAL_DIR
if not os.path.exists(log_dir):
os.makedirs(log_dir)

Expand Down

0 comments on commit 3e5fbcb

Please sign in to comment.