|
22 | 22 |
|
23 | 23 | from planemo import git |
24 | 24 | from planemo.conda import build_conda_context |
| 25 | +from planemo.config import OptionSource |
25 | 26 | from planemo.docker import docker_host_args |
26 | 27 | from planemo.io import ( |
27 | 28 | communicate, |
|
32 | 33 | warn, |
33 | 34 | write_file, |
34 | 35 | ) |
| 36 | +from planemo.mulled import build_involucro_context |
35 | 37 | from planemo.shed import tool_shed_url |
36 | 38 |
|
37 | 39 | from .api import ( |
|
118 | 120 | </handlers> |
119 | 121 | <destinations default="planemo_dest"> |
120 | 122 | <destination id="planemo_dest" runner="planemo_runner"> |
121 | | - <param id="docker_enable">${docker_enable}</param> |
| 123 | + <param id="require_container">${require_container}</param> |
| 124 | + <param id="docker_enabled">${docker_enable}</param> |
122 | 125 | <param id="docker_sudo">${docker_sudo}</param> |
123 | 126 | <param id="docker_sudo_cmd">${docker_sudo_cmd}</param> |
124 | 127 | <param id="docker_cmd">${docker_cmd}</param> |
125 | | - <param id="docker_host">${docker_host}</param> |
| 128 | + ${docker_host_param} |
| 129 | + </destination> |
| 130 | + <destination id="upload_dest" runner="planemo_runner"> |
| 131 | + <param id="docker_enable">false</param> |
126 | 132 | </destination> |
127 | 133 | </destinations> |
| 134 | + <tools> |
| 135 | + <tool id="upload1" destination="upload_dest" /> |
| 136 | + </tools> |
128 | 137 | </job_conf> |
129 | 138 | """ |
130 | 139 |
|
@@ -211,6 +220,7 @@ def config_join(*args): |
211 | 220 | ) |
212 | 221 | port = _get_port(kwds) |
213 | 222 | properties = _shared_galaxy_properties(kwds) |
| 223 | + _handle_container_resolution(ctx, kwds, properties) |
214 | 224 | master_api_key = _get_master_api_key(kwds) |
215 | 225 |
|
216 | 226 | template_args = dict( |
@@ -276,6 +286,14 @@ def local_galaxy_config(ctx, runnables, for_tests=False, **kwds): |
276 | 286 | ) |
277 | 287 | galaxy_root = _check_galaxy(ctx, **kwds) |
278 | 288 | install_galaxy = galaxy_root is None |
| 289 | + |
| 290 | + # Duplicate block in docker variant above. |
| 291 | + if kwds.get("mulled_containers", False) and not kwds.get("docker", False): |
| 292 | + if ctx.get_option_source("docker") != OptionSource.cli: |
| 293 | + kwds["docker"] = True |
| 294 | + else: |
| 295 | + raise Exception("Specified no docker and mulled containers together.") |
| 296 | + |
279 | 297 | with _config_directory(ctx, **kwds) as config_directory: |
280 | 298 | def config_join(*args): |
281 | 299 | return os.path.join(config_directory, *args) |
@@ -374,6 +392,7 @@ def config_join(*args): |
374 | 392 | migrated_tools_config=empty_tool_conf, |
375 | 393 | test_data_dir=test_data_dir, # TODO: make gx respect this |
376 | 394 | )) |
| 395 | + _handle_container_resolution(ctx, kwds, properties) |
377 | 396 | if not for_tests: |
378 | 397 | properties["database_connection"] = _database_connection(database_location, **kwds) |
379 | 398 |
|
@@ -1106,13 +1125,20 @@ def _handle_job_config_file(config_directory, server_name, kwds): |
1106 | 1125 | config_directory, |
1107 | 1126 | "job_conf.xml", |
1108 | 1127 | ) |
| 1128 | + docker_enable = str(kwds.get("docker", False)) |
| 1129 | + docker_host = str(kwds.get("docker_host", docker_util.DEFAULT_HOST)) |
| 1130 | + docker_host_param = "" |
| 1131 | + if docker_host: |
| 1132 | + docker_host_param = """<param id="docker_host">%s</param>""" % docker_host |
| 1133 | + |
1109 | 1134 | conf_contents = Template(template_str).safe_substitute({ |
1110 | 1135 | "server_name": server_name, |
1111 | 1136 | "docker_enable": str(kwds.get("docker", False)), |
| 1137 | + "require_container": docker_enable, |
1112 | 1138 | "docker_sudo": str(kwds.get("docker_sudo", False)), |
1113 | 1139 | "docker_sudo_cmd": str(kwds.get("docker_sudo_cmd", docker_util.DEFAULT_SUDO_COMMAND)), |
1114 | 1140 | "docker_cmd": str(kwds.get("docker_cmd", docker_util.DEFAULT_DOCKER_COMMAND)), |
1115 | | - "docker_host": str(kwds.get("docker_host", docker_util.DEFAULT_HOST)), |
| 1141 | + "docker_host": docker_host_param, |
1116 | 1142 | }) |
1117 | 1143 | write_file(job_config_file, conf_contents) |
1118 | 1144 | kwds["job_config_file"] = job_config_file |
@@ -1184,6 +1210,14 @@ def add_attribute(key, value): |
1184 | 1210 | kwds["dependency_resolvers_config_file"] = resolvers_conf |
1185 | 1211 |
|
1186 | 1212 |
|
| 1213 | +def _handle_container_resolution(ctx, kwds, galaxy_properties): |
| 1214 | + if kwds.get("mulled_containers", False): |
| 1215 | + galaxy_properties["enable_beta_mulled_containers"] = "True" |
| 1216 | + involucro_context = build_involucro_context(ctx, **kwds) |
| 1217 | + galaxy_properties["involucro_auto_init"] = "False" # Use planemo's |
| 1218 | + galaxy_properties["involucro_path"] = involucro_context.involucro_bin |
| 1219 | + |
| 1220 | + |
1187 | 1221 | def _handle_job_metrics(config_directory, kwds): |
1188 | 1222 | metrics_conf = os.path.join(config_directory, "job_metrics_conf.xml") |
1189 | 1223 | open(metrics_conf, "w").write(EMPTY_JOB_METRICS_TEMPLATE) |
|
0 commit comments