Skip to content

Commit

Permalink
Merge pull request #3 from gfenoy/feature/tmp-path-update
Browse files Browse the repository at this point in the history
Store the log files in the user's temporary directory
  • Loading branch information
fabricebrito authored Jan 15, 2025
2 parents 9359394 + fe86ead commit 17ea83a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion zoo_argowf_runner/argo_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def __init__(
max_ram: int,
storage_class: str,
handler: Callable,
tmp_path: str,
usid: str,
) -> None:
"""
Initialize the execution class with workflow and execution parameters.
Expand All @@ -52,6 +54,8 @@ def __init__(
self.max_ram = max_ram
self.storage_class = storage_class
self.handler = handler
self.tmp_path = tmp_path
self.usid = usid

self.token = os.environ.get("ARGO_WF_TOKEN", None)

Expand Down Expand Up @@ -230,7 +234,9 @@ def get_tool_logs(self):
response = requests.get(
f"{self.workflows_service}/artifact-files/{self.namespace}/workflows/{self.workflow_name}/{self.workflow_name}/outputs/tool-logs/{child.get('name')}.log"
)
with open(f"{child.get('name')}.log", "w") as f:
if not(os.path.exists(os.path.join(self.tmp_path,f"{self.entrypoint}-{self.usid}"))):
os.mkdir(os.path.join(self.tmp_path,f"{self.entrypoint}-{self.usid}"))
with open(os.path.join(self.tmp_path,f"{self.entrypoint}-{self.usid}",f"{child.get('name')}.log"), "w") as f:
f.write(response.text)
tool_logs.append(f"{child.get('name')}.log")

Expand Down
2 changes: 2 additions & 0 deletions zoo_argowf_runner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ def execute(self):
max_ram=self.get_max_ram(),
storage_class=self.storage_class,
handler=self.handler,
tmp_path=self.zoo_conf.conf["main"]["tmpPath"],
usid=self.zoo_conf.conf["lenv"]["usid"],
)

additional_configmaps = [
Expand Down

0 comments on commit 17ea83a

Please sign in to comment.