From 3198c662d4756bc7210a2ad116af7db2240dddf8 Mon Sep 17 00:00:00 2001 From: Michael Hall Date: Wed, 15 Jun 2022 15:22:05 +1000 Subject: [PATCH] expose max status checks and wait between tries --- CHANGELOG.md | 4 ++++ README.md | 12 ++++++++++++ cookiecutter.json | 2 ++ {{cookiecutter.profile_name}}/CookieCutter.py | 8 ++++++++ {{cookiecutter.profile_name}}/lsf_status.py | 7 ++++++- 5 files changed, 32 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9899b3c..fb7602d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ This document tracks changes to the `master` branch of the profile. ## [Unreleased] +### Added +- Exposed `max_status_check` and `wait_between_tries` for status checker [[#48][48]] + ### Changed - Cluster cancel is now a script instead of the `bkill` command in order to handle the log file paths that come with the job ID [[#55][55]] @@ -94,6 +97,7 @@ This document tracks changes to the `master` branch of the profile. [36]: https://github.com/Snakemake-Profiles/lsf/issues/36 [39]: https://github.com/Snakemake-Profiles/lsf/issues/39 [45]: https://github.com/Snakemake-Profiles/lsf/issues/45 +[48]: https://github.com/Snakemake-Profiles/lsf/issues/48 [55]: https://github.com/Snakemake-Profiles/lsf/issues/55 [0.1.0]: https://github.com/Snakemake-Profiles/lsf/releases/tag/0.1.0 [0.1.1]: https://github.com/Snakemake-Profiles/lsf/releases/tag/0.1.1 diff --git a/README.md b/README.md index 7f6a26e..54ea7bf 100644 --- a/README.md +++ b/README.md @@ -254,6 +254,18 @@ From the `snakemake --help` menu default is 10, fractions allowed. ``` +#### `max_status_checks` + +**Default**: `1` + +How many times to check the status of a job. + +#### `wait_between_tries` + +**Default**: `0.001` + +How many seconds to wait until checking the status of a job again (if `max_status_checks` is greater than 1). + #### `profile_name` **Default**: `lsf` diff --git a/cookiecutter.json b/cookiecutter.json index 8c38871..14b4b71 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -28,5 +28,7 @@ "default_project": "", "max_status_checks_per_second": 10, "max_jobs_per_second": 10, + "max_status_checks": 1, + "wait_between_tries": 0.001, "profile_name": "lsf" } \ No newline at end of file diff --git a/{{cookiecutter.profile_name}}/CookieCutter.py b/{{cookiecutter.profile_name}}/CookieCutter.py index 58d2729..5acf8f7 100644 --- a/{{cookiecutter.profile_name}}/CookieCutter.py +++ b/{{cookiecutter.profile_name}}/CookieCutter.py @@ -34,3 +34,11 @@ def get_zombi_behaviour() -> str: @staticmethod def get_latency_wait() -> float: return float("{{cookiecutter.latency_wait}}") + + @staticmethod + def get_wait_between_tries() -> float: + return float("{{cookiecutter.wait_between_tries}}") + + @staticmethod + def get_max_status_checks() -> int: + return int("{{cookiecutter.max_status_checks}}") diff --git a/{{cookiecutter.profile_name}}/lsf_status.py b/{{cookiecutter.profile_name}}/lsf_status.py index a0d04e9..b96699a 100755 --- a/{{cookiecutter.profile_name}}/lsf_status.py +++ b/{{cookiecutter.profile_name}}/lsf_status.py @@ -227,6 +227,11 @@ def get_status(self) -> str: ) lsf_status_checker = StatusChecker( - jobid, outlog, kill_unknown=kill_unknown, kill_zombie=kill_zombie + jobid, + outlog, + kill_unknown=kill_unknown, + kill_zombie=kill_zombie, + wait_between_tries=CookieCutter.get_wait_between_tries(), + max_status_checks=CookieCutter.get_max_status_checks(), ) print(lsf_status_checker.get_status())