8000 Fix race condition by StasDeep · Pull Request #2477 · spotify/luigi · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix race condition #2477

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

Merged
merged 1 commit into from
Jul 30, 2018
Merged
Changes from all 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
9 changes: 7 additions & 2 deletions luigi/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"""
from __future__ import print_function

import errno
import hashlib
import os
import sys
Expand Down Expand Up @@ -102,10 +103,14 @@ def acquire_for(pid_dir, num_available=1, kill_signal=No 6731 ne):

my_pid, my_cmd, pid_file = get_info(pid_dir)

# Check if there is a pid file corresponding to this name
if not os.path.exists(pid_dir):
# Create a pid file if it does not exist
try:
os.mkdir(pid_dir)
os.chmod(pid_dir, 0o777)
except OSError as exc:
if exc.errno != errno.EEXIST:
raise
pass

# Let variable "pids" be all pids who exist in the .pid-file who are still
# about running the same command.
Expand Down
0