Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Commit

Permalink
Do not fetch LSF properties when not using LSF
Browse files Browse the repository at this point in the history
  • Loading branch information
Pål Grønås Drange authored and Pål Grønås Drange committed Apr 11, 2018
1 parent b83b8f0 commit 1d12dce
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions python/res/enkf/config_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class ConfigKeys:
LSF_RESOURCE_KEY = _lsf_resource_key()
LSF_QUEUE_NAME_KEY = _lsf_queue_key()
LSF_SERVER_KEY = _lsf_server_key()
LSF_KEY = 'LSF'
UPDATE_LOG_PATH = _update_log_path()
STORE_SEED = _store_seed()
LOAD_SEED = _load_seed()
Expand Down
23 changes: 19 additions & 4 deletions python/res/enkf/queue_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,33 @@ def queue_system(self):
"""The queue system in use, e.g. LSF or LOCAL"""
return self._queue_system()

@property
def job_script(self):
return self._get_job_script()

@property
def driver(self):
return self._queue_driver(self.queue_system).setParent(self)

def _assert_lsf(self, key='driver'):
sys = self.queue_system
if sys != ConfigKeys.LSF_KEY:
fmt = 'Cannot fetch LSF {key}, current queue is {system}'
raise ValueError(fmt.format(key=key,
system=self.queue_system))

@property
def job_script(self):
return self._get_job_script()
def _lsf_driver(self):
self._assert_lsf()
driver = self._queue_driver(ConfigKeys.LSF_KEY)
return driver.setParent(self)

@property
def lsf_resource(self):
return self.driver.get_option(ConfigKeys.LSF_RESOURCE_KEY)
self._assert_lsf(key=ConfigKeys.LSF_RESOURCE_KEY)
return self._lsf_driver.get_option(ConfigKeys.LSF_RESOURCE_KEY)

@property
def lsf_server(self):
return self.driver.get_option(ConfigKeys.LSF_SERVER_KEY)
self._assert_lsf(key=ConfigKeys.LSF_SERVER_KEY)
return self._lsf_driver.get_option(ConfigKeys.LSF_SERVER_KEY)

0 comments on commit 1d12dce

Please sign in to comment.