Skip to content

Commit 2815085

Browse files
author
OutlyingWest
committed
getting stuck while reading pipes fixed
1 parent 57e52a4 commit 2815085

1 file changed

Lines changed: 27 additions & 39 deletions

File tree

src/scorep_jupyter/kernel.py

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -565,17 +565,16 @@ async def scorep_execute(
565565

566566
self.start_reading_scorep_process_streams(proc, is_multicell_final)
567567

568-
# In disk mode, subprocess already terminated
569-
# after dumping persistence to file
570-
if self.pershelper.mode == "disk":
571-
if proc.returncode:
572-
self.pershelper.postprocess()
573-
self.cell_output(
574-
"KernelError: Cell execution failed, cell persistence "
575-
"was not recorded.",
576-
"stderr",
577-
)
578-
return self.standard_reply()
568+
if proc.poll():
569+
self.pershelper.postprocess()
570+
self.log_error(
571+
KernelErrorCode.PERSISTENCE_LOAD_FAIL,
572+
direction="Score-P -> Jupyter",
573+
optional_hint = self.get_scorep_process_error_hint()
574+
575+
)
576+
return self.standard_reply()
577+
579578
# Ghost cell - load subprocess persistence back to Jupyter notebook
580579
# Run in a "silent" way to not increase cells counter
581580
reply_status_update = await super().do_execute(
@@ -587,42 +586,15 @@ async def scorep_execute(
587586
cell_id=cell_id,
588587
)
589588

590-
is_spinner_enabled = str(os.getenv(
591-
"SCOREP_JUPYTER_DISABLE_PROCESSING_ANIMATIONS"
592-
)).lower() not in ["true", "1", "t"]
593-
if is_spinner_enabled:
594-
scorep_process_error_hint = (
595-
"\nHint: If the animation spinner is active, "
596-
"runtime errors in Score-P cells might be hidden.\n"
597-
"Try disabling the spinner with "
598-
"%env SCOREP_JUPYTER_DISABLE_PROCESSING_ANIMATIONS=1 "
599-
"and/or check the log file for details."
600-
)
601-
else:
602-
scorep_process_error_hint = ""
603-
604589
if reply_status_update["status"] != "ok":
605590
self.log_error(
606591
KernelErrorCode.PERSISTENCE_LOAD_FAIL,
607592
direction="Score-P -> Jupyter",
608-
optional_hint = scorep_process_error_hint
593+
optional_hint = self.get_scorep_process_error_hint()
609594
)
610595
self.pershelper.postprocess()
611596
return reply_status_update
612597

613-
# In memory mode, subprocess terminates once jupyter_update is
614-
# executed and pipe is closed
615-
if self.pershelper.mode == "memory":
616-
if proc.poll():
617-
self.pershelper.postprocess()
618-
self.log_error(
619-
KernelErrorCode.PERSISTENCE_LOAD_FAIL,
620-
direction="Score-P -> Jupyter",
621-
optional_hint = scorep_process_error_hint
622-
623-
)
624-
return self.standard_reply()
625-
626598
# Determine directory to which trace files were saved by Score-P
627599
scorep_folder = ""
628600
if "SCOREP_EXPERIMENT_DIRECTORY" in os.environ:
@@ -778,6 +750,22 @@ def read_scorep_stream(
778750
with lock:
779751
process_line(line)
780752

753+
@staticmethod
754+
def get_scorep_process_error_hint():
755+
is_spinner_enabled = str(os.getenv(
756+
"SCOREP_JUPYTER_DISABLE_PROCESSING_ANIMATIONS"
757+
)).lower() not in ["true", "1", "t"]
758+
scorep_process_error_hint = ""
759+
if is_spinner_enabled:
760+
scorep_process_error_hint = (
761+
"\nHint: If the animation spinner is active, "
762+
"runtime errors in Score-P cells might be hidden.\n"
763+
"Try disabling the spinner with "
764+
"%env SCOREP_JUPYTER_DISABLE_PROCESSING_ANIMATIONS=1 "
765+
"and/or check the log file for details."
766+
)
767+
return scorep_process_error_hint
768+
781769
async def do_execute(
782770
self,
783771
code,

0 commit comments

Comments
 (0)