Skip to content

Commit

Permalink
Added default value for server config prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
alfiopuglisi committed Jul 23, 2024
1 parent 285e9cc commit 25e3765
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions plico/utils/process_monitor_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ def RUNNING_MESSAGE(server_name):

class ProcessMonitorRunner(BaseRunner):

def __init__(self, server_process_name, runner_config_section='processMonitor'):
def __init__(self, server_process_name,
runner_config_section='processMonitor',
default_server_config_prefix=None):
BaseRunner.__init__(self)
self._my_config_section = runner_config_section
self._server_process_name = server_process_name
self._default_server_config_prefix = default_server_config_prefix

Check warning on line 33 in plico/utils/process_monitor_runner.py

View check run for this annotation

Codecov / codecov/patch

plico/utils/process_monitor_runner.py#L30-L33

Added lines #L30 - L33 were not covered by tests

INITIALIZED_LATER = None
self._prefix = INITIALIZED_LATER
Expand Down Expand Up @@ -118,8 +121,12 @@ def _setup(self):
self._prefix = self._configuration.getValue(self._my_config_section,

Check warning on line 121 in plico/utils/process_monitor_runner.py

View check run for this annotation

Codecov / codecov/patch

plico/utils/process_monitor_runner.py#L120-L121

Added lines #L120 - L121 were not covered by tests
'server_config_prefix')
except KeyError:
self._logger.error('Key "server_config_prefix" missing from process monitor configuration')
raise
if not self._default_server_config_prefix:
self._logger.error('Key "server_config_prefix" missing from process monitor configuration'

Check warning on line 125 in plico/utils/process_monitor_runner.py

View check run for this annotation

Codecov / codecov/patch

plico/utils/process_monitor_runner.py#L123-L125

Added lines #L123 - L125 were not covered by tests
' and no default given')
raise

Check warning on line 127 in plico/utils/process_monitor_runner.py

View check run for this annotation

Codecov / codecov/patch

plico/utils/process_monitor_runner.py#L127

Added line #L127 was not covered by tests
else:
self._prefix = self._default_server_config_prefix

Check warning on line 129 in plico/utils/process_monitor_runner.py

View check run for this annotation

Codecov / codecov/patch

plico/utils/process_monitor_runner.py#L129

Added line #L129 was not covered by tests

# Get the spawn delay, default = 1 second
try:
Expand Down

0 comments on commit 25e3765

Please sign in to comment.