Skip to content

Commit

Permalink
Allow for null command when building k8s job (#14920)
Browse files Browse the repository at this point in the history
  • Loading branch information
cicdw authored Aug 14, 2024
1 parent 95da8e9 commit 318eaf2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/prefect/infrastructure/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def _shortcut_customizations(self) -> JsonPatch:
"prefect-job-"
# We generate a name using a hash of the primary job settings
+ stable_hash(
*self.command,
*self.command if self.command else "",
*self.env.keys(),
*[v for v in self.env.values() if v is not None],
)
Expand Down
8 changes: 8 additions & 0 deletions tests/infrastructure/test_kubernetes_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ def test_building_a_job_is_idempotent():
assert first_time == second_time


def test_building_a_job_with_null_command():
"""
Regression test for https://github.com/PrefectHQ/prefect/issues/14918
"""
k8s_job = KubernetesJob(command=None)
k8s_job.build_job()


def test_creates_job_by_building_a_manifest(
mock_k8s_batch_client,
mock_k8s_client,
Expand Down

0 comments on commit 318eaf2

Please sign in to comment.