Skip to content

Commit

Permalink
Only change python handling of max_running
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-el committed Sep 6, 2023
1 parent d4ac0b9 commit 6abbae1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
19 changes: 12 additions & 7 deletions src/ert/job_queue/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,30 @@ def __init__(
if options:
for key, value in options:
self.set_option(key, value)
self.set_max_running(max_running)
self._max_running = max_running

def set_option(self, option: str, value: str) -> bool:
"""Set a driver option to a specific value, return False if unknown option."""
return self._set_option(option, str(value))
if option == "MAX_RUNNING":
self._max_running = int(value)
return True
else:
return self._set_option(option, str(value))

def unset_option(self, option: str) -> None:
return self._unset_option(option)

def get_option(self, option_key: str) -> str:
return self._get_option(option_key)
if option_key == "MAX_RUNNING":
return str(self.get_max_running())
else:
return self._get_option(option_key)

def get_max_running(self) -> int:
return self._get_max_running()
return self._max_running

def set_max_running(self, max_running: int) -> None:
self._set_max_running(max_running)
self._max_running = max_running

@classmethod
def create_driver(cls, queue_config: QueueConfig) -> "Driver":
Expand All @@ -58,8 +65,6 @@ def create_driver(cls, queue_config: QueueConfig) -> "Driver":
driver.unset_option(setting)
return driver

max_running = property(get_max_running, set_max_running)

@property
def name(self) -> str:
return self._get_name()
Expand Down
4 changes: 3 additions & 1 deletion tests/unit_tests/config/test_queue_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ def test_queue_config_default_max_running_is_unlimited(num_real):
f.write(f"NUM_REALIZATIONS {num_real}\nQUEUE_SYSTEM SLURM\n")
# max_running == 0 means unlimited
assert (
Driver.create_driver(ErtConfig.from_file(filename).queue_config).max_running
Driver.create_driver(
ErtConfig.from_file(filename).queue_config
).get_max_running()
== 0
)

Expand Down

0 comments on commit 6abbae1

Please sign in to comment.