Skip to content
Snippets Groups Projects
Commit 0b5809c4 authored by Tristan Van Berkom's avatar Tristan Van Berkom
Browse files

utils.py: Added _is_main_process()

A helper function to identify if we are running in the main process
or not.
parent 888f0b9f
No related branches found
No related tags found
1 merge request!376serialize writes to workspaces.yml
......@@ -536,6 +536,18 @@ def save_file_atomic(filename, mode='w', *, buffering=-1, encoding=None,
# to distinguish between a kwarg set to None and an unset kwarg.
_sentinel = object()
# Main process pid
_main_pid = os.getpid()
# _is_main_process()
#
# Return whether we are in the main process or not.
#
def _is_main_process():
assert _main_pid is not None
return os.getpid() == _main_pid
# Recursively remove directories, ignoring file permissions as much as
# possible.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment