|
@@ -72,9 +72,7 @@ def start_jupyter(db: Session, item: schemas.ProgrammeId):
|
|
c_res = send_util.create_jupyter(jupyter_create_data)
|
|
c_res = send_util.create_jupyter(jupyter_create_data)
|
|
j_data = c_res['data'] if 'data' in c_res.keys() else None
|
|
j_data = c_res['data'] if 'data' in c_res.keys() else None
|
|
if not j_data:
|
|
if not j_data:
|
|
- # send_util.stop_jupyter({'namespace': namespace,'release_name': db_item.release_name})
|
|
|
|
raise Exception("启动结构化编码失败")
|
|
raise Exception("启动结构化编码失败")
|
|
- url = f"http://{j_data['host']}{j_data['base_url']}/lab"
|
|
|
|
db_item.status = 0
|
|
db_item.status = 0
|
|
db.commit()
|
|
db.commit()
|
|
db.flush()
|
|
db.flush()
|
|
@@ -111,8 +109,11 @@ def get_programme(db: Session):
|
|
db_items: List[models.Programme] = db.query(models.Programme).filter(models.Programme.project_id == g.project_id).all()
|
|
db_items: List[models.Programme] = db.query(models.Programme).filter(models.Programme.project_id == g.project_id).all()
|
|
res = []
|
|
res = []
|
|
for item in db_items:
|
|
for item in db_items:
|
|
- complete_url =f'http://{host}{item.base_url}/lab'
|
|
|
|
- jupyter_status = get_programme_status(complete_url)
|
|
|
|
|
|
+ # 前端与本地访问使用
|
|
|
|
+ complete_url = f'http://{host}{item.base_url}/lab'
|
|
|
|
+ # 集群内部访问使用
|
|
|
|
+ request_url = f'http://{item.release_name}-jupyterlab:8888{item.base_url}/lab'
|
|
|
|
+ jupyter_status = get_programme_status(request_url)
|
|
item.status = jupyter_status
|
|
item.status = jupyter_status
|
|
db.commit()
|
|
db.commit()
|
|
db.flush()
|
|
db.flush()
|
|
@@ -124,6 +125,7 @@ def get_programme(db: Session):
|
|
|
|
|
|
|
|
|
|
def get_programme_status(url: str):
|
|
def get_programme_status(url: str):
|
|
|
|
+ print(url)
|
|
res_header= send_util.get_jupyter_html(url)
|
|
res_header= send_util.get_jupyter_html(url)
|
|
# 若为启动状态,则Server中包含Tornado,否则没有启动
|
|
# 若为启动状态,则Server中包含Tornado,否则没有启动
|
|
print(res_header)
|
|
print(res_header)
|