Skip to content

Commit

Permalink
Merge pull request #19 from pyiron/gent
Browse files Browse the repository at this point in the history
Gent minimal changes
  • Loading branch information
jan-janssen authored Aug 28, 2019
2 parents fc3195c + 795c57f commit 7402cbb
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pysqa/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def __init__(self, config, directory="~/.queues"):
elif self._config["queue_type"] == "MOAB":
class_name = "MoabCommands"
module_name = "pysqa.wrapper.moab"
elif self._config["queue_type"] == "GENT":
class_name = "GentCommands"
module_name = "pysqa.wrapper.gent"
else:
raise ValueError()
self._commands = getattr(importlib.import_module(module_name), class_name)()
Expand Down
1 change: 0 additions & 1 deletion pysqa/modular.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class ModularQueueAdapter(BasisQueueAdapter):
def __init__(self, config, directory="~/.queues"):
config["queue_type"] = "SLURM"
super(ModularQueueAdapter, self).__init__(config=config, directory=directory)
self._queue_to_cluster_dict = {
k: v["cluster"] for k, v in self._config["queues"].items()
Expand Down
44 changes: 44 additions & 0 deletions pysqa/wrapper/gent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# coding: utf-8
# 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.

import pandas
from pysqa.wrapper.slurm import SlurmCommands


__author__ = "Jan Janssen"
__copyright__ = (
"Copyright 2019, Max-Planck-Institut für Eisenforschung GmbH - "
"Computational Materials Design (CM) Department"
)
__version__ = "1.0"
__maintainer__ = "Jan Janssen"
__email__ = "janssen@mpie.de"
__status__ = "development"
__date__ = "Feb 9, 2019"


class GentCommands(SlurmCommands):
@staticmethod
def get_job_id_from_output(queue_submit_output):
return int(queue_submit_output.splitlines()[-1].rstrip().lstrip().split(';')[0])

@staticmethod
def get_queue_from_output(queue_submit_output):
return str(queue_submit_output.splitlines()[-1].rstrip().lstrip().split(';')[1])

@staticmethod
def convert_queue_status(queue_status_output):
qstat = queue_status_output.splitlines()
queue = qstat[0].split(':')[1].strip()
if len(qstat) <= 1: # first row contains cluster name, check if there are jobs
return None

line_split_lst = [line.split('|') for line in qstat[1:]]
job_id_lst, user_lst, status_lst, job_name_lst, queue_lst = zip(*[(int(jobid), user, status.lower(), jobname, queue)
for jobid, user, status, jobname in line_split_lst])
return pandas.DataFrame({'cluster': queue_lst,
'jobid': job_id_lst,
'user': user_lst,
'jobname': job_name_lst,
'status': status_lst})

0 comments on commit 7402cbb

Please sign in to comment.