Skip to content

Commit

Permalink
more linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault committed Dec 9, 2024
1 parent f615403 commit 525c1cc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ eggs/
*.egg
.tox/
.pytest_cache
*.so

# Editor Temps
.*.sw?
Expand Down
29 changes: 25 additions & 4 deletions cwltool/cwlprov/ro.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@
WORKFLOW,
Hasher,
)

if TYPE_CHECKING:
from .provenance_profile import ProvenanceProfile
from .provenance_profile import ProvenanceProfile # pylint: disable=unused-import


class ResearchObject:
Expand Down Expand Up @@ -95,7 +96,13 @@ def initialize_provenance(
fsaccess: StdFsAccess,
run_uuid: Optional[uuid.UUID] = None,
) -> "ProvenanceProfile":
"""Provide a provenance profile initialization hook function to extend details as needed."""
"""
Provide a provenance profile initialization hook function.
Allows overriding the default strategy to define the
provenance profile concepts and associations to extend
details as needed.
"""
from .provenance_profile import ProvenanceProfile

return ProvenanceProfile(
Expand Down Expand Up @@ -144,7 +151,15 @@ def _initialize_bagit(self) -> None:
bag_it_file.write(f"Tag-File-Character-Encoding: {ENCODING}\n")

def resolve_user(self) -> tuple[str, str]:
"""Provide a user provenance hook function in case the calling code can provide a better resolution."""
"""
Provide a user provenance hook function.
Allows overriding the default strategy to retrieve user provenance
in case the calling code can provide a better resolution.
The function must return a tuple of the (username, fullname)
that identifies the user. This user will be applied on top
to any provided ORCID or fullname by agent association.
"""
return _whoami()

Check warning on line 163 in cwltool/cwlprov/ro.py

View check run for this annotation

Codecov / codecov/patch

cwltool/cwlprov/ro.py#L163

Added line #L163 was not covered by tests

def user_provenance(self, document: ProvDocument) -> None:
Expand Down Expand Up @@ -187,7 +202,13 @@ def user_provenance(self, document: ProvDocument) -> None:
document.actedOnBehalfOf(account, user)

def resolve_host(self) -> tuple[str, str]:
"""Provide a host provenance hook function in case the calling code can provide a better resolution."""
"""
Provide a host provenance hook function.
Allows overriding the default strategy to retrieve host provenance
in case the calling code can provide a better resolution.
The function must return a tuple of the (fqdn, uri) that identifies the host.
"""
fqdn = getfqdn()
return fqdn, fqdn # allow for (fqdn, uri) to be distinct, but the same by default

Check warning on line 213 in cwltool/cwlprov/ro.py

View check run for this annotation

Codecov / codecov/patch

cwltool/cwlprov/ro.py#L212-L213

Added lines #L212 - L213 were not covered by tests

Expand Down
1 change: 0 additions & 1 deletion cwltool/executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from .command_line_tool import CallbackJob, ExpressionJob
from .context import RuntimeContext, getdefault
from .cuda import cuda_version_and_device_count
from .cwlprov.provenance_profile import ProvenanceProfile
from .errors import WorkflowException
from .job import JobBase
from .loghandler import _logger
Expand Down

0 comments on commit 525c1cc

Please sign in to comment.