Bläddra i källkod

集群环境停止jupyter后请求失败

liweiquan 1 år sedan
förälder
incheckning
aadc0751e6
1 ändrade filer med 6 tillägg och 5 borttagningar
  1. 6 5
      app/crud/programme.py

+ 6 - 5
app/crud/programme.py

@@ -125,9 +125,10 @@ def get_programme(db: Session):
 
 
 def get_programme_status(url: str):
-    print(url)
-    res_header= send_util.get_jupyter_html(url)
-    # 若为启动状态,则Server中包含Tornado,否则没有启动
-    print(res_header)
-    jupyter_status = 0 if res_header['Server'].find('Tornado') < 0 else 1
+    try:
+        res_header= send_util.get_jupyter_html(url)
+        # 若为启动状态,则Server中包含Tornado,否则没有启动
+        jupyter_status = 0 if res_header['Server'].find('Tornado') < 0 else 1
+    except Exception as e:
+        jupyter_status = 0
     return jupyter_status