For a local profile, blackfish run --dry-run fails with:
AttributeError: 'NoneType' object has no attribute 'hex'
The Slurm dry-run branch constructs its service with an explicit id, but the local branch does not:
# Slurm branch — lib/src/blackfish/cli/services/text_generation.py
service = TextGeneration(
id=uuid4(), # <- present
name=name,
...
)
# local branch
service = TextGeneration(
name=name, # <- no id
...
)
render_job_script then does uuid=self.id.hex (server/services/base.py), and self.id is None because the object was never flushed to a database. Both text_generation.py and speech_recognition.py have the same asymmetry.
Reproduced on main:
r = CliRunner().invoke(main, ["run","-p","default","text-generation","openai/gpt-2","--dry-run"])
# exit: 1, exc: AttributeError("'NoneType' object has no attribute 'hex'")
Why the tests miss it
tests/cli/test_cli_run.py::test_dry_run_local_profile patches the service class entirely:
mock_service.render_job_script.return_value = "#!/bin/bash\necho test"
so the real render_job_script never runs. The test asserts on the echoed metadata lines above the script, which are produced before the crash would occur. Any test that mocks the renderer cannot catch a bug in rendering.
Fix
Add id=uuid4() to the local-branch constructors in both service modules, matching the Slurm branch. Worth also reconsidering whether the dry-run tests should exercise the real renderer — test_dry_run_renders_the_pinned_image (added in #493) does, which is how this surfaced.
Found while adding --image-ref (#492); unrelated to that change and pre-existing.
For a local profile,
blackfish run --dry-runfails with:The Slurm dry-run branch constructs its service with an explicit id, but the local branch does not:
render_job_scriptthen doesuuid=self.id.hex(server/services/base.py), andself.idis None because the object was never flushed to a database. Bothtext_generation.pyandspeech_recognition.pyhave the same asymmetry.Reproduced on
main:Why the tests miss it
tests/cli/test_cli_run.py::test_dry_run_local_profilepatches the service class entirely:so the real
render_job_scriptnever runs. The test asserts on the echoed metadata lines above the script, which are produced before the crash would occur. Any test that mocks the renderer cannot catch a bug in rendering.Fix
Add
id=uuid4()to the local-branch constructors in both service modules, matching the Slurm branch. Worth also reconsidering whether the dry-run tests should exercise the real renderer —test_dry_run_renders_the_pinned_image(added in #493) does, which is how this surfaced.Found while adding
--image-ref(#492); unrelated to that change and pre-existing.