feat: ignore @kubernetes for local runs and add priority_class option#3103
feat: ignore @kubernetes for local runs and add priority_class option#3103
Conversation
When @kubernetes is defined statically in source code and the user runs locally (e.g., `python flow.py run` with local datastore), the decorator now acts like @resources -- providing resource hints without redirecting execution to Kubernetes. This fixes #2588. Add priority_class parameter to @kubernetes decorator, which sets priorityClassName on the pod spec for K8s PriorityClass scheduling. Supported in direct K8s jobs, jobsets, and Argo Workflows. Configurable via METAFLOW_KUBERNETES_PRIORITY_CLASS. This fixes #1752.
- test_kubernetes.py imported KubernetesException from kube_utils but the decorator raises the one from kubernetes.py (different class) - Skip test_hello_conda on sfn-batch: conda env resolution during step-functions create not supported in CI localbatch setup
Greptile SummaryThis PR adds two features to the Confidence Score: 5/5Safe to merge; no P0/P1 issues found All changed code paths are logically correct. No files require special attention Important Files Changed
Reviews (1): Last reviewed commit: "fix: unit test KubernetesException impor..." | Re-trigger Greptile |
| https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/ | ||
| security_context: Dict[str, Any], optional, default None |
There was a problem hiding this comment.
Missing blank line in docstring
The priority_class parameter block is missing the blank line separator before security_context that all other parameters have. This breaks the visual consistency of the docstring.
| https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/ | |
| security_context: Dict[str, Any], optional, default None | |
| https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/ | |
| security_context: Dict[str, Any], optional, default None |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
@kubernetesis defined statically and the user runs locally (python flow.py runwith local datastore), the decorator now acts like@resources— providing resource hints without redirecting execution to Kubernetes. Fixes @kubernetes decorator should be ignored when running flows locally #2588.priorityClassNameon the pod spec for K8s PriorityClass scheduling. Supported in direct K8s jobs, jobsets, and Argo Workflows. Configurable viaMETAFLOW_KUBERNETES_PRIORITY_CLASS. Fixes Add a priority class option for the kubernetes flow decorator #1752.Test plan
test/unit/test_kubernetes_priority_class.py— unit tests for priority_class parameter handling🤖 Generated with Claude Code