-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from pyiron/multi_cluster
Support for multiple clusters
- Loading branch information
Showing
3 changed files
with
80 additions
and
25 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,35 @@ | ||
import yaml | ||
from pysqa.utils.basic import BasisQueueAdapter | ||
from pysqa.utils.remote import RemoteQueueAdapter | ||
from pysqa.utils.modular import ModularQueueAdapter | ||
|
||
|
||
def read_config(file_name="queue.yaml"): | ||
""" | ||
Args: | ||
file_name (str): | ||
Returns: | ||
dict: | ||
""" | ||
with open(file_name, "r") as f: | ||
return yaml.load(f, Loader=yaml.FullLoader) | ||
|
||
|
||
def set_queue_adapter(config, directory): | ||
""" | ||
Initialize the queue adapter | ||
Args: | ||
config (dict): configuration for one cluster | ||
directory (str): directory which contains the queue configurations | ||
""" | ||
if config["queue_type"] in ["SGE", "TORQUE", "SLURM", "LSF", "MOAB"]: | ||
return BasisQueueAdapter(config=config, directory=directory) | ||
elif config["queue_type"] in ["GENT"]: | ||
return ModularQueueAdapter(config=config, directory=directory) | ||
elif config["queue_type"] in ["REMOTE"]: | ||
return RemoteQueueAdapter(config=config, directory=directory) | ||
else: | ||
raise ValueError |