From ac32ae496e6dfb645e35f3cf1ae2d0c77ec21edf Mon Sep 17 00:00:00 2001 From: Min RK Date: Thu, 19 Sep 2019 15:51:02 +0200 Subject: [PATCH] run pre-commit hook --- docs/requirements.txt | 2 +- docs/source/conf.py | 2 +- docs/source/events/index.rst | 2 +- docs/source/events/server-actions.rst | 2 +- jupyterhub/app.py | 7 +++---- jupyterhub/handlers/base.py | 20 ++++++++++++-------- requirements.txt | 2 +- 7 files changed, 20 insertions(+), 17 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 0ac4a7ce..980376d5 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -4,5 +4,5 @@ alabaster_jupyterhub recommonmark==0.5.0 sphinx-copybutton +sphinx-jsonschema sphinx>=1.7 -sphinx-jsonschema \ No newline at end of file diff --git a/docs/source/conf.py b/docs/source/conf.py index 0e84f38c..036cac22 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -19,7 +19,7 @@ extensions = [ 'sphinx.ext.napoleon', 'autodoc_traits', 'sphinx_copybutton', - 'sphinx-jsonschema' + 'sphinx-jsonschema', ] templates_path = ['_templates'] diff --git a/docs/source/events/index.rst b/docs/source/events/index.rst index 4ecf1ebd..d662b8bf 100644 --- a/docs/source/events/index.rst +++ b/docs/source/events/index.rst @@ -47,4 +47,4 @@ Event schemas .. toctree:: :maxdepth: 2 - server-actions.rst \ No newline at end of file + server-actions.rst diff --git a/docs/source/events/server-actions.rst b/docs/source/events/server-actions.rst index 7db66a27..12018713 100644 --- a/docs/source/events/server-actions.rst +++ b/docs/source/events/server-actions.rst @@ -1 +1 @@ -.. jsonschema:: ../../../jupyterhub/event-schemas/server-actions/v1.yaml \ No newline at end of file +.. jsonschema:: ../../../jupyterhub/event-schemas/server-actions/v1.yaml diff --git a/jupyterhub/app.py b/jupyterhub/app.py index 1451cc64..b7da6a4f 100644 --- a/jupyterhub/app.py +++ b/jupyterhub/app.py @@ -5,19 +5,19 @@ import asyncio import atexit import binascii +import json import logging import os import re import signal import socket import sys -import json -from glob import glob from concurrent.futures import ThreadPoolExecutor from datetime import datetime from datetime import timezone from functools import partial from getpass import getuser +from glob import glob from operator import itemgetter from textwrap import dedent from urllib.parse import unquote @@ -2073,7 +2073,7 @@ class JupyterHub(Application): internal_ssl_ca=self.internal_ssl_ca, trusted_alt_names=self.trusted_alt_names, shutdown_on_logout=self.shutdown_on_logout, - eventlog=self.eventlog + eventlog=self.eventlog, ) # allow configured settings to have priority settings.update(self.tornado_settings) @@ -2109,7 +2109,6 @@ class JupyterHub(Application): continue self.eventlog.register_schema_file(os.path.join(dirname, file)) - def write_pid_file(self): pid = os.getpid() if self.pid_file: diff --git a/jupyterhub/handlers/base.py b/jupyterhub/handlers/base.py index b5f37cc8..e5249cb5 100644 --- a/jupyterhub/handlers/base.py +++ b/jupyterhub/handlers/base.py @@ -850,11 +850,11 @@ class BaseHandler(RequestHandler): SERVER_SPAWN_DURATION_SECONDS.labels( status=ServerSpawnStatus.success ).observe(time.perf_counter() - spawn_start_time) - self.eventlog.record_event('hub.jupyter.org/server-action', 1, { - 'action': 'start', - 'username': user.name, - 'servername': server_name - }) + self.eventlog.record_event( + 'hub.jupyter.org/server-action', + 1, + {'action': 'start', 'username': user.name, 'servername': server_name}, + ) proxy_add_start_time = time.perf_counter() spawner._proxy_pending = True try: @@ -1035,11 +1035,15 @@ class BaseHandler(RequestHandler): SERVER_STOP_DURATION_SECONDS.labels( status=ServerStopStatus.success ).observe(toc - tic) - self.eventlog.record_event('hub.jupyter.org/server-action', 1, { + self.eventlog.record_event( + 'hub.jupyter.org/server-action', + 1, + { 'action': 'stop', 'username': user.name, - 'servername': server_name - }) + 'servername': server_name, + }, + ) except: SERVER_STOP_DURATION_SECONDS.labels( status=ServerStopStatus.failure diff --git a/requirements.txt b/requirements.txt index 3ae33109..7821b905 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ async_generator>=1.8 certipy>=0.1.2 entrypoints jinja2 +jupyter_telemetry oauthlib>=3.0 pamela prometheus_client>=0.0.21 @@ -11,4 +12,3 @@ requests SQLAlchemy>=1.1 tornado>=5.0 traitlets>=4.3.2 -jupyter_telemetry