Skip to content

Commit

Permalink
Adding configs to disable the job
Browse files Browse the repository at this point in the history
  • Loading branch information
dasunpubudumal committed Sep 26, 2024
1 parent 00cd952 commit 6729ee8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions janitor/config/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@

RABBITMQ_SEQUENCING_EXCHANGE = "sanger.psd.sample_status.uat"
RABBITMQ_SEQUENCING_MESSAGE_SCHEMA = "janitor/tasks/sequencing_publisher/message_schemas/sample_sequence_status.avsc"

JOB_ENABLED = True
8 changes: 7 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from dotenv import load_dotenv

from janitor.helpers.config_helpers import get_config
from janitor.helpers.log_helpers import custom_log
from janitor.tasks.labware_location.main import sync_changes_from_labwhere
from janitor.tasks.sequencing_publisher.main import get_and_publish_sequencing_run_status_changes

Expand All @@ -12,6 +13,8 @@
config = get_config()
logging.config.dictConfig(config.LOGGING)

logger = logging.getLogger(__name__)

if __name__ == "__main__":
sched = BlockingScheduler()

Expand All @@ -27,6 +30,9 @@
)

try:
sched.start()
if config.JOB_ENABLED:
sched.start()
else:
custom_log(logger, "info", "TASK_DISABLED", "Job not running as it is disabled")
except (KeyboardInterrupt, SystemExit):
pass

0 comments on commit 6729ee8

Please sign in to comment.