@@ -1493,20 +1493,22 @@ def _add_to_bagit(self, rel_path, **checksums):
1493
1493
self .add_to_manifest (rel_path , checksums )
1494
1494
1495
1495
def create_job (self ,
1496
- builder_job , # type: Dict
1496
+ builder_job , # type: Dict[Text, Any]
1497
1497
wf_job = None , # type: Callable[[Dict[Text, Text], Callable[[Any, Any], Any], RuntimeContext], Generator[Any, None, None]]
1498
1498
is_output = False
1499
1499
): # type: (...) -> Dict
1500
1500
#TODO customise the file
1501
1501
"""Generate the new job object with RO specific relative paths."""
1502
1502
copied = copy .deepcopy (builder_job )
1503
- relativised_input_objecttemp = {} # type: Dict
1503
+ relativised_input_objecttemp = {} # type: Dict[Text, Any]
1504
1504
self ._relativise_files (copied )
1505
+ def jdefault (o ):
1506
+ return dict (o )
1505
1507
if is_output :
1506
1508
rel_path = posixpath .join (_posix_path (WORKFLOW ), "primary-output.json" )
1507
1509
else :
1508
1510
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 )
1510
1512
with self .write_bag_file (rel_path ) as file_path :
1511
1513
file_path .write (j + u"\n " )
1512
1514
_logger .debug (u"[provenance] Generated customised job file: %s" ,
@@ -1527,7 +1529,7 @@ def create_job(self,
1527
1529
return self .relativised_input_object
1528
1530
1529
1531
def _relativise_files (self , structure ):
1530
- # type: (Any, Dict) -> None
1532
+ # type: (Any, Dict[Any, Any] ) -> None
1531
1533
"""Save any file objects into the RO and update the local paths."""
1532
1534
# Base case - we found a File we need to update
1533
1535
_logger .debug (u"[provenance] Relativising: %s" , structure )
0 commit comments