Browse Source

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

liweiquan 1 year ago
parent
commit
f4ac96e9d2
1 changed files with 6 additions and 5 deletions
  1. 6 5
      app/crud/programme.py

+ 6 - 5
app/crud/programme.py

@@ -123,9 +123,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