Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taskname optional suffix #684

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/uwtools/drivers/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def schema(cls) -> dict:
with open(internal_schema_file(schema_name=cls._schema_name()), "r", encoding="utf-8") as f:
return bundle(json.load(f))

def taskname(self, suffix: str) -> str:
def taskname(self, suffix: Optional[str] = None) -> str:
"""
Return a common tag for task-related log messages.

Expand Down
4 changes: 3 additions & 1 deletion src/uwtools/drivers/make_solo_mosaic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
A driver for make_solo_mosaic.
"""

from typing import Optional

from iotaa import tasks

from uwtools.drivers.driver import DriverTimeInvariant
Expand All @@ -26,7 +28,7 @@ def provisioned_rundir(self):

# Public helper methods

def taskname(self, suffix: str) -> str:
def taskname(self, suffix: Optional[str] = None) -> str:
"""
Return a common tag for graph-task log messages.

Expand Down
5 changes: 5 additions & 0 deletions src/uwtools/tests/drivers/test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ def test_Assets_leadtime(config):
assert obj.leadtime == leadtime


def test_Assets_taskname(assetsobj):
assert assetsobj.taskname() == "concrete"
assert assetsobj.taskname(suffix="test") == "concrete test"


def test_Assets_validate(assetsobj, caplog):
log.setLevel(logging.INFO)
assetsobj.validate()
Expand Down
2 changes: 1 addition & 1 deletion src/uwtools/tests/drivers/test_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def driver_name(cls):
def provisioned_rundir(self):
pass

def taskname(self, suffix):
def taskname(self, suffix=None):
pass

@external
Expand Down
Loading