Commit 67d9e72b authored by wenmo's avatar wenmo

重新上线

parent 24edc060
...@@ -101,7 +101,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen ...@@ -101,7 +101,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
public JobResult restartByTaskId(Integer id) { public JobResult restartByTaskId(Integer id) {
Task task = this.getTaskInfoById(id); Task task = this.getTaskInfoById(id);
Asserts.checkNull(task, Tips.TASK_NOT_EXIST); Asserts.checkNull(task, Tips.TASK_NOT_EXIST);
if(Asserts.isNotNull(task.getJobInstanceId())||task.getJobInstanceId()!=0){ if(Asserts.isNotNull(task.getJobInstanceId())&&task.getJobInstanceId()!=0){
savepointTask(task, SavePointType.CANCEL.getValue()); savepointTask(task, SavePointType.CANCEL.getValue());
} }
if (Dialect.isSql(task.getDialect())) { if (Dialect.isSql(task.getDialect())) {
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:property-placeholder/>
<dubbo:application name="demo-consumer"/>
<dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:2181"/>
<!-- <dubbo:reference id="demoService" check="true" interface="com.dlink.service.DemoService" version="1.0.0"/>-->
</beans>
...@@ -196,6 +196,10 @@ export function showFlinkJobs(clusterId:number) { ...@@ -196,6 +196,10 @@ export function showFlinkJobs(clusterId:number) {
export function cancelJob(clusterId:number,jobId:string) { export function cancelJob(clusterId:number,jobId:string) {
return getData('api/studio/cancel',{clusterId:clusterId,jobId:jobId}); return getData('api/studio/cancel',{clusterId:clusterId,jobId:jobId});
} }
/*--- 重启 Flink Jobs ---*/
export function restartJob(id: number) {
return getData('api/task/restartTask',{id});
}
/*--- 停止 SavePoint Jobs ---*/ /*--- 停止 SavePoint Jobs ---*/
export function savepointJob(clusterId:number,jobId:string,savePointType:string,name:string,taskId:number) { export function savepointJob(clusterId:number,jobId:string,savePointType:string,name:string,taskId:number) {
return getData('api/studio/savepoint',{clusterId,jobId,savePointType,name,taskId}); return getData('api/studio/savepoint',{clusterId,jobId,savePointType,name,taskId});
......
...@@ -13,7 +13,7 @@ import moment from "moment"; ...@@ -13,7 +13,7 @@ import moment from "moment";
import BaseInfo from "@/pages/DevOps/JobInfo/BaseInfo"; import BaseInfo from "@/pages/DevOps/JobInfo/BaseInfo";
import Config from "@/pages/DevOps/JobInfo/Config"; import Config from "@/pages/DevOps/JobInfo/Config";
import JobStatus, {isStatusDone} from "@/components/Common/JobStatus"; import JobStatus, {isStatusDone} from "@/components/Common/JobStatus";
import {cancelJob, savepointJob} from "@/components/Studio/StudioEvent/DDL"; import {cancelJob, restartJob, savepointJob} from "@/components/Studio/StudioEvent/DDL";
const {Link} = Typography; const {Link} = Typography;
...@@ -96,6 +96,26 @@ const JobInfo = (props: any) => { ...@@ -96,6 +96,26 @@ const JobInfo = (props: any) => {
}); });
}; };
const handleRestart = () => {
Modal.confirm({
title: '重新上线任务',
content: `确定重新上线该作业吗?`,
okText: '确认',
cancelText: '取消',
onOk: async () => {
if (!job?.cluster?.id) return;
const res = restartJob(job?.instance?.taskId);
res.then((result) => {
if (result.datas.success == true) {
message.success("重新上线成功");
} else {
message.error("重新上线失败");
}
});
}
});
};
const getButtons = () => { const getButtons = () => {
let buttons = [ let buttons = [
<Button key="back" type="dashed" onClick={handleBack}>返回</Button>, <Button key="back" type="dashed" onClick={handleBack}>返回</Button>,
...@@ -107,7 +127,7 @@ const JobInfo = (props: any) => { ...@@ -107,7 +127,7 @@ const JobInfo = (props: any) => {
FlinkWebUI FlinkWebUI
</Link></Button>); </Link></Button>);
} }
buttons.push(<Button key="autorestart" type="primary">重新上线</Button>); buttons.push(<Button key="autorestart" type="primary" onClick={handleRestart}>重新上线</Button>);
if(!isStatusDone(job?.instance?.status as string)){ if(!isStatusDone(job?.instance?.status as string)){
buttons.push(<Button key="autostop" type="primary" danger onClick={()=>{handleSavepoint('cancel')}}>下线</Button>); buttons.push(<Button key="autostop" type="primary" danger onClick={()=>{handleSavepoint('cancel')}}>下线</Button>);
buttons.push(<Dropdown buttons.push(<Dropdown
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment