Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion pysqa/queueadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def set_queue_adapter(config, directory, execute_command=execute_command):
config (dict): configuration for one cluster
directory (str): directory which contains the queue configurations
"""
if config["queue_type"] in ["SGE", "TORQUE", "SLURM", "LSF", "MOAB"]:
if config["queue_type"] in ["SGE", "TORQUE", "SLURM", "LSF", "MOAB", "FLUX"]:
return BasisQueueAdapter(
config=config, directory=directory, execute_command=execute_command
)
Expand Down
3 changes: 3 additions & 0 deletions pysqa/utils/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def __init__(self, config, directory="~/.queues", execute_command=execute_comman
elif self._config["queue_type"] == "REMOTE":
class_name = None
module_name = None
elif self._config["queue_type"] == "FLUX":
class_name = "FluxCommands"
module_name = "pysqa.wrapper.flux"
else:
raise ValueError()
if self._config["queue_type"] != "REMOTE":
Expand Down
30 changes: 30 additions & 0 deletions pysqa/wrapper/flux.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# coding: utf-8
from pysqa.wrapper.generic import SchedulerCommands
import subprocess


class FluxCommands(SchedulerCommands):
@property
def submit_job_command(self):
return ["flux", "batch"]

@property
def delete_job_command(self):
return ["flux", "cancel"]

@property
def get_queue_status_command(self):
return ["flux", "jobs", "-a", "--no-header"]

@staticmethod
def get_job_id_from_output(queue_submit_output):
result = subprocess.run(
[
"flux",
"job",
"id",
queue_submit_output.splitlines()[-1].rstrip().lstrip().split()[-1],
],
stdout=subprocess.PIPE,
)
return int(result.stdout.strip())
3 changes: 3 additions & 0 deletions tests/config/flux/flux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
#flux: -n{{cores}} --job-name={{job_name}} --env=CORES={{cores}} --output=time.out --error=error.out
{{command}}
4 changes: 4 additions & 0 deletions tests/config/flux/queue.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
queue_type: FLUX
queue_primary: flux
queues:
flux: {cores_max: 64, cores_min: 1, run_time_max: 172800, script: flux.sh}