diff --git a/workflows/plugins/workflow_runners/local/workflow_runner_local.py b/workflows/plugins/workflow_runners/local/workflow_runner_local.py index 48e4411a..882cbd75 100644 --- a/workflows/plugins/workflow_runners/local/workflow_runner_local.py +++ b/workflows/plugins/workflow_runners/local/workflow_runner_local.py @@ -7,6 +7,7 @@ import threading from typing import List from uuid import uuid4 +from pathlib import Path import re from plugin_types import ( @@ -43,6 +44,22 @@ def _detect_task_output(self, line: str) -> None: for key, output in outputs.items(): print(f"{key}: {output}") + def config_file(self, dir_path: str) -> str: + config_file_str = """ +[download_awscli] +host_credentials = true + +[task_runtime] +defaults = { + "docker_network": "czidnet" } + +[docker_swarm] +allow_networks = ["czidnet"]""" + file_path = str(Path(dir_path) / "miniwdl.cfg") + with open(file_path, "w+") as f: + f.write(config_file_str) + return file_path + async def _run_workflow_work( self, event_bus: EventBus, @@ -53,10 +70,24 @@ async def _run_workflow_work( await event_bus.send(WorkflowStartedMessage(runner_id=runner_id)) # Running docker-in-docker requires the paths to files and outputs to be the same between with tempfile.TemporaryDirectory(dir="/tmp") as tmpdir: + config_path = self.config_file(tmpdir) + cmd = [ + "miniwdl", + "run", + "--verbose", + ] + if os.environ.get("BOTO_ENDPOINT_URL"): + cmd += ["--env", f"AWS_ENDPOINT_URL={os.environ.get('BOTO_ENDPOINT_URL')}"] + if config_path: + cmd += [ + "--cfg", + config_path, + ] + cmd += [os.path.abspath(workflow_path)] + cmd += [f"{k}={v}" for k, v in inputs.items()] try: p = subprocess.Popen( - ["miniwdl", "run", "--verbose", os.path.abspath(workflow_path)] - + [f"{k}={v}" for k, v in inputs.items()], + cmd, cwd=tmpdir, stdout=subprocess.PIPE, stderr=subprocess.PIPE,