Skip to content

Commit 03b058a

Browse files
committed
Made Swift/T translator use python_exec()
1 parent f627804 commit 03b058a

3 files changed

Lines changed: 36 additions & 26 deletions

File tree

tests/translators_loggers/Dockerfile.swiftt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkg
5656
conda create -n swiftt-env python=3.11 -y
5757
RUN conda run -n swiftt-env python --version
5858
RUN conda run -n swiftt-env pip install flowcept
59+
RUN conda run -n swiftt-env pip install pandas filelock
5960
RUN conda run -n swiftt-env pip install py-cpuinfo psutil redis
6061
RUN conda run -n swiftt-env conda install -y -c conda-forge gcc zsh zlib pathos
6162
RUN conda run -n swiftt-env conda install -y -c swift-t swift-t

tests/translators_loggers/test_translators_loggers.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -269,17 +269,17 @@ class TestTranslators:
269269
"backend",
270270
[
271271
"swiftt",
272-
"dask",
273-
"parsl",
274-
"nextflow",
275-
"nextflow_subworkflow",
276-
"airflow",
277-
"bash",
278-
"taskvine",
279-
"makeflow",
280-
"cwl",
281-
"streamflow",
282-
"pegasus",
272+
"dask",
273+
"parsl",
274+
"nextflow",
275+
"nextflow_subworkflow",
276+
"airflow",
277+
"bash",
278+
"taskvine",
279+
"makeflow",
280+
"cwl",
281+
"streamflow",
282+
"pegasus",
283283
])
284284
@pytest.mark.unit
285285
# @pytest.mark.skip(reason="tmp")

wfcommons/wfbench/translator/templates/swift_t/workflow.swift

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -107,21 +107,30 @@ if 'workflow_id':
107107
108108
__import__("logging").info(f"Starting {task_name} Benchmark on {socket.gethostname()}")
109109
110-
cmd = [
111-
sys.executable, wfbench,
112-
"--name", task_name,
113-
"--workflow_id", workflow_id,
114-
"--percent-cpu", str(percent_cpu),
115-
"--cpu-work", str(cpu_work),
116-
"--output-files", f'{{"{output_file}": {output_file_size}}}',
117-
"--input-files", str(input_file).replace("'", '"'),
118-
"--with-flowcept",
119-
]
120-
if gpu_work:
121-
cmd += ["--gpu-work", str(gpu_work)]
122-
123-
logging.info(f"Launching wfbench for task {task_name}")
124-
proc = subprocess.run(cmd)
110+
from importlib.util import spec_from_file_location, module_from_spec
111+
from importlib.machinery import SourceFileLoader
112+
loader = SourceFileLoader("wfbench", wfbench)
113+
spec = spec_from_file_location("wfbench", wfbench, loader=loader)
114+
mod = module_from_spec(spec)
115+
spec.loader.exec_module(mod)
116+
mod.run(
117+
name=task_name,
118+
workflow_id=workflow_id,
119+
percent_cpu=percent_cpu,
120+
cpu_work=cpu_work,
121+
mem=None,
122+
gpu_work=gpu_work,
123+
output_files=f'{{"{output_file}": {output_file_size}}}',
124+
input_files=str(input_file).replace("'", '"'),
125+
with_flowcept=True,
126+
silent=False,
127+
debug=False,
128+
rundir=None,
129+
path_lock=None,
130+
path_cores=None,
131+
time_limit=None,
132+
num_chunks=10,
133+
)
125134
126135
__import__("logging").info(f"Benchmark {task_name} completed!")
127136

0 commit comments

Comments
 (0)