summaryrefslogtreecommitdiff
path: root/buildscripts/buildlogger.py
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2017-02-13 20:27:02 -0500
committerMax Hirschhorn <max.hirschhorn@mongodb.com>2017-02-13 20:27:02 -0500
commit6f6546be9b9554753d5cbf765b315817cb2eb45b (patch)
treec7ff66c7d089fb3869aee69ca64335e5c34e89bc /buildscripts/buildlogger.py
parentc9a76918c01d86d08ee102ebeedd79e2911bb1ce (diff)
downloadmongo-6f6546be9b9554753d5cbf765b315817cb2eb45b.tar.gz
SERVER-23959 Conditionally create a Windows job object in smoke.py.v2.6
Changes smoke.py to (like resmoke.py) only create a job object if the Python process isn't already inside of one. This allows the Evergreen agent to create a job object for managing processes spawned by a task to ensure they are cleaned up reliably. (cherry picked from commit dd6acd3551dc9e409a863e517609f2509a0f87f7)
Diffstat (limited to 'buildscripts/buildlogger.py')
-rw-r--r--buildscripts/buildlogger.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/buildscripts/buildlogger.py b/buildscripts/buildlogger.py
index a31b3e2dfa1..0dfb5ab5f8c 100644
--- a/buildscripts/buildlogger.py
+++ b/buildscripts/buildlogger.py
@@ -238,6 +238,12 @@ def run_and_echo(command):
"""
proc = subprocess.Popen(command)
+ # We write the pid of the spawned process as the first line of buildlogger.py's stdout because
+ # smoke.py expects to use it to terminate processes individually if already running inside a job
+ # object.
+ sys.stdout.write("[buildlogger.py] pid: %d\n" % (proc.pid))
+ sys.stdout.flush()
+
def handle_sigterm(signum, frame):
try:
proc.send_signal(signum)
@@ -415,6 +421,12 @@ def loop_and_callback(command, callback):
stderr=subprocess.STDOUT,
)
+ # We write the pid of the spawned process as the first line of buildlogger.py's stdout because
+ # smoke.py expects to use it to terminate processes individually if already running inside a job
+ # object.
+ sys.stdout.write("[buildlogger.py] pid: %d\n" % (proc.pid))
+ sys.stdout.flush()
+
def handle_sigterm(signum, frame):
try:
proc.send_signal(signum)