From 98cc0d86badbdb8c22af6cdbf8c994d2bf094564 Mon Sep 17 00:00:00 2001 From: Liron Ilouz <43831550+ilouzl@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:33:52 +0300 Subject: [PATCH] Add option to set daemon polling interval (#197) * add option to set worker polling interval * polling interval minimum value --------- Co-authored-by: Liron --- clearml_agent/commands/worker.py | 3 +-- clearml_agent/interface/worker.py | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/clearml_agent/commands/worker.py b/clearml_agent/commands/worker.py index 40e3c63..c25d0e4 100644 --- a/clearml_agent/commands/worker.py +++ b/clearml_agent/commands/worker.py @@ -640,8 +640,6 @@ class Worker(ServiceCommandSection): partial(PackageCollectorRequirement, collect_package=['clearml']), ) - # poll queues every _polling_interval seconds - _polling_interval = 5.0 # machine status update intervals, seconds _machine_update_interval = 30.0 @@ -1575,6 +1573,7 @@ class Worker(ServiceCommandSection): self._use_owner_token(kwargs.get('use_owner_token', False)) self._standalone_mode = kwargs.get('standalone_mode', False) + self._polling_interval = max(kwargs.get('polling_interval', 5), 5) self._services_mode = kwargs.get('services_mode', False) # must have docker in services_mode if self._services_mode: diff --git a/clearml_agent/interface/worker.py b/clearml_agent/interface/worker.py index dbc0444..2e2f496 100644 --- a/clearml_agent/interface/worker.py +++ b/clearml_agent/interface/worker.py @@ -44,6 +44,11 @@ WORKER_ARGS = { } DAEMON_ARGS = dict({ + '--polling-interval': { + 'help': 'Polling interval in seconds. Minimum is 5 (default 5)', + 'type': int, + 'default': 5, + }, '--foreground': { 'help': 'Pipe full log to stdout/stderr, should not be used if running in background', 'action': 'store_true',