Apply suggestions

This commit is contained in:
Duc Trung LE
2023-07-04 15:13:40 +02:00
parent 9034de28f9
commit aa754a1a2c
3 changed files with 12 additions and 7 deletions

View File

@@ -2486,6 +2486,7 @@ class JupyterHub(Application):
if key not in traits:
raise AttributeError("No such service field: %s" % key)
setattr(service, key, value)
print('###### updateing', key, value)
orm_service.update_column(key, value)
if service.api_token:
@@ -3256,9 +3257,9 @@ class JupyterHub(Application):
service_name,
status,
)
break
return False
else:
break
return True
else:
self.log.error(
"Cannot connect to %s service %s at %s. Is it running?",
@@ -3266,6 +3267,7 @@ class JupyterHub(Application):
service_name,
service.url,
)
return False
return True
def toggle_service_health_check(self) -> None:
@@ -3284,6 +3286,7 @@ class JupyterHub(Application):
# the periodic callback.
if self._check_services_health_callback is not None:
self._check_services_health_callback.stop()
self._check_services_health_callback = None
async def start(self):
"""Start the whole thing"""
@@ -3370,10 +3373,8 @@ class JupyterHub(Application):
# start the service(s)
for service_name, service in self._service_map.items():
service_status = await self.start_service(
service_name, service, ssl_context
)
if not service_status:
service_ready = await self.start_service(service_name, service, ssl_context)
if not service_ready:
if service.from_config:
# Stop the application if a config-based service failed to start.
self.exit(1)
@@ -3381,7 +3382,7 @@ class JupyterHub(Application):
# Only warn for database-based service, so that admin can connect
# to hub to remove the service.
self.log.error(
"Failed to start database-based service %s",
"Failed to reach externally managed service %s",
service_name,
exc_info=True,
)

View File

@@ -676,6 +676,9 @@ class JupyterHubOAuthServer(WebApplicationServer):
if orm_client is not None:
self.db.delete(orm_client)
self.db.commit()
app_log.info("Removed client %s", client_id)
else:
app_log.warning("No such client %s", client_id)
def fetch_by_client_id(self, client_id):
"""Find a client by its id"""

View File

@@ -490,6 +490,7 @@ class Service(Base):
returns `False` otherwise.
"""
if self._check_data_only_column(column_name):
print('NOT ForeignKey', column_name)
setattr(self, column_name, value)
return True
else: