Skip to content

Commit 2a2216b

Browse files
simleomr-c
authored andcommitted
provenance: add empty manifest when there are no data files
1 parent 49b44e5 commit 2a2216b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

cwltool/provenance.py

+4
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ def __init__(
298298
self.cwltool_version = "cwltool %s" % versionstring().split()[-1]
299299
##
300300
self.relativised_input_object = {} # type: CWLObjectType
301+
self.has_manifest = False
301302

302303
self._initialize()
303304
_logger.debug("[provenance] Temporary research object: %s", self.folder)
@@ -355,6 +356,8 @@ def open_log_file_for_activity(
355356
def _finalize(self) -> None:
356357
self._write_ro_manifest()
357358
self._write_bag_info()
359+
if not self.has_manifest:
360+
(Path(self.folder) / "manifest-sha1.txt").touch()
358361

359362
def user_provenance(self, document: ProvDocument) -> None:
360363
"""Add the user provenance."""
@@ -853,6 +856,7 @@ def add_to_manifest(self, rel_path: str, checksums: Dict[str, str]) -> None:
853856
if os.path.commonprefix(["data/", rel_path]) == "data/":
854857
# payload file, go to manifest
855858
manifest = "manifest"
859+
self.has_manifest = True
856860
else:
857861
# metadata file, go to tag manifest
858862
manifest = "tagmanifest"

tests/test_provenance.py

+9
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,15 @@ def test_directory_workflow(tmp_path: Path) -> None:
192192
assert p.is_file(), f"Could not find {l} as {p}"
193193

194194

195+
@needs_docker
196+
def test_no_data_files(tmp_path: Path) -> None:
197+
folder = cwltool(
198+
tmp_path,
199+
get_data("tests/wf/conditional_step_no_inputs.cwl"),
200+
)
201+
check_bagit(folder)
202+
203+
195204
def check_output_object(base_path: Path) -> None:
196205
output_obj = base_path / "workflow" / "primary-output.json"
197206
compare_checksum = "sha1$b9214658cc453331b62c2282b772a5c063dbd284"

0 commit comments

Comments
 (0)