Skip to content

Fix #2981: Add Windows platform guard for SIGALRM in timeout_decorator and card_cli#3144

Open
k-kj0 wants to merge 4 commits intoNetflix:masterfrom
k-kj0:master
Open

Fix #2981: Add Windows platform guard for SIGALRM in timeout_decorator and card_cli#3144
k-kj0 wants to merge 4 commits intoNetflix:masterfrom
k-kj0:master

Conversation

@k-kj0
Copy link
Copy Markdown

@k-kj0 k-kj0 commented Apr 22, 2026

Fixes #2981

Added sys.platform == "win32" guards to:

  • metaflow/plugins/timeout_decorator.py
  • metaflow/plugins/cards/card_cli.py

Both files used signal.SIGALRM which is POSIX-only and crashes on Windows.
This implements Option B from the issue: a clear early error instead of a
cryptic AttributeError mid-run.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 22, 2026

Greptile Summary

This PR adds sys.platform == "win32" guards to both timeout_decorator.py and card_cli.py to prevent a cryptic AttributeError when signal.SIGALRM is used on Windows. The import sys statement is correctly placed at the module level in both files, and the guard blocks are properly indented inside their respective function bodies — the issues flagged in previous review threads are fully resolved.

Confidence Score: 5/5

This PR is safe to merge — it adds simple, correct Windows guards with no logic changes to existing POSIX paths.

Both files have correct module-level imports, proper indentation, and the guard fires before any SIGALRM call. The task execution flow confirms task_post_step (which calls signal.alarm(0)) is unreachable on Windows after the guard raises in task_pre_step. No P0/P1 issues found.

No files require special attention.

Important Files Changed

Filename Overview
metaflow/plugins/timeout_decorator.py Adds import sys at module level and a Windows guard in task_pre_step before SIGALRM calls; indentation and placement are correct.
metaflow/plugins/cards/card_cli.py Adds import sys at module level and a Windows guard at the top of the timeout() context manager before signal calls; indentation and placement are correct.

Reviews (3): Last reviewed commit: "Update card_cli.py" | Re-trigger Greptile

Comment thread metaflow/plugins/cards/card_cli.py Outdated
Comment thread metaflow/plugins/timeout_decorator.py Outdated
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.

[Bug] @timeout decorator crashes on Windows — uses SIGALRM which is Unix-only

1 participant