Skip to content

Commit 25cac6c

Browse files
committed
make fsaccess required
1 parent b909761 commit 25cac6c

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

cwltool/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ def main(argsl=None, # type: Optional[List[str]]
600600
_logger.error("--provenance incompatible with --no-compute-checksum")
601601
return 1
602602
ro = ResearchObject(
603+
getdefault(runtimeContext.make_fs_access, StdFsAccess),
603604
temp_prefix_ro=args.tmpdir_prefix, orcid=args.orcid,
604605
full_name=args.cwl_full_name)
605606
runtimeContext.research_obj = ro
@@ -679,7 +680,6 @@ def formatTime(self, record, datefmt=None):
679680

680681
if args.provenance and runtimeContext.research_obj:
681682
# Can't really be combined with args.pack at same time
682-
runtimeContext.research_obj.fsaccess = getdefault(runtimeContext.make_fs_access, StdFsAccess)
683683
runtimeContext.research_obj.packed_workflow(
684684
print_pack(loadingContext.loader, processobj, uri, metadata))
685685

cwltool/provenance.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,11 @@ def __init__(self,
305305
host_provenance, # type: bool
306306
user_provenance, # type: bool
307307
orcid, # type: str
308-
run_uuid=None, # type: Optional[uuid.UUID],
309-
fsaccess=None # type: Optional[StdFsAccess]
308+
fsaccess, # type: StdFsAccess
309+
run_uuid=None # type: Optional[uuid.UUID]
310310
): # type: (...) -> None
311311
"""Initialize the provenance profile."""
312-
if not fsaccess:
313-
fsaccess = StdFsAccess('')
314312
self.fsaccess = fsaccess
315-
316313
self.orcid = orcid
317314
self.research_object = research_object
318315
self.folder = self.research_object.folder
@@ -948,9 +945,8 @@ def finalize_prov_profile(self, name):
948945
class ResearchObject():
949946
"""CWLProv Research Object."""
950947

951-
def __init__(self, temp_prefix_ro="tmp", orcid='', full_name='', fsaccess=None):
952-
# type: (str, Text, Text) -> None
953-
# type: Optional[StdFsAccess]
948+
def __init__(self, fsaccess, temp_prefix_ro="tmp", orcid='', full_name=''):
949+
# type: (StdFsAccess, str, Text, Text) -> None
954950
"""Initialize the ResearchObject."""
955951
self.temp_prefix = temp_prefix_ro
956952
self.orcid = '' if not orcid else _valid_orcid(orcid)

tests/test_provenance.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from cwltool.main import main
2525
from cwltool.resolver import Path
2626
from cwltool.context import RuntimeContext
27+
from cwltool.stdfsaccess import StdFsAccess
2728

2829
from .util import get_data, needs_docker, temp_dir, working_directory
2930

@@ -513,7 +514,7 @@ def check_prov(base_path, nested=False, single_tool=False, directory=False,
513514

514515
@pytest.fixture
515516
def research_object():
516-
re_ob = provenance.ResearchObject()
517+
re_ob = provenance.ResearchObject(StdFsAccess(''))
517518
yield re_ob
518519
re_ob.close()
519520

0 commit comments

Comments
 (0)