Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stimela2 cab #792

Merged
merged 4 commits into from
Oct 3, 2024
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
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)
Loading