Skip to content

Commit 1f8295b

Browse files
committed
convert to dictionary before json dumps
1 parent a7b5590 commit 1f8295b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cwltool/provenance.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,20 +1493,22 @@ def _add_to_bagit(self, rel_path, **checksums):
14931493
self.add_to_manifest(rel_path, checksums)
14941494

14951495
def create_job(self,
1496-
builder_job, # type: Dict
1496+
builder_job, # type: Dict[Text, Any]
14971497
wf_job=None, # type: Callable[[Dict[Text, Text], Callable[[Any, Any], Any], RuntimeContext], Generator[Any, None, None]]
14981498
is_output=False
14991499
): # type: (...) -> Dict
15001500
#TODO customise the file
15011501
"""Generate the new job object with RO specific relative paths."""
15021502
copied = copy.deepcopy(builder_job)
1503-
relativised_input_objecttemp = {} # type: Dict
1503+
relativised_input_objecttemp = {} # type: Dict[Text, Any]
15041504
self._relativise_files(copied)
1505+
def jdefault(o):
1506+
return dict(o)
15051507
if is_output:
15061508
rel_path = posixpath.join(_posix_path(WORKFLOW), "primary-output.json")
15071509
else:
15081510
rel_path = posixpath.join(_posix_path(WORKFLOW), "primary-job.json")
1509-
j = json.dumps(dict(copied), indent=4, ensure_ascii=False)
1511+
j = json.dumps(copied, indent=4, ensure_ascii=False, default=jdefault)
15101512
with self.write_bag_file(rel_path) as file_path:
15111513
file_path.write(j + u"\n")
15121514
_logger.debug(u"[provenance] Generated customised job file: %s",
@@ -1527,7 +1529,7 @@ def create_job(self,
15271529
return self.relativised_input_object
15281530

15291531
def _relativise_files(self, structure):
1530-
# type: (Any, Dict) -> None
1532+
# type: (Any, Dict[Any, Any]) -> None
15311533
"""Save any file objects into the RO and update the local paths."""
15321534
# Base case - we found a File we need to update
15331535
_logger.debug(u"[provenance] Relativising: %s", structure)

0 commit comments

Comments
 (0)