Repository navigation
Fix SSHRemoteJobOperator on Windows hosts - #73352
Merged
kaxil merged 7 commits intoNov 4, 2026
Merged
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
timo-astronomer
marked this pull request as ready for review
September 18, 2026 18:18
kaxil
reviewed
Sep 18, 2026
eladkal
self-requested a review
September 19, 2026 06:45
This was referenced Oct 15, 2026
28 of 93 tasks
Contributor
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
Follow-up fixes on top of the Windows wrapper rewrite, each checked on
windows-2022 and windows-latest runners (Windows PowerShell 5.1):
- Inline the command into the job script as written. The script travels
in a verbatim here-string, so backtick escaping reached PowerShell
literally and broke quoted arguments.
- Run the command inside & { } so every statement's output is logged,
not only the last one's.
- Write the log through a shared, auto-flushed UTF-8 writer. Add-Content
kept the file locked until the command ended, so the trigger could not
tail it while the job ran.
- Fail the submission when Win32_Process.Create cannot start the job,
and start it in the SSH session's working directory, not System32.
- Pass job paths to PowerShell literally: single-quote everything except
a leading $env:NAME, double PowerShell's typographic quotes, and use
-LiteralPath so brackets are not read as wildcards. The same quoting
now applies to environment values.
…nging The command is written to cmd.ps1 and called from the job script inside try/catch/finally, so the exit code is recorded however the command ends: an inline `exit N` keeps N (skip_on_exit_code depends on it), a throw or a parse error fails the job with the message in the log, and a crashed process's negative code is recorded unsigned so the trigger accepts it. A here-string in the command no longer ends the wrapper's own. The job script is started with -Command instead of -File, so a Group Policy that only allows signed scripts cannot stop the job's bookkeeping; under such a policy the job fails with the policy error in its log. *>&1 keeps Write-Host and warnings, and objects are formatted the way a console shows them. The wrapper stops on the first setup error and reports it on stderr, so a bad remote_base_dir fails the submission instead of reporting a job that never starts. A leading $Env:NAME is expanded in any casing. Checked on windows-2022 and windows-latest runners, including a machine policy of AllSigned.
The log tail now writes the chunk to stdout as UTF-8 bytes. Printed as a PowerShell string, it was re-encoded in the SSH session's console code page (437 on a default install), which the trigger's strict UTF-8 decoding rejects, so any non-ASCII log line put the trigger into a reconnect loop until the task failed. The job script opens its log through a local path, so an environment entry named LOG_FILE can no longer redirect it, and the launch command quotes the already-resolved job directory instead of re-expanding $env:NAME in the new process's environment. Document the Windows exit code rules, the Group Policy requirement and the inline command length that fits through cmd.exe.
Emulate the wrapper's runtime quoting of the job directory and read the launch command back, pin the log tail's byte write, and document what shares the cmd.exe command line budget on Windows.
kaxil
enabled auto-merge (squash)
November 4, 2026 02:07
kaxil
disabled auto-merge
November 4, 2026 11:39
kaxil
approved these changes
Nov 4, 2026
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
2 tasks done
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix SSHRemoteJobOperator for windows.
Current code fails, since paths are enclosed in single quotes and PowerShell requires double quotes.
In addition, command fails to start, because stdout and stderr are redirected to the same file.
Both issues are fixed in this commit.
In addition, the payload is decreased by using variables for base path instead of writing the same, long path multiple times.
Command is written to
job.ps1file for execution to avoid double encoding.Finally, command is executed as
Win32_Processto prevent in from dying when the SSH session terminates.Everything is tested with this environment
Was generative AI tooling used to co-author this PR?