Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 5, 2024
1 parent 915e858 commit 3408959
Show file tree
Hide file tree
Showing 26 changed files with 36 additions and 21 deletions.
1 change: 1 addition & 0 deletions enterprise_gateway/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Lazy-loading entrypoint for the enterprise gateway package."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from ._version import __version__ # noqa
Expand Down
1 change: 1 addition & 0 deletions enterprise_gateway/base/handlers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tornado handlers for the base of the API."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down
5 changes: 2 additions & 3 deletions enterprise_gateway/client/gateway_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""An Enterprise Gateway client."""

import logging
import os
import queue
Expand Down Expand Up @@ -218,9 +219,7 @@ def execute(self, code, timeout=REQUEST_TIMEOUT):
): # We timed out. If post idle, its ok, else make mention of it
if not post_idle:
self.log.warning(
"Unexpected timeout occurred for msg_id: {} - no 'idle' status received!".format(
msg_id
)
f"Unexpected timeout occurred for msg_id: {msg_id} - no 'idle' status received!"
)
break

Expand Down
1 change: 1 addition & 0 deletions enterprise_gateway/mixins.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Mixins for Tornado handlers."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down
1 change: 1 addition & 0 deletions enterprise_gateway/services/api/handlers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tornado handlers for kernel specs."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down
1 change: 1 addition & 0 deletions enterprise_gateway/services/kernels/handlers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tornado handlers for kernel CRUD and communication."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down
1 change: 1 addition & 0 deletions enterprise_gateway/services/kernels/remotemanager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Kernel managers that operate against a remote process."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down
1 change: 1 addition & 0 deletions enterprise_gateway/services/kernelspecs/handlers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tornado handlers for kernel specs."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Cache handling for kernel specs."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down
9 changes: 3 additions & 6 deletions enterprise_gateway/services/processproxies/conductor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Code related to managing kernels running in Conductor clusters."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down Expand Up @@ -189,9 +190,7 @@ def _update_notebook_master_rest_url(self, env_dict: dict) -> None:
response = None
except Exception as e:
self.log.warning(
"Getting instance group with cmd '{}' failed with exception: '{}'. Continuing...".format(
cmd, e
)
f"Getting instance group with cmd '{cmd}' failed with exception: '{e}'. Continuing..."
)
return

Expand Down Expand Up @@ -623,9 +622,7 @@ def _kill_app_by_driver_id(self, driver_id: str):
response = json.loads(output) if output else None
except Exception as e:
self.log.warning(
"Termination of application with cmd '{}' failed with exception: '{}'. Continuing...".format(
cmd, e
)
f"Termination of application with cmd '{cmd}' failed with exception: '{e}'. Continuing..."
)
self.log.debug(f"Kill response: {response}")
return response
Expand Down
1 change: 1 addition & 0 deletions enterprise_gateway/services/processproxies/container.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Code related to managing kernels running in containers."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down
1 change: 1 addition & 0 deletions enterprise_gateway/services/processproxies/crd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Code related to managing kernels running based on k8s custom resource."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down
1 change: 1 addition & 0 deletions enterprise_gateway/services/processproxies/distributed.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Code used for the generic distribution of kernels across a set of hosts."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down
1 change: 1 addition & 0 deletions enterprise_gateway/services/processproxies/docker_swarm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Code related to managing kernels running in docker-based containers."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down
1 change: 1 addition & 0 deletions enterprise_gateway/services/processproxies/k8s.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Code related to managing kernels running in Kubernetes clusters."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down
11 changes: 5 additions & 6 deletions enterprise_gateway/services/processproxies/processproxy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Kernel managers that operate against a remote process."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations
Expand Down Expand Up @@ -1332,9 +1333,9 @@ def _setup_connection_info(self, connect_info: dict) -> None:
f"Host assigned to the kernel is: '{self.assigned_host}' '{self.assigned_ip}'"
)

connect_info[
"ip"
] = self.assigned_ip # Set connection to IP address of system where the kernel was launched
connect_info["ip"] = (
self.assigned_ip
) # Set connection to IP address of system where the kernel was launched

if tunneling_enabled is True:
# Capture the current(tunneled) connect_info relative to the IP and ports (including the
Expand Down Expand Up @@ -1398,9 +1399,7 @@ def _update_connection(self, connect_info: dict) -> None:
Note: Do NOT update connect_info with IP and other such artifacts in this method/function.
"""
# Reset the ports to 0 so load can take place (which resets the members to value from file or json)...
self.kernel_manager.stdin_port = (
self.kernel_manager.iopub_port
) = (
self.kernel_manager.stdin_port = self.kernel_manager.iopub_port = (
self.kernel_manager.shell_port
) = self.kernel_manager.hb_port = self.kernel_manager.control_port = 0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A spark operator process proxy."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import annotations
Expand Down
5 changes: 2 additions & 3 deletions enterprise_gateway/services/processproxies/yarn.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Code related to managing kernels running in YARN clusters."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down Expand Up @@ -581,9 +582,7 @@ def _kill_app_by_id(self, app_id: str) -> Response:
response = self.resource_mgr.cluster_application_kill(application_id=app_id)
except Exception as e:
self.log.warning(
"Termination of application '{}' failed with exception: '{}'. Continuing...".format(
app_id, e
)
f"Termination of application '{app_id}' failed with exception: '{e}'. Continuing..."
)

return response
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Session manager that keeps all its metadata in memory."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down
1 change: 1 addition & 0 deletions enterprise_gateway/services/sessions/sessionmanager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Session manager that keeps all its metadata in memory."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

Expand Down
6 changes: 3 additions & 3 deletions enterprise_gateway/tests/test_gatewayapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ def test_config_env_vars(self):
os.environ["EG_CERTFILE"] = "/test/fake.crt"
os.environ["EG_CLIENT_CA"] = "/test/fake_ca.crt"
os.environ["EG_SSL_VERSION"] = "3"
os.environ[
"EG_KERNEL_SESSION_PERSISTENCE"
] = "True" # availability mode will be defaulted to replication
os.environ["EG_KERNEL_SESSION_PERSISTENCE"] = (
"True" # availability mode will be defaulted to replication
)

self._assert_envs_to_traitlets("EG_")

Expand Down
1 change: 1 addition & 0 deletions etc/docker/kernel-image-puller/image_fetcher.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""image name fetcher abstract class and concrete implementation"""

import abc
import importlib
import os
Expand Down
1 change: 1 addition & 0 deletions etc/docker/kernel-image-puller/kernel_image_puller.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A kernel image puller."""

import importlib
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions etc/kernel-launchers/R/scripts/server_listener.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A server listener for R."""

import base64
import json
import logging
Expand Down
1 change: 1 addition & 0 deletions etc/kernel-launchers/docker/scripts/launch_docker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Launches a containerized kernel."""

import argparse
import os
import sys
Expand Down
1 change: 1 addition & 0 deletions etc/kernel-launchers/python/scripts/launch_ipykernel.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Launch an ipython kernel."""

import argparse
import base64
import json
Expand Down

0 comments on commit 3408959

Please sign in to comment.