Skip to content

Commit 02e619c

Browse files
authored
Merge pull request #244 from cooling-singapore/xx-fix-issue-with-unflushed-lines
Add delay to allow for unflushed lines to be read
2 parents 8407084 + a9f8f00 commit 02e619c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

saas/rti/adapters/base.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ def get_line_count(file_path: str) -> int:
212212
n_lines = wc_result.stdout.decode('utf-8').splitlines()[0].split()[0]
213213
return int(n_lines)
214214

215+
exitcode_found = False
215216
while True:
216217
try:
217218
# get the number of lines in stdout and stderr
@@ -227,7 +228,14 @@ def get_line_count(file_path: str) -> int:
227228
# do we have an exit code file? (it is only generated when the process has terminated)
228229
if check_if_path_exists(paths['exitcode'], ssh_credentials=ssh_credentials, timeout=10):
229230
logger.info(f"end monitoring {pid} on {'REMOTE' if ssh_credentials else 'LOCAL'} machine.")
230-
break
231+
232+
if not exitcode_found:
233+
# set the flag, wait a second to allow stdout/stderr to flush, then give it another round
234+
exitcode_found = True
235+
time.sleep(1.0)
236+
continue
237+
else:
238+
break
231239

232240
# do we have new STDOUT lines to process?
233241
if d_stdout_lines > 0:

0 commit comments

Comments
 (0)