-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- adds slurm runner, with an initial implementation for docker - refactors runner_host.DockerRunner so children classes can reuse most of the code - introduces a PopperConfig class that deals with configuration of Popper - adds tests for slurm runner on docker
- Loading branch information
1 parent
146b888
commit b24c8cd
Showing
20 changed files
with
857 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import os | ||
|
||
from hashlib import shake_256 | ||
|
||
from popper.cli import log as log | ||
|
||
import popper.scm as scm | ||
import popper.utils as pu | ||
|
||
|
||
class PopperConfig(object): | ||
def __init__(self, **kwargs): | ||
self.repo = scm.new_repo() | ||
self.workspace_dir = os.path.realpath(kwargs['workspace_dir']) | ||
self.wid = shake_256(self.workspace_dir.encode('utf-8')).hexdigest(4) | ||
self.workspace_sha = scm.get_sha(self.repo) | ||
self.config_file = kwargs['config_file'] | ||
self.dry_run = kwargs['dry_run'] | ||
self.skip_clone = kwargs['skip_clone'] | ||
self.skip_pull = kwargs['skip_pull'] | ||
self.quiet = kwargs['quiet'] | ||
self.reuse = kwargs['reuse'] | ||
self.engine_name = kwargs.get('engine', None) | ||
self.resman_name = kwargs.get('resource_manager', None) | ||
self.engine_options = kwargs['engine_options'] | ||
self.resman_options = kwargs['resman_options'] | ||
self.config_from_file = pu.load_config_file(self.config_file) | ||
|
||
def parse(self): | ||
self.validate() | ||
self.normalize() | ||
|
||
def validate(self): | ||
if self.config_from_file.get('engine', None): | ||
if not self.config_from_file['engine'].get('name', None): | ||
log.fail( | ||
'engine config must have the name property.') | ||
|
||
if self.config_from_file.get('resource_manager', None): | ||
if not self.config_from_file['resource_manager'].get('name', None): | ||
log.fail( | ||
'resource_manager config must have the name property.') | ||
|
||
def normalize(self): | ||
if not self.engine_name: | ||
if self.config_from_file.get('engine', None): | ||
self.engine_name = self.config_from_file['engine']['name'] | ||
self.engine_options = self.config_from_file['engine'].get( | ||
'options', dict()) | ||
else: | ||
self.engine_name = 'docker' | ||
|
||
if not self.resman_name: | ||
if self.config_from_file.get('resource_manager', None): | ||
self.resman_name = self.config_from_file['resource_manager']['name'] | ||
self.resman_options = self.config_from_file['resource_manager'].get( | ||
'options', dict()) | ||
else: | ||
self.resman_name = 'host' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.