Skip to content

Commit c883bb9

Browse files
authored
Merge pull request #34 from wrwilliams/main
Additions for Vampir workflow analysis
2 parents a2c62bd + b70ba08 commit c883bb9

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

wfcommons/common/task.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import logging
1212

13+
from datetime import datetime
1314
from typing import Dict, List, Optional
1415
from logging import Logger
1516

@@ -84,7 +85,9 @@ def __init__(self,
8485
avg_power: Optional[float] = None,
8586
priority: Optional[int] = None,
8687
files: Optional[List[File]] = None,
87-
logger: Optional[Logger] = None
88+
logger: Optional[Logger] = None,
89+
launch_dir: Optional[str] = None,
90+
start_time: Optional[str] = None,
8891
) -> None:
8992
"""A task in a workflow."""
9093
self.logger: Logger = logging.getLogger(
@@ -106,7 +109,8 @@ def __init__(self,
106109
self.files: List[File] = files if files else []
107110
self.machine: Machine = machine
108111
self.priority: Optional[int] = priority
109-
112+
self.launch_dir: Optional[str] = launch_dir
113+
self.start_time: Optional[str] = str(datetime.now().astimezone().isoformat()) if not start_time else start_time
110114
self.logger.debug(
111115
f"created {self.type} task {self.name}: runtime => {self.runtime} seconds.")
112116

@@ -156,5 +160,8 @@ def as_dict(self) -> Dict:
156160
task_obj['command']['arguments'] = self.args
157161
if self.machine is not None:
158162
task_obj['machine'] = self.machine.name
159-
163+
if self.launch_dir:
164+
task_obj['launchDir'] = self.launch_dir
165+
if self.start_time:
166+
task_obj['startedAt'] = self.start_time
160167
return task_obj

wfcommons/common/workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def __init__(self,
6060
self.wms_name: Optional[str] = "WfCommons" if not wms_name else wms_name
6161
self.wms_version: Optional[str] = str(__version__) if not wms_version else wms_version
6262
self.wms_url: Optional[str] = f"https://docs.wfcommons.org/en/v{__version__}/" if not wms_url else wms_url
63-
self.executed_at: Optional[str] = datetime.now().astimezone().isoformat() if not executed_at else executed_at
63+
self.executed_at: Optional[str] = str(datetime.now().astimezone().isoformat()) if not executed_at else executed_at
6464
self.makespan: Optional[int] = makespan
6565
self.tasks = {}
6666
self.tasks_parents = {}

0 commit comments

Comments
 (0)