Skip to content

Commit 793c4dd

Browse files
committed
* Add default to task start time if none provided
* Change new keys to camelCase * executed_at needs to be stringified before JSON serialization
1 parent e861828 commit 793c4dd

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

wfcommons/common/task.py

Lines changed: 4 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

@@ -109,7 +110,7 @@ def __init__(self,
109110
self.machine: Machine = machine
110111
self.priority: Optional[int] = priority
111112
self.launch_dir: Optional[str] = launch_dir
112-
self.start_time: Optional[str] = start_time
113+
self.start_time: Optional[str] = str(datetime.now().astimezone().isoformat()) if not start_time else start_time
113114
self.logger.debug(
114115
f"created {self.type} task {self.name}: runtime => {self.runtime} seconds.")
115116

@@ -160,7 +161,7 @@ def as_dict(self) -> Dict:
160161
if self.machine:
161162
task_obj['machine'] = self.machine.name
162163
if self.launch_dir:
163-
task_obj['launch_dir'] = self.launch_dir
164+
task_obj['launchDir'] = self.launch_dir
164165
if self.start_time:
165-
task_obj['start_time'] = self.start_time
166+
task_obj['startedAt'] = self.start_time
166167
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)