-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Robert Szefler
committed
Dec 13, 2023
1 parent
96201f8
commit cb9c124
Showing
2 changed files
with
19 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import os | ||
import sys | ||
|
||
|
||
def process_setup(): | ||
if os.fork(): | ||
# Parent process, pid 1 in our deployment scenario. Wait (blocking - doesn't | ||
# utilitze any CPU) for the forked "main" process to exit (if it ever does) | ||
os.wait() | ||
# At this point we are sure no subprocesses are running, so we can safely | ||
# exit the pid 1 process, effectively causing the image to terminate. | ||
sys.exit(1) | ||
|
||
# Child process; create a process group to conveniently terminate the process | ||
# along with subprocesses if need be via killpg. Currently the only use is in | ||
# robusta.runner.config_loader.ConfigLoader.__reload_playbook_packages. | ||
os.setpgrp() |