Skip to content

Commit

Permalink
Merge pull request #34 from pyiron/new_modules
Browse files Browse the repository at this point in the history
New modular structure
  • Loading branch information
jan-janssen authored Aug 21, 2020
2 parents e19580d + b2dfb33 commit a179277
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
22 changes: 4 additions & 18 deletions pysqa/queueadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -44,7 +43,7 @@ class QueueAdapter(object):
Queues available for auto completion QueueAdapter().queues.<queue name> 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"]:
Expand Down Expand Up @@ -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)
Empty file added pysqa/utils/__init__.py
Empty file.
16 changes: 15 additions & 1 deletion pysqa/basic.py → pysqa/utils/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion pysqa/modular.py → pysqa/utils/modular.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) Jan Janssen

import pandas
from pysqa.basic import BasisQueueAdapter
from pysqa.utils.basic import BasisQueueAdapter


class ModularQueueAdapter(BasisQueueAdapter):
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion pysqa/remote.py → pysqa/utils/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_queueadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit a179277

Please sign in to comment.