From 4db7a28d01f814ce66c2cd134a7439b0e46b6358 Mon Sep 17 00:00:00 2001 From: data-infra <825485697@qq.com> Date: Sat, 29 Jun 2024 13:14:57 +0800 Subject: [PATCH] =?UTF-8?q?=E9=95=9C=E5=83=8F=E8=B0=83=E8=AF=95=E6=97=B6?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BD=BF=E7=94=A8=E7=94=A8=E6=88=B7=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=85=8D=E7=BD=AE=E7=9A=84=E5=B7=A5=E4=BD=9C=E7=9B=AE?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- myapp/views/view_task.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/myapp/views/view_task.py b/myapp/views/view_task.py index 741fd784..f14fceaf 100644 --- a/myapp/views/view_task.py +++ b/myapp/views/view_task.py @@ -110,7 +110,7 @@ class Task_ModelView_Base(): ), "volume_mount": StringField( label= _('挂载'), - description= _('外部挂载,格式:$pvc_name1(pvc):/$container_path1,$hostpath1(hostpath):/$container_path2,4G(memory):/dev/shm,注意pvc会自动挂载对应目录下的个人rtx子目录'), + description= _('外部挂载,格式:$pvc_name1(pvc):/$container_path1,$hostpath1(hostpath):/$container_path2,4G(memory):/dev/shm,注意pvc会自动挂载对应目录下的个人username子目录'), widget=BS3TextFieldWidget(), default='kubeflow-user-workspace(pvc):/mnt,kubeflow-archives(pvc):/archives' ), @@ -534,6 +534,7 @@ class Task_ModelView_Base(): k8s_client.create_debug_pod(namespace, name=pod_name, labels={"pipeline": task.pipeline.name, 'task': task.name, 'user': g.user.username, 'run-id': run_id, 'pod-type': "task"}, + annotations={'project':task.pipeline.project.name}, command=command, args=new_args, volume_mount=volume_mount, @@ -560,7 +561,7 @@ class Task_ModelView_Base(): # 逻辑节点不能进行调试 if task.job_template.name == conf.get('LOGICAL_JOB'): - message = _('当前任务类型不允许进行调试') + message = __('当前任务类型不允许进行调试') flash(message, 'warning') return self.response(400, **{"status": 1, "result": {}, "message": message}) @@ -568,7 +569,7 @@ class Task_ModelView_Base(): if task.job_template.name != conf.get('CUSTOMIZE_JOB'): # 模板创建者可以调试模板 if not g.user.is_admin() and task.job_template.created_by.username != g.user.username: - message = _('仅管理员或当前任务模板创建者,可启动debug模式') + message = __('仅管理员或当前任务模板创建者,可启动debug模式') flash(message, 'warning') return self.response(400, **{"status": 1, "result": {}, "message": message}) @@ -601,6 +602,13 @@ class Task_ModelView_Base(): image = json.loads(task.args)['--image'] if json.loads(task.args).get('images',''): image = json.loads(task.args)['images'] + working_dir = None + if json.loads(task.args).get('workdir', ''): + working_dir = json.loads(task.args)['workdir'] + if json.loads(task.args).get('--workdir', ''): + working_dir = json.loads(task.args)['--workdir'] + if json.loads(task.args).get('-working_dir', ''): + working_dir = json.loads(task.args)['--working_dir'] if not pod or pod['status'] != 'Running': run_id = "debug-" + str(uuid.uuid4().hex) @@ -613,7 +621,7 @@ class Task_ModelView_Base(): namespace=namespace, pod_name=pod_name, image=image, - working_dir=None, + working_dir=working_dir, command=command, args=None ) @@ -821,7 +829,7 @@ class Task_ModelView_Base(): def clear_task(self, task_id): task = db.session.query(Task).filter_by(id=task_id).first() self.delete_task_run(task) - flash(__("删除完成"), category='success') + # flash(__("删除完成"), category='success') # self.update_redirect() return redirect('/pipeline_modelview/api/web/%s' % str(task.pipeline.id))