Commit 0c8ce134 authored by bellotti_r's avatar bellotti_r
Browse files

Made repo installable; added documentation; returns the...

Made repo installable; added documentation; returns the correct SLURM ID of the job
parent d3db9780
from .simulation import Simulation
from .opaldict import OpalDict
from PathNameGenerator import PathNameGenerator
from .PathNameGenerator import PathNameGenerator
from decimal import Decimal
from ast import literal_eval
import sys
......@@ -21,6 +21,7 @@ class OpalDict:
template: str
Path the .data file.
self.dict = {}
self.rangevars = {}
......@@ -95,6 +95,9 @@ class Simulation:
Run an OPAL simulation.
Support for batch systems is available.
The directory containing the fieldmaps is given in the environment
variable FIELDMAPS.
......@@ -247,7 +250,8 @@ class Simulation:
queue = os.getenv("SGE_QUEUE", "prime_bd.q")
# Merlin6
if (hostname.startswith("merlin-l")):
if (hostname.startswith('merlin-l')
or hostname.startswith('merlin-c')):
batchsys = 'SLURM'
runfile = 'run.merlin6'
time = os.getenv("SLURM_TIME", "23:59:59")
......@@ -345,7 +349,12 @@ class Simulation:
elif batchsys == 'COBALT':
command = 'qsub'
qid =[command, runfile, '|', 'awk', "\'{print $3}\'"])
completed_process =[command, runfile],
output = completed_process.stdout
# output format for SLURM: "Submitted batch job <ID>"
ID = output.split(' ')[-1].strip()
if not quiet:
print(f'Done with setup of the OPAL simulation and submitting the job with {CORES} cores \n\n\n')
......@@ -357,7 +366,7 @@ class Simulation:
print("Batch system", batchsys, "not known!")
return qid
return ID
# Write for host
def WriteCori(self, opalexe, oinpFile, cores, time, ram, info, name):
from setuptools import setup
# file content adapted from:
description='Run OPAL simulations from within Python',
author='Andreas Adelmann et al.',
packages=['runOPAL'], # same as name
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment