Skip to content

fix(kf-tensorflow): handle RunPolicy without clean_pod_policy - #3485

Open
pcbeingused333 wants to merge 1 commit into
flyteorg:masterfrom
pcbeingused333:fix/kf-tensorflow-run-policy-clean-pod
Open

pcbeingused333 wants to merge 1 commit into
flyteorg:masterfrom
pcbeingused333:fix/kf-tensorflow-run-policy-clean-pod

Conversation

@pcbeingused333

Copy link
Copy Markdown

Why are the changes needed?

RunPolicy.clean_pod_policy in the kf-tensorflow plugin defaults to None, but TensorflowFunctionTask._convert_run_policy always read run_policy.clean_pod_policy.value. A TfJob whose RunPolicy leaves it unset, for example RunPolicy(ttl_seconds_after_finished=100), failed at serialization with AttributeError: 'NoneType' object has no attribute 'value'.

What changes were proposed in this pull request?

_convert_run_policy now checks that clean_pod_policy is set before it reads .value, as the kf-pytorch and kf-mpi plugins already do. Explicitly set values are converted as before.

How was this patch tested?

Added test_tensorflow_task_run_policy_without_clean_pod_policy in plugins/flytekit-kf-tensorflow/tests/test_tensorflow_task.py. It fails with the AttributeError before the change and passes after. The plugin's test suite passes (5 tests).

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Disclosure: this change was prepared with an AI coding agent (Claude).

_convert_run_policy dereferenced clean_pod_policy.value even though the field
defaults to None, so any RunPolicy that omitted it (e.g. only setting
ttl_seconds_after_finished) raised AttributeError at serialization time.
Guard it like the kf-pytorch and kf-mpi plugins do.

Signed-off-by: Alex Castillo <alex.castillog33@gmail.com>
@welcome

welcome Bot commented Nov 5, 2026

Copy link
Copy Markdown

Thank you for opening this pull request! 🙌

These tips will help get your PR across the finish line:

  • Most of the repos have a PR template; if not, fill it out to the best of your knowledge.
  • Sign off your commits (Reference: DCO Guide).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant