From fa466358473d99380783d5add5a67364a4156893 Mon Sep 17 00:00:00 2001 From: Kurt Biery Date: Thu, 12 Mar 2026 14:56:11 -0500 Subject: [PATCH 1/3] Temporary change to test the capturing of DRUNC output so that we can pass it back to our pytest modules (integtests). --- src/integrationtest/integrationtest_drunc.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/integrationtest/integrationtest_drunc.py b/src/integrationtest/integrationtest_drunc.py index 4ff1973..8a88c68 100755 --- a/src/integrationtest/integrationtest_drunc.py +++ b/src/integrationtest/integrationtest_drunc.py @@ -551,6 +551,8 @@ class RunResult: print( "++++++++++ DRUNC Run BEGIN ++++++++++", flush=True ) # Apparently need to flush before subprocess.run + print("", flush=True) + print("*** Temporarily capturing the DRUNC output (will print it out at the end) ***", flush=True) result = RunResult() time_before = time.time() result.completed_process = subprocess.run( @@ -561,10 +563,17 @@ class RunResult: + [str(create_config_files.config.session)] + [str(create_config_files.config.session_name if create_config_files.config.session_name else create_config_files.config.session)] + command_list, - cwd=run_dir, + cwd=run_dir, capture_output=True, text=True ) time_after = time.time() + print("", flush=True) + print("*** DRUNC stdout:", flush=True) + print(result.completed_process.stdout) + print("", flush=True) + print("*** DRUNC stderr:", flush=True) + print(result.completed_process.stderr) + if connsvc_obj is not None: time.sleep(1) connsvc_obj.send_signal(2) From d80e5065f0f96def804d514d4a2c7e3a1726cddd Mon Sep 17 00:00:00 2001 From: Kurt Biery Date: Mon, 16 Mar 2026 15:01:31 -0500 Subject: [PATCH 2/3] Next step in capturing run control output so that we can examine it in our validation checking. --- src/integrationtest/integrationtest_drunc.py | 41 ++++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/src/integrationtest/integrationtest_drunc.py b/src/integrationtest/integrationtest_drunc.py index 8a88c68..b0906f1 100755 --- a/src/integrationtest/integrationtest_drunc.py +++ b/src/integrationtest/integrationtest_drunc.py @@ -551,28 +551,45 @@ class RunResult: print( "++++++++++ DRUNC Run BEGIN ++++++++++", flush=True ) # Apparently need to flush before subprocess.run - print("", flush=True) - print("*** Temporarily capturing the DRUNC output (will print it out at the end) ***", flush=True) result = RunResult() time_before = time.time() - result.completed_process = subprocess.run( + rc_process = subprocess.Popen( [dunerc] + dunerc_option_strings - + [process_manager_type] # 29-Dec-2025, KAB: support for ProcMgr choices + + [process_manager_type] + [str(create_config_files.config_file)] + [str(create_config_files.config.session)] + [str(create_config_files.config.session_name if create_config_files.config.session_name else create_config_files.config.session)] + command_list, - cwd=run_dir, capture_output=True, text=True + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + text=True, + bufsize=1, + cwd=run_dir ) - time_after = time.time() - print("", flush=True) - print("*** DRUNC stdout:", flush=True) - print(result.completed_process.stdout) - print("", flush=True) - print("*** DRUNC stderr:", flush=True) - print(result.completed_process.stderr) + full_output = "" + for line in rc_process.stdout: + #if "Booting session" in line or "Running transition" in line \ + # or ("wait" in line and "running" in line) or "exit code" in line: + print(line, end='', flush=True) + full_output += line + + rc_process.communicate() + proc_returncode = rc_process.returncode + + result.completed_process = subprocess.CompletedProcess( + [dunerc] + + dunerc_option_strings + + [process_manager_type] + + [str(create_config_files.config_file)] + + [str(create_config_files.config.session)] + + [str(create_config_files.config.session_name if create_config_files.config.session_name else create_config_files.config.session)] + + command_list, + returncode=proc_returncode, + stdout=full_output + ) + time_after = time.time() if connsvc_obj is not None: time.sleep(1) From 91394ed9326f8bf94cd113307ccf8b32147931ba Mon Sep 17 00:00:00 2001 From: Kurt Biery Date: Wed, 25 Mar 2026 08:46:36 -0500 Subject: [PATCH 3/3] Added comments for the changes to capture the run control console output. --- src/integrationtest/integrationtest_drunc.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/integrationtest/integrationtest_drunc.py b/src/integrationtest/integrationtest_drunc.py index b0906f1..65bfc5a 100755 --- a/src/integrationtest/integrationtest_drunc.py +++ b/src/integrationtest/integrationtest_drunc.py @@ -553,6 +553,8 @@ class RunResult: ) # Apparently need to flush before subprocess.run result = RunResult() time_before = time.time() + # 25-Mar-2026, KAB: use subprocess.Popen to manage the run control session so that we can + # capture the console output and pass it back to the user for inspection and validation. rc_process = subprocess.Popen( [dunerc] + dunerc_option_strings @@ -568,16 +570,19 @@ class RunResult: cwd=run_dir ) + # print out each line of captured output, as well as add it to the string that we + # pass back to the user full_output = "" for line in rc_process.stdout: - #if "Booting session" in line or "Running transition" in line \ - # or ("wait" in line and "running" in line) or "exit code" in line: print(line, end='', flush=True) full_output += line rc_process.communicate() proc_returncode = rc_process.returncode + # construct a CompletedProcess instance to be passed back to the user. In this way, + # user code does not need to change in response to the change in this code from + # using subprocess.run() to subprocess.Popen(). result.completed_process = subprocess.CompletedProcess( [dunerc] + dunerc_option_strings