Skip to content

Commit

Permalink
Taskname optional suffix (#684)
Browse files Browse the repository at this point in the history
  • Loading branch information
maddenp-noaa authored Jan 15, 2025
1 parent 087b1af commit f776e48
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
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

0 comments on commit f776e48

Please sign in to comment.