Skip to content

Commit

Permalink
Minor cleanup around logging (jupyter-server#333)
Browse files Browse the repository at this point in the history
* minor logging cleanup

* minor logging cleanup

* Bump to 0.17.1
  • Loading branch information
Zsailer authored and GitHub Enterprise committed Apr 27, 2022
1 parent 698f147 commit 886b185
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion data_studio_jupyter_extensions/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.17.0" # pragma: no cover
__version__ = "0.17.1" # pragma: no cover
15 changes: 7 additions & 8 deletions data_studio_jupyter_extensions/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ async def fetch_running_kernels(self) -> None:
"login_handler_class": "data_studio_jupyter_extensions.auth.login.JWTLoginHandler",
"logout_handler_class": "data_studio_jupyter_extensions.auth.logout.DSLogoutHandler",
"cookie_options": {"expires_days": 1},
"max_body_size": 2 * 1024 * 1024 * 1024,
"max_buffer_size": 2 * 1024 * 1024 * 1024,
},
"SynchronizerExtension": {
"database_filepath": KERNEL_SESSION_DB_PATH,
Expand Down Expand Up @@ -187,8 +189,8 @@ class DataStudioJupyterExtensions(ExtensionAppJinjaMixin, ExtensionApp):
help="Request timeout talking to DATASTUDIO API",
).tag(config=True)

datastudio_kernel_logs_path = Unicode(
default_value="kernels",
datastudio_logs_path = Unicode(
default_value="logs",
help="Path to the kernel logs.",
).tag(config=True)

Expand Down Expand Up @@ -216,7 +218,7 @@ class DataStudioJupyterExtensions(ExtensionAppJinjaMixin, ExtensionApp):

@default("log_level")
def _default_log_level(self):
return os.environ.get("LOG_LEVEL", "DEBUG")
return os.environ.get("LOG_LEVEL", "INFO")

def _load_mode(self):
"""Search entrypoints for available modes."""
Expand All @@ -238,18 +240,15 @@ def _jupyter_server_config(self):
config = super()._jupyter_server_config()
parsed_uri = urlparse(self.dsw_url)
domain = "{uri.scheme}://{uri.netloc}".format(uri=parsed_uri)
log_level = os.environ.get("LOG_LEVEL", "INFO")

# Apply defaults from this extension
base_config = DS_JUPYTER_SERVER_CONFIG_OVERRIDES
base_config.ServerApp.update(
{
"log_level": log_level,
"log_level": self.log_level,
"base_url": self.server_base_url,
# Increase the max size of HTTP requests to Jupyter Server from 0.5 Gb to 2 Gb
# to handle saving of large files.
"max_body_size": 2 * 1024 * 1024 * 1024,
"max_buffer_size": 2 * 1024 * 1024 * 1024,
"tornado_settings": {
"ds_ws_max_buffer_size": self.ds_ws_max_buffer_size,
"ds_ws_max_message_size": self.ds_ws_max_message_size,
Expand Down Expand Up @@ -318,7 +317,7 @@ def initialize_configurables(self):
request_timeout=self.datastudio_api_request_timeout,
)
self.kernel_logger = KernelLogger.instance(
parent=self, datastudio_kernel_logs_path=self.datastudio_kernel_logs_path
parent=self, datastudio_logs_path=self.datastudio_logs_path
)


Expand Down
6 changes: 3 additions & 3 deletions data_studio_jupyter_extensions/kernel_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

class KernelLogger(SingletonConfigurable):

datastudio_kernel_logs_path = Unicode(
default_value="kernels",
datastudio_logs_path = Unicode(
default_value="logs",
help="Path to the kernel logs.",
).tag(config=True)

Expand All @@ -27,7 +27,7 @@ def emit(caller, data):
)
logger = KernelLogger.instance()
data_string = pp.pformat(data) + "\n"
log_path = pathlib.Path(logger.datastudio_kernel_logs_path)
log_path = pathlib.Path(logger.datastudio_logs_path)
log_path.mkdir(parents=True, exist_ok=True)
log_file = log_path / f"kernel-{kernel_id}.log"
# Open the log file in "append" mode.
Expand Down
2 changes: 1 addition & 1 deletion data_studio_jupyter_extensions/modes/cluster_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ def load_mode():
},
"ConnectionFileMixin": {"transport": "tcp"},
"HubbleAgentConfigurable": {"enabled": True},
"DataStudioJupyterExtensions": {"datastudio_kernel_logs_path": "/logs"},
"DataStudioJupyterExtensions": {"datastudio_logs_path": "/logs"},
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ testpaths = [
]

[tool.tbump.version]
current = "0.17.0"
current = "0.17.1"
regex = '''
(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
((?P<channel>a|b|rc|.dev)(?P<release>\d+))?
Expand Down
2 changes: 1 addition & 1 deletion src/status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { ISessionContext, ReactWidget } from '@jupyterlab/apputils';
import { TelemetryListener } from './telemetrylistener';

// This is managed by tbump config in pyproject.toml
const VERSION = '0.17.0';
const VERSION = '0.17.1';

// Define the error states
// https://github.pie.apple.com/pie-data-studio/notebook-service/blob/761d63604966db5918d2e491c0f89cce454b7f67/app/com/apple/datastudio/model/ResourceState.scala#L20
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.17.0
0.17.1

0 comments on commit 886b185

Please sign in to comment.