Skip to content

Commit b58e7b7

Browse files
authored
Merge pull request #624 from ratt-ru/pullfreeze
fix pull freeze if image exists
2 parents c7efd50 + 15d3bb2 commit b58e7b7

5 files changed

Lines changed: 14 additions & 10 deletions

File tree

examples/simulation_pipeline.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
log_dir=os.path.join(OUTPUT, "logs"),
2626
)
2727

28-
pipeline.JOB_TYPE = "singularity"
29-
3028
# 1: Make empty MS
3129
pipeline.add("cab/simms", # Executor image to start container from
3230
"simms_example", # Container name

stimela/cargo/base/cubical/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ RUN docker-apt-install casacore-dev \
99
libcfitsio-dev
1010
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.6 10
1111
RUN pip3 install --upgrade --force pip
12-
RUN pip install "cubical[lsm-support]@git+https://github.com/ratt-ru/CubiCal.git@v1.5.2"
12+
RUN pip install "cubical[lsm-support]@git+https://github.com/ratt-ru/CubiCal.git@v1.5.3"
1313
RUN gocubical --help

stimela/cargo/cab/cubical/parameters.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"task": "cubical",
33
"base": "stimela/cubical",
4-
"tag": "1.5.00",
4+
"tag": "1.5.4",
55
"description": "CubiCal is a suite of fast radio interferometric calibration routines exploiting complex optimisation.",
66
"prefix": "--",
7-
"version":"1.5.2",
7+
"version":"1.5.3",
88
"binary": "gocubical",
99
"junk":["cubical.last", "montblanc.log"],
1010
"msdir": true,

stimela/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def run(argv):
179179
add("-g", "--globals", metavar="KEY=VALUE[:TYPE]", action="append", default=[],
180180
help="Global variables to pass to script. The type is assumed to string unless specified")
181181

182-
add("-jt", "--job-type", default="docker",
182+
add("-jt", "--job-type", default="docker", choices = ["docker", "singularity", "podman"],
183183
help="Container technology to use when running jobs")
184184

185185
add("-ll", "--log-level", default="INFO", choices=loglevels.upper().split() + loglevels.split(),
@@ -189,6 +189,7 @@ def run(argv):
189189

190190
_globals = dict(_STIMELA_INPUT=args.input, _STIMELA_OUTPUT=args.output,
191191
_STIMELA_MSDIR=args.msdir,
192+
_STIMELA_JOB_TYPE=args.job_type.lower(),
192193
_STIMELA_LOG_LEVEL=args.log_level.upper())
193194

194195
nargs = len(args.globals)

stimela/singularity.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from shutil import which
1414

1515

16+
log = stimela.logger()
17+
1618
binary = which("singularity")
1719
if binary:
1820
__version_string = subprocess.check_output([binary, "--version"]).decode("utf8")
@@ -27,7 +29,7 @@
2729
class SingularityError(Exception):
2830
pass
2931

30-
def pull(image, store_path, docker=True, directory=".", force=False):
32+
def pull(image, name, docker=True, directory=".", force=False):
3133
"""
3234
pull an image
3335
"""
@@ -38,13 +40,16 @@ def pull(image, store_path, docker=True, directory=".", force=False):
3840
if not os.path.exists(directory):
3941
os.mkdir(directory)
4042

41-
utils.xrun("singularity", ["build",
43+
image_path = os.path.abspath(os.path.join(directory, name))
44+
if os.path.exists(image_path) and not force:
45+
log.info(f"Singularity image already exists at '{image_path}'. To replace it, please re-run with the 'force' option")
46+
else:
47+
utils.xrun("singularity", ["build",
4248
"--force" if force else "",
43-
os.path.join(directory,store_path), fp])
49+
image_path, fp])
4450

4551
return 0
4652

47-
4853
class Container(object):
4954
def __init__(self, image, name,
5055
volumes=None,

0 commit comments

Comments
 (0)