Skip to content

Commit

Permalink
Merge pull request #34 from wrwilliams/main
Browse files Browse the repository at this point in the history
Additions for Vampir workflow analysis
  • Loading branch information
rafaelfsilva authored Jan 9, 2024
2 parents a2c62bd + b70ba08 commit c883bb9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions wfcommons/common/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import logging

from datetime import datetime
from typing import Dict, List, Optional
from logging import Logger

Expand Down Expand Up @@ -84,7 +85,9 @@ def __init__(self,
avg_power: Optional[float] = None,
priority: Optional[int] = None,
files: Optional[List[File]] = None,
logger: Optional[Logger] = None
logger: Optional[Logger] = None,
launch_dir: Optional[str] = None,
start_time: Optional[str] = None,
) -> None:
"""A task in a workflow."""
self.logger: Logger = logging.getLogger(
Expand All @@ -106,7 +109,8 @@ def __init__(self,
self.files: List[File] = files if files else []
self.machine: Machine = machine
self.priority: Optional[int] = priority

self.launch_dir: Optional[str] = launch_dir
self.start_time: Optional[str] = str(datetime.now().astimezone().isoformat()) if not start_time else start_time
self.logger.debug(
f"created {self.type} task {self.name}: runtime => {self.runtime} seconds.")

Expand Down Expand Up @@ -156,5 +160,8 @@ def as_dict(self) -> Dict:
task_obj['command']['arguments'] = self.args
if self.machine is not None:
task_obj['machine'] = self.machine.name

if self.launch_dir:
task_obj['launchDir'] = self.launch_dir
if self.start_time:
task_obj['startedAt'] = self.start_time
return task_obj
2 changes: 1 addition & 1 deletion wfcommons/common/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self,
self.wms_name: Optional[str] = "WfCommons" if not wms_name else wms_name
self.wms_version: Optional[str] = str(__version__) if not wms_version else wms_version
self.wms_url: Optional[str] = f"https://docs.wfcommons.org/en/v{__version__}/" if not wms_url else wms_url
self.executed_at: Optional[str] = datetime.now().astimezone().isoformat() if not executed_at else executed_at
self.executed_at: Optional[str] = str(datetime.now().astimezone().isoformat()) if not executed_at else executed_at
self.makespan: Optional[int] = makespan
self.tasks = {}
self.tasks_parents = {}
Expand Down

0 comments on commit c883bb9

Please sign in to comment.