Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pysqa/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import sys
from pysqa.cmd import command_line


if __name__ == "__main__":
command_line(sys.argv[1:])
Empty file added pysqa/ext/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
23 changes: 22 additions & 1 deletion pysqa/queueadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
# Copyright (c) Jan Janssen

import os
from pysqa.utils.functs import read_config, set_queue_adapter
from pysqa.utils.basic import BasisQueueAdapter
from pysqa.ext.modular import ModularQueueAdapter
from pysqa.ext.remote import RemoteQueueAdapter
from pysqa.utils.config import read_config

__author__ = "Jan Janssen"
__copyright__ = "Copyright 2019, Jan Janssen"
Expand Down Expand Up @@ -288,3 +291,21 @@ def check_queue_parameters(
memory_max=memory_max,
active_queue=active_queue,
)


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
14 changes: 14 additions & 0 deletions pysqa/utils/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import yaml


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)
35 changes: 0 additions & 35 deletions pysqa/utils/functs.py

This file was deleted.

8 changes: 5 additions & 3 deletions pysqa/wrapper/torque.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.

from pysqa.wrapper.generic import SchedulerCommands
import re
import pandas as pd
from pysqa.wrapper.generic import SchedulerCommands

__author__ = "Jan Janssen"
__copyright__ = (
Expand Down Expand Up @@ -33,7 +33,8 @@ def get_queue_status_command(self):

@staticmethod
def get_job_id_from_output(queue_submit_output):
# strip last line from output, leading and trailing whitespaces, and separates the queue id from the stuff after "."
# strip last line from output, leading and trailing whitespaces,
# and separates the queue id from the stuff after "."
# Adjust if your system doesn't have output like below!
# e.g. qsub run_queue.sh -> "12347673.gadi-pbs", the below returns 12347673
# It must return an integer for it to not raise an exception later.
Expand All @@ -44,7 +45,8 @@ def get_job_id_from_output(queue_submit_output):
@staticmethod
def convert_queue_status(queue_status_output):
# # Run the qstat -f command and capture its output
# output = subprocess.check_output(["qstat", "-f"]) -> output is the queue_status_output that goes into this function
# output = subprocess.check_output(["qstat", "-f"]) -> output is the
# queue_status_output that goes into this function

# Split the output into lines
lines = queue_status_output.split("\n") # .decode().split("\n")
Expand Down
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@
'pyyaml==6.0',
'tqdm==4.65.0'],
cmdclass=versioneer.get_cmdclass(),
entry_points={
"console_scripts": [
'pysqa=pysqa:main'
]
}
)
29 changes: 0 additions & 29 deletions tests/LICENSE

This file was deleted.