Skip to content

Commit

Permalink
Responding to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Soren Ptak committed Jul 11, 2023
1 parent 624268a commit 2019c40
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions executable-monitor/executable-monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@

# Create two file descriptors. The subprocess writes to one, the parent task reads from the other
# This is a workaround to avoid the fact that calling readline() on the stdout of the subprocess is
# a blocking call. Where if the subproces is running but hasn't printed anything, readline will never time out.
# The approach uses the underlying file system to rely on an end of file character to ensure that it does not hang.
# a blocking call. Where if the subprocess is running but hasn't printed anything, readline will never time out.
# The approach uses the underlying file system to not block on data that hasn't been written.
WriteOutputFile = open("output.log", "w")
ReadOutputFile = open("output.log", "r")

Expand Down Expand Up @@ -141,16 +141,16 @@
# Check for timeout
cur_time_seconds = time.time()
if cur_time_seconds >= timeout_time_seconds:
logging.info(f"TIMEOUT OF {args.timeout_seconds} SECONDS HIT\n")
logging.info(f"TIMEOUT OF {args.timeout_seconds} SECONDS HIT")
timeout_occurred = True
exit_condition_met = True

if not exe_exitted:
logging.info(f"EXECUTABLE DID NOT EXIT, MANUALLY KILLING NOW\n")
logging.info(f"EXECUTABLE DID NOT EXIT, MANUALLY KILLING NOW")
exe.kill()

if not exit_condition_met:
logging.info(f"PARSING REST OF LOG\n")
logging.info(f"PARSING REST OF LOG")
# Capture remaining output and check for the successful line
for exe_stdout_line in ReadOutputFile.readlines():
logging.info(exe_stdout_line)
Expand All @@ -163,7 +163,7 @@
WriteOutputFile.close()
ReadOutputFile.close()

logging.info("END OF DEVICE OUTPUT\n")
logging.info("END OF DEVICE OUTPUT")

logging.info("EXECUTABLE RUN SUMMARY:\n")

Expand Down

0 comments on commit 2019c40

Please sign in to comment.