Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Windows #29935

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion airflow/jobs/local_task_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,10 @@ def heartbeat_callback(self, session=None):
recorded_pid = psutil.Process(ti.pid).ppid()
same_process = recorded_pid == current_pid

if recorded_pid is not None and not same_process:
if not IS_WINDOWS and recorded_pid is not None and not same_process:
uranusjr marked this conversation as resolved.
Show resolved Hide resolved
# On Windows this sometimes does not work properly as the system seems to change
# PIDs in some situations. Since this prohibits using Windows systems for task
# execution, this check is skipped until the cause for this can be determined.
self.log.warning(
"Recorded pid %s does not match the current pid %s", recorded_pid, current_pid
)
Expand Down
4 changes: 3 additions & 1 deletion airflow/utils/process_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def on_terminate(p):
returncodes[p.pid] = p.returncode

def signal_procs(sig):
if IS_WINDOWS:
return
try:
logger.info("Sending the signal %s to group %s", sig, process_group_id)
os.killpg(process_group_id, sig)
Expand Down Expand Up @@ -108,7 +110,7 @@ def signal_procs(sig):
else:
raise

if process_group_id == os.getpgid(0):
if not IS_WINDOWS and process_group_id == os.getpgid(0):
raise RuntimeError("I refuse to kill myself")

try:
Expand Down