|
27 | 27 | )
|
28 | 28 |
|
29 | 29 | from galaxy.tool_util.deps import docker_util
|
| 30 | +from galaxy.tool_util.deps import singularity_util |
30 | 31 | from galaxy.tool_util.deps.container_volumes import DockerVolume
|
31 | 32 | from galaxy.util.commands import argv_to_str
|
32 | 33 | from galaxy.util.yaml_util import ordered_dump
|
|
125 | 126 | "planemo_dest": {
|
126 | 127 | "runner": "planemo_runner",
|
127 | 128 | "require_container": False,
|
128 |
| - "docker_enabled": False, |
129 |
| - "docker_sudo": False, |
130 |
| - "docker_sudo_cmd": docker_util.DEFAULT_SUDO_COMMAND, |
131 |
| - "docker_cmd": docker_util.DEFAULT_DOCKER_COMMAND, |
132 |
| - "docker_volumes": "$defaults", |
133 | 129 | },
|
134 | 130 | "upload_dest": {"runner": "planemo_runner", "docker_enabled": False},
|
135 | 131 | },
|
@@ -333,11 +329,14 @@ def local_galaxy_config(ctx, runnables, for_tests=False, **kwds):
|
333 | 329 |
|
334 | 330 | # Duplicate block in docker variant above.
|
335 | 331 | if kwds.get("mulled_containers", False):
|
336 |
| - if not kwds.get("docker", False): |
337 |
| - if ctx.get_option_source("docker") != OptionSource.cli: |
| 332 | + if not (kwds.get("docker", False) or kwds.get("singularity", False)): |
| 333 | + if ( |
| 334 | + ctx.get_option_source("docker") != OptionSource.cli |
| 335 | + and ctx.get_option_source("singularity") != OptionSource.cli |
| 336 | + ): |
338 | 337 | kwds["docker"] = True
|
339 | 338 | else:
|
340 |
| - raise Exception("Specified no docker and mulled containers together.") |
| 339 | + raise Exception("Specified --no-docker/--no-singularity and mulled containers together.") |
341 | 340 | conda_default_options = ("conda_auto_init", "conda_auto_install")
|
342 | 341 | use_conda_options = ("dependency_resolution", "conda_use_local", "conda_prefix", "conda_exec")
|
343 | 342 | if not any(kwds.get(_) for _ in use_conda_options) and all(
|
@@ -718,7 +717,7 @@ class GalaxyConfig(GalaxyInterface, metaclass=abc.ABCMeta):
|
718 | 717 |
|
719 | 718 | This assumes more than an API connection is available - Planemo needs to be able to
|
720 | 719 | start and stop the Galaxy instance, recover logs, etc... There are currently two
|
721 |
| - implementations - a locally executed Galaxy and one running inside a Docker containe |
| 720 | + implementations - a locally executed Galaxy and one running inside a Docker container |
722 | 721 | """
|
723 | 722 |
|
724 | 723 | @abc.abstractproperty
|
@@ -1334,26 +1333,43 @@ def _handle_job_config_file(
|
1334 | 1333 | "job_conf.yml",
|
1335 | 1334 | )
|
1336 | 1335 | planemo_dest = JOB_CONFIG_LOCAL["execution"]["environments"]["planemo_dest"]
|
1337 |
| - planemo_dest["docker_enabled"] = kwds.get("docker", False) |
1338 |
| - planemo_dest["docker_sudo"] = kwds.get("docker_sudo", False) |
1339 |
| - planemo_dest["docker_sudo_cmd"] = kwds.get("docker_sudo_cmd", docker_util.DEFAULT_SUDO_COMMAND) |
1340 |
| - planemo_dest["docker_cmd"] = kwds.get("docker_cmd", docker_util.DEFAULT_DOCKER_COMMAND) |
1341 |
| - |
1342 |
| - docker_host = kwds.get("docker_host", docker_util.DEFAULT_HOST) |
1343 |
| - if docker_host: |
1344 |
| - planemo_dest["docker_host"] = docker_host |
1345 |
| - |
1346 |
| - volumes = list(kwds.get("docker_extra_volume") or []) |
1347 |
| - if test_data_dir: |
1348 |
| - volumes.append(f"{test_data_dir}:ro") |
1349 |
| - |
1350 |
| - docker_volumes_str = "$defaults" |
1351 |
| - if volumes: |
1352 |
| - # exclude tool directories, these are mounted :ro by $defaults |
1353 |
| - all_tool_dirs = {os.path.dirname(tool_path) for tool_path in all_tool_paths} |
1354 |
| - extra_volumes_str = ",".join(str(v) for v in create_docker_volumes(volumes) if v.path not in all_tool_dirs) |
1355 |
| - docker_volumes_str = f"{docker_volumes_str},{extra_volumes_str}" |
1356 |
| - planemo_dest["docker_volumes"] = docker_volumes_str |
| 1336 | + |
| 1337 | + for container_type in ["docker", "singularity"]: |
| 1338 | + if not kwds.get(container_type, False): |
| 1339 | + continue |
| 1340 | + planemo_dest[f"{container_type}_enabled"] = kwds.get(container_type, False) |
| 1341 | + planemo_dest[f"{container_type}_sudo"] = kwds.get(f"{container_type}_sudo", False) |
| 1342 | + planemo_dest[f"{container_type}_sudo_cmd"] = kwds.get( |
| 1343 | + f"{container_type}_sudo_cmd", |
| 1344 | + docker_util.DEFAULT_SUDO_COMMAND |
| 1345 | + if container_type == "docker" |
| 1346 | + else singularity_util.DEFAULT_SUDO_COMMAND, |
| 1347 | + ) |
| 1348 | + planemo_dest[f"{container_type}_cmd"] = kwds.get( |
| 1349 | + f"{container_type}_cmd", |
| 1350 | + docker_util.DEFAULT_DOCKER_COMMAND |
| 1351 | + if container_type == "docker" |
| 1352 | + else singularity_util.DEFAULT_SINGULARITY_COMMAND, |
| 1353 | + ) |
| 1354 | + if container_type == "docker": |
| 1355 | + docker_host = kwds.get("docker_host", docker_util.DEFAULT_HOST) |
| 1356 | + if docker_host: |
| 1357 | + planemo_dest["docker_host"] = docker_host |
| 1358 | + |
| 1359 | + volumes = list(kwds.get(f"{container_type}_extra_volume") or []) |
| 1360 | + if test_data_dir: |
| 1361 | + volumes.append(f"{test_data_dir}:ro") |
| 1362 | + volumes_str = "$defaults" |
| 1363 | + if volumes: |
| 1364 | + # exclude tool directories, these are mounted :ro by $defaults |
| 1365 | + all_tool_dirs = {os.path.dirname(tool_path) for tool_path in all_tool_paths} |
| 1366 | + extra_volumes_str = ",".join( |
| 1367 | + str(v) for v in create_docker_volumes(volumes) if v.path not in all_tool_dirs |
| 1368 | + ) |
| 1369 | + volumes_str = f"{volumes_str},{extra_volumes_str}" |
| 1370 | + planemo_dest[f"{container_type}_volumes"] = volumes_str |
| 1371 | + break |
| 1372 | + |
1357 | 1373 | JOB_CONFIG_LOCAL["execution"]["environments"]["planemo_dest"] = planemo_dest
|
1358 | 1374 | with open(job_config_file, "w") as job_config_fh:
|
1359 | 1375 | ordered_dump(JOB_CONFIG_LOCAL, job_config_fh)
|
|
0 commit comments