Skip to content

fix(argo): propagate nodeSelector/tolerations to error and exit hooks - #3371

Open
Shriprasad-P wants to merge 1 commit into
Netflix:masterfrom
Shriprasad-P:cursor/fix-argo-hook-node-selector-tolerations-0882
Open

fix(argo): propagate nodeSelector/tolerations to error and exit hooks#3371
Shriprasad-P wants to merge 1 commit into
Netflix:masterfrom
Shriprasad-P:cursor/fix-argo-hook-node-selector-tolerations-0882

Conversation

@Shriprasad-P

Copy link
Copy Markdown

Fixes

Fixes #3309

Summary

Propagate nodeSelector and tolerations into the Argo error-msg-capture-hook and @exit_hook templates so hooks can schedule on the same nodes as workflow steps.

Test plan

  • Added compilation tests covering with/without nodeSelector+tolerations
  • Verified hooks inherit resources when env configuration is present

…s propagation

Fixes Netflix#3309

- Add .node_selectors() and .tolerations() calls to error-msg-capture-hook template
  to match step pod configuration
- Add node_selectors and tolerations support to ContainerHook and _Template classes
  in exit_hooks.py for @exit_hook decorators
- Update ContainerHook instantiations to pass nodeSelector and tolerations from
  resources dictionary
- Add comprehensive tests to verify nodeSelector and tolerations propagate correctly
  to error hook templates, matching step templates
- Tests verify both presence and absence of configuration

The error-msg-capture-hook and @exit_hook templates now inherit nodeSelector
and tolerations consistently with regular step pods, allowing these hooks to
run on the same nodes as the workflow steps.
@greptile-apps

greptile-apps Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Propagates Kubernetes scheduling constraints to Argo-generated hook templates.

  • Adds nodeSelector and tolerations support to ContainerHook.
  • Applies these settings to success, error, and error-message capture hooks.
  • Adds compilation coverage for the error-message capture hook with and without scheduling configuration.

Confidence Score: 5/5

The implementation appears safe to merge, with only the non-blocking absence of compilation coverage for user-defined exit-hook templates remaining.

No new issue was introduced since the previous review. The previous test-coverage finding remains outstanding because the tests still deploy a flow without @exit_hook and therefore do not exercise the changed success and error ContainerHook paths.

Important Files Changed

Filename Overview
metaflow/plugins/argo/argo_workflows.py Passes workflow-level node selectors and tolerations into generated success, error, and error-message capture hook templates.
metaflow/plugins/argo/exit_hooks.py Extends container hooks to serialize optional Kubernetes node selectors and tolerations.
test/ux/core/test_argo_compilation.py Tests error-message capture hook scheduling configuration, but the previously reported lack of user-defined exit-hook coverage remains.

Reviews (2): Last reviewed commit: "Fix Argo workflows error-msg-capture-hoo..." | Re-trigger Greptile


deployed_flow = (
Deployer(
flow_file=_resolve_flow_path("basic/helloworld.py"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Exit hooks remain untested

These compilation tests deploy basic/helloworld.py, which has no @exit_hook, and inspect only error-msg-capture-hook. They therefore never exercise the changed ContainerHook paths that generate user-defined success-* and error-* templates. Add an @exit_hook fixture and verify that both templates inherit nodeSelector and tolerations; otherwise this propagation behavior could regress undetected.

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!

@Shriprasad-P
Shriprasad-P force-pushed the cursor/fix-argo-hook-node-selector-tolerations-0882 branch from 02d57c6 to 845fcd8 Compare September 12, 2026 19:28
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.

Argo workflows error-msg-capture-hook nodeSelector and tolerations propagation

1 participant