Add option to set daemon polling interval (#197)

* add option to set worker polling interval

* polling interval minimum value

---------

Co-authored-by: Liron <liron@tapwithus.com>
This commit is contained in:
Liron Ilouz 2024-04-03 14:33:52 +03:00 committed by GitHub
parent 293cbc0ac6
commit 98cc0d86ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -640,8 +640,6 @@ class Worker(ServiceCommandSection):
partial(PackageCollectorRequirement, collect_package=['clearml']), partial(PackageCollectorRequirement, collect_package=['clearml']),
) )
# poll queues every _polling_interval seconds
_polling_interval = 5.0
# machine status update intervals, seconds # machine status update intervals, seconds
_machine_update_interval = 30.0 _machine_update_interval = 30.0
@ -1575,6 +1573,7 @@ class Worker(ServiceCommandSection):
self._use_owner_token(kwargs.get('use_owner_token', False)) self._use_owner_token(kwargs.get('use_owner_token', False))
self._standalone_mode = kwargs.get('standalone_mode', 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) self._services_mode = kwargs.get('services_mode', False)
# must have docker in services_mode # must have docker in services_mode
if self._services_mode: if self._services_mode:

View File

@ -44,6 +44,11 @@ WORKER_ARGS = {
} }
DAEMON_ARGS = dict({ DAEMON_ARGS = dict({
'--polling-interval': {
'help': 'Polling interval in seconds. Minimum is 5 (default 5)',
'type': int,
'default': 5,
},
'--foreground': { '--foreground': {
'help': 'Pipe full log to stdout/stderr, should not be used if running in background', 'help': 'Pipe full log to stdout/stderr, should not be used if running in background',
'action': 'store_true', 'action': 'store_true',