Skip to content

Commit 6565033

Browse files
authored
Exit memory monitor with the same exit code as subprocess (#3222)
### Changes - memory monitor should exit with the same exit code as subprocess run for measurements ### Reason for changes - we got some issues in validation, where convert-cli failed and pipelines still passed, as memory_monitor returned with exit code 0 ### Related tickets 161453
1 parent 1a60d3f commit 6565033

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/memory_monitor.py

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import logging
1414
import queue
1515
import subprocess
16+
import sys
1617
import threading
1718
import time
1819
from enum import Enum
@@ -362,6 +363,7 @@ def _subtract_first_element(data):
362363

363364
with subprocess.Popen(" ".join(args.executable), shell=True) as p:
364365
p.wait()
366+
exit_code = p.returncode
365367

366368
# Stop addition of new values as soon as possible
367369
for mm in memory_monitors:
@@ -380,3 +382,5 @@ def _subtract_first_element(data):
380382
summary_data.append([mm.memory_type.value, fz, f"{int(max(memory_values))} {mm.memory_unit.value}"])
381383
print("\nMemory summary:")
382384
print(tabulate(summary_data, headers=["Memory type", "From zero", "Peak value"]))
385+
386+
sys.exit(exit_code)

0 commit comments

Comments
 (0)