From 7a126e4978abf1f8d6e241d6248f163077b118af Mon Sep 17 00:00:00 2001 From: Bolun Thompson Date: Sat, 11 Jan 2025 17:59:57 +0000 Subject: [PATCH 1/2] Fix: inform_daemon_exit on assertion exit Otherwise, --assert_compiler_success hangs. --assert_all_regions_parallelizable doesn't fail, but I also copied the change there. The tests using the flag pass. Signed-off-by: Bolun Thompson --- .../pash_prepare_call_compiler.sh | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/compiler/orchestrator_runtime/pash_prepare_call_compiler.sh b/compiler/orchestrator_runtime/pash_prepare_call_compiler.sh index e6294ec9e..2a2933a14 100644 --- a/compiler/orchestrator_runtime/pash_prepare_call_compiler.sh +++ b/compiler/orchestrator_runtime/pash_prepare_call_compiler.sh @@ -2,6 +2,13 @@ ## OUTPUT: When it completes it sets "$pash_script_to_execute" +## Let daemon know that this region is done +function inform_daemon_exit () { + ## Send to daemon + msg="Exit:${process_id}" + daemon_response=$(pash_communicate_daemon_just_send "$msg") +} + ## Only needed for expansion export pash_input_args=( "$@" ) @@ -66,17 +73,20 @@ pash_redir_output echo "$$: (2) Compiler exited with code: $pash_runtime_return_ ## only when --assert_all_regions_parallellizable is used do we care about all regions being parallelizable if [ "$pash_all_region_parallelizable" -ne 0 ] && [ "$pash_assert_all_regions_parallelizable_flag" -eq 1 ]; then pash_redir_output echo "$$: ERROR: (2) Compiler failed with error code because some regions were not parallelizable: $pash_all_region_parallelizable while assert_all_regions_parallelizable_flag was enabled! Exiting PaSh..." + inform_daemon_exit exit 1 fi if [ "$pash_runtime_return_code" -ne 0 ] && [ "$pash_assert_all_regions_parallelizable_flag" -eq 1 ]; then pash_redir_output echo "$$: ERROR: (2) Compiler failed with error code: $pash_runtime_return_code while assert_all_regions_parallelizable_flag was enabled! Exiting PaSh..." + inform_daemon_exit exit 1 fi -## for pash_assert_compiler_success_flag, exit when return code is 0 (general exception caught) and not when all regions are parallelizable +## for pash_assert_compiler_success_flag, exit when return code is not 0 (general exception caught) and when all regions are parallelizable if [ "$pash_runtime_return_code" -ne 0 ] && [ "$pash_all_region_parallelizable" -eq 0 ] && [ "$pash_assert_compiler_success_flag" -eq 1 ]; then pash_redir_output echo "$$: ERROR: (2) Compiler failed with error code: $pash_runtime_return_code while assert_compiler_success was enabled! Exiting PaSh..." + inform_daemon_exit exit 1 fi @@ -93,11 +103,3 @@ if [ "$pash_runtime_return_code" -ne 0 ] || [ "$pash_dry_run_compiler_flag" -eq else export pash_script_to_execute="${pash_compiled_script_file}" fi - -## Let daemon know that this region is done -function inform_daemon_exit () { - ## Send to daemon - msg="Exit:${process_id}" - daemon_response=$(pash_communicate_daemon_just_send "$msg") -} - From 49834acb153e26f36810cf5b8f4a7dfe9d02198f Mon Sep 17 00:00:00 2001 From: Bolun Thompson Date: Sat, 11 Jan 2025 18:53:09 +0000 Subject: [PATCH 2/2] Fix: correctly parse "is parallelizable" output Signed-off-by: Bolun Thompson --- compiler/orchestrator_runtime/pash_prepare_call_compiler.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/orchestrator_runtime/pash_prepare_call_compiler.sh b/compiler/orchestrator_runtime/pash_prepare_call_compiler.sh index 2a2933a14..ec11d137a 100644 --- a/compiler/orchestrator_runtime/pash_prepare_call_compiler.sh +++ b/compiler/orchestrator_runtime/pash_prepare_call_compiler.sh @@ -40,7 +40,8 @@ pash_redir_output echo "$$: (2) Before asking the daemon for compilation..." msg="Compile:${pash_compiled_script_file}| Variable File:${pash_runtime_shell_variables_file}| Input IR File:${pash_input_ir_file}" daemon_response=$(pash_communicate_daemon "$msg") # Blocking step, daemon will not send response until it's safe to continue -if [[ "$daemon_response" == *"not all regions are parallelizable"* ]]; then +# WARNING: finicky! +if [[ "$daemon_response" == *"not"*"parallelizable"* ]]; then pash_all_region_parallelizable=1 else pash_all_region_parallelizable=0