diff --git a/pysqa/queueadapter.py b/pysqa/queueadapter.py index e17f9fc5..0792d4ac 100644 --- a/pysqa/queueadapter.py +++ b/pysqa/queueadapter.py @@ -2,10 +2,9 @@ # Copyright (c) Jan Janssen import os -import yaml -from pysqa.basic import BasisQueueAdapter -from pysqa.modular import ModularQueueAdapter -from pysqa.remote import RemoteQueueAdapter +from pysqa.utils.basic import BasisQueueAdapter, read_config +from pysqa.utils.modular import ModularQueueAdapter +from pysqa.utils.remote import RemoteQueueAdapter __author__ = "Jan Janssen" __copyright__ = "Copyright 2019, Jan Janssen" @@ -44,7 +43,7 @@ class QueueAdapter(object): Queues available for auto completion QueueAdapter().queues. returns the queue name. """ def __init__(self, directory="~/.queues"): - config = self._read_config(file_name=os.path.join(directory, "queue.yaml")) + config = read_config(file_name=os.path.join(directory, "queue.yaml")) if config["queue_type"] in ["SGE", "TORQUE", "SLURM", "LSF", "MOAB"]: self._adapter = BasisQueueAdapter(config=config, directory=directory) elif config["queue_type"] in ["GENT"]: @@ -252,16 +251,3 @@ def check_queue_parameters( memory_max=memory_max, active_queue=active_queue, ) - - @staticmethod - 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) diff --git a/pysqa/utils/__init__.py b/pysqa/utils/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/pysqa/basic.py b/pysqa/utils/basic.py similarity index 98% rename from pysqa/basic.py rename to pysqa/utils/basic.py index dc896135..b352a7fb 100644 --- a/pysqa/basic.py +++ b/pysqa/utils/basic.py @@ -8,7 +8,8 @@ import subprocess import re import pandas -from pysqa.queues import Queues +import yaml +from pysqa.utils.queues import Queues class BasisQueueAdapter(object): @@ -547,3 +548,16 @@ def _memory_spec_string_to_value( ) else: return value + + +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) diff --git a/pysqa/modular.py b/pysqa/utils/modular.py similarity index 98% rename from pysqa/modular.py rename to pysqa/utils/modular.py index 5a67f2f0..7904e5d9 100644 --- a/pysqa/modular.py +++ b/pysqa/utils/modular.py @@ -2,7 +2,7 @@ # Copyright (c) Jan Janssen import pandas -from pysqa.basic import BasisQueueAdapter +from pysqa.utils.basic import BasisQueueAdapter class ModularQueueAdapter(BasisQueueAdapter): diff --git a/pysqa/queues.py b/pysqa/utils/queues.py similarity index 100% rename from pysqa/queues.py rename to pysqa/utils/queues.py diff --git a/pysqa/remote.py b/pysqa/utils/remote.py similarity index 99% rename from pysqa/remote.py rename to pysqa/utils/remote.py index aeeb8837..d46a77b9 100644 --- a/pysqa/remote.py +++ b/pysqa/utils/remote.py @@ -7,7 +7,7 @@ import paramiko import warnings from tqdm import tqdm -from pysqa.basic import BasisQueueAdapter +from pysqa.utils.basic import BasisQueueAdapter class RemoteQueueAdapter(BasisQueueAdapter): diff --git a/tests/test_queueadapter.py b/tests/test_queueadapter.py index e21bdb45..d85b52cb 100644 --- a/tests/test_queueadapter.py +++ b/tests/test_queueadapter.py @@ -6,7 +6,7 @@ import unittest import getpass from pysqa import QueueAdapter -from pysqa.basic import BasisQueueAdapter +from pysqa.utils.basic import BasisQueueAdapter __author__ = "Jan Janssen" __copyright__ = "Copyright 2019, Jan Janssen"