Skip to content

Commit e314bce

Browse files
author
OutlyingWest
committed
hint message improved; logging dir renamed to logs_scorep_jupyter
1 parent 748f4ef commit e314bce

4 files changed

Lines changed: 25 additions & 19 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ __pycache__/
33
.userpersistency
44
build
55
logging
6+
kernel_logs
67
**/*.egg-info

src/scorep_jupyter/kernel.py

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from scorep_jupyter.kernel_messages import (
1818
KernelErrorCode,
1919
KERNEL_ERROR_MESSAGES,
20+
get_scorep_process_error_hint,
2021
)
2122
from scorep_jupyter.userpersistence import PersHelper, scorep_script_name
2223
from scorep_jupyter.userpersistence import magics_cleanup, create_busy_spinner
@@ -570,7 +571,7 @@ async def scorep_execute(
570571
self.log_error(
571572
KernelErrorCode.PERSISTENCE_LOAD_FAIL,
572573
direction="Score-P -> Jupyter",
573-
optional_hint = self.get_scorep_process_error_hint()
574+
optional_hint = get_scorep_process_error_hint()
574575

575576
)
576577
return self.standard_reply()
@@ -590,7 +591,7 @@ async def scorep_execute(
590591
self.log_error(
591592
KernelErrorCode.PERSISTENCE_LOAD_FAIL,
592593
direction="Score-P -> Jupyter",
593-
optional_hint = self.get_scorep_process_error_hint()
594+
optional_hint = get_scorep_process_error_hint()
594595
)
595596
self.pershelper.postprocess()
596597
return reply_status_update
@@ -750,22 +751,6 @@ def read_scorep_stream(
750751
with lock:
751752
process_line(line)
752753

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-
769754
async def do_execute(
770755
self,
771756
code,

src/scorep_jupyter/kernel_messages.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
import os
12
from enum import Enum, auto
23

4+
from .logging_config import LOGGING
5+
36

47
class KernelErrorCode(Enum):
58
PERSISTENCE_SETUP_FAIL = auto()
@@ -36,3 +39,20 @@ class KernelErrorCode(Enum):
3639
"Persistence not recorded (marshaller: {marshaller})."
3740
),
3841
}
42+
43+
44+
def get_scorep_process_error_hint():
45+
is_spinner_enabled = str(os.getenv(
46+
"SCOREP_JUPYTER_DISABLE_PROCESSING_ANIMATIONS"
47+
)).lower() not in ["true", "1", "t"]
48+
scorep_process_error_hint = ""
49+
if is_spinner_enabled:
50+
scorep_process_error_hint = (
51+
"\nHint: If the animation spinner is active, "
52+
"runtime errors in Score-P cells might be hidden.\n"
53+
"Try disabling the spinner with "
54+
"%env SCOREP_JUPYTER_DISABLE_PROCESSING_ANIMATIONS=1 "
55+
f"and/or check the log: "
56+
f"{LOGGING['handlers']['error_file']['filename']} for details."
57+
)
58+
return scorep_process_error_hint

src/scorep_jupyter/logging_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pathlib import Path
55

66

7-
LOGGING_DIR = Path().cwd().parent / "logging"
7+
LOGGING_DIR = Path().cwd().parent / "logs_scorep_jupyter"
88
os.makedirs(LOGGING_DIR, exist_ok=True)
99

1010

0 commit comments

Comments
 (0)