Skip to content

Commit

Permalink
Merge pull request #792 from ratt-ru/stimela2
Browse files Browse the repository at this point in the history
Stimela2 cab
  • Loading branch information
SpheMakh authored Oct 3, 2024
2 parents 52b3d45 + 37752fc commit 70dc7a2
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 0 deletions.
32 changes: 32 additions & 0 deletions stimela/cargo/base/stimela2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM kernsuite/base:9
MAINTAINER <[email protected]>
RUN docker-apt-install cmake \
wget \
subversion \
build-essential \
cmake \
gfortran \
g++ \
libncurses5-dev \
libreadline-dev \
flex \
bison \
libblas-dev \
liblapacke-dev \
libcfitsio-dev \
libgsl-dev \
wcslib-dev \
libhdf5-serial-dev \
libfftw3-dev \
python-numpy \
libboost-python-dev \
libboost-all-dev \
libpython2.7-dev \
liblog4cplus-dev \
libhdf5-dev \
casacore-dev \
wsclean

RUN pip install cult-curgo stimela quartical breizorro
RUN ulimit -p 11000
RUN stimela
51 changes: 51 additions & 0 deletions stimela/cargo/cab/stimela2/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"task": "stimela2",
"base": "stimela/stimela2",
"tag": "1.7.10",
"description": "a workflow management framework for creating portable and reproducible data processing pipelines",
"prefix": "--",
"binary": "stimela run",
"version":"2.0.0",
"junk":[],
"msdir": true,
"parameters": [
{
"info": "Recipe file",
"name": "recipe",
"io": "input",
"default": null,
"dtype": "file",
"required": false
},
{
"info": "Support files",
"name": "support-files",
"io": "output",
"default": null,
"dtype": "list:file",
"required": false
},
{
"info": "Name of recipe to run",
"name": "recipe-name",
"dtype": "str",
"required": false
},
{
"info": "Step(s) to run from recipe",
"default": null,
"required": false,
"delimiter": ",",
"name": "step",
"dtype": "list:str"
},
{
"info": "Parameter(s) to override defaults. e.g. ['ms=foo.ms', 'image_size=2048']",
"default": null,
"required": false,
"delimiter": " ",
"name": "params",
"dtype": "list:str"
}
]
}
59 changes: 59 additions & 0 deletions stimela/cargo/cab/stimela2/src/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import os
import sys
import shlex
import shutil
import subprocess
import yaml
import glob


CONFIG = os.environ["CONFIG"]
INPUT = os.environ["INPUT"]
OUTPUT = os.environ["OUTPUT"]
MSDIR = os.environ["MSDIR"]

with open(CONFIG, "r") as _std:
cab = yaml.safe_load(_std)

junk = cab["junk"]
args = []

for param in cab['parameters']:
name = param['name']
value = param['value']

if value is None:
continue

if name in ['recipe']:
recipe = value
continue

if name in ['recipe-name']:
recipe_name = value
continue

if name in ['support-files']:
continue

if name in ['step']:
delimiter = ',' #param['delimiter']
args += ['{0}{1} {2}'.format(cab['prefix'], name, delimiter.join(value))]

if name in ['params']:
delimiter = ' ' #param['delimiter']
args += ['{0}'.format(delimiter.join(value))]

_runc = " ".join([cab["binary"]] + [recipe, recipe_name] + args)

try:
subprocess.check_call(shlex.split(_runc))
finally:
for item in junk:
for dest in [OUTPUT, MSDIR]: # these are the only writable volumes in the container
items = glob.glob("{dest}/{item}".format(**locals()))
for f in items:
if os.path.isfile(f):
os.remove(f)
elif os.path.isdir(f):
shutil.rmtree(f)

0 comments on commit 70dc7a2

Please sign in to comment.