-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Improvement] [Seatunnel-web] Add support to provide reason for job f…
…ailure (#196)
- Loading branch information
1 parent
ee45dca
commit 0a1e24d
Showing
15 changed files
with
277 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
...b-it/src/test/java/org/apache/seatunnel/app/controller/TaskInstanceControllerWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.apache.seatunnel.app.controller; | ||
|
||
import org.apache.seatunnel.app.common.Result; | ||
import org.apache.seatunnel.app.common.SeatunnelWebTestingBase; | ||
import org.apache.seatunnel.app.domain.dto.job.SeaTunnelJobInstanceDto; | ||
import org.apache.seatunnel.app.utils.JSONTestUtils; | ||
import org.apache.seatunnel.app.utils.PageInfo; | ||
|
||
import com.fasterxml.jackson.core.type.TypeReference; | ||
|
||
import java.net.URLEncoder; | ||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class TaskInstanceControllerWrapper extends SeatunnelWebTestingBase { | ||
|
||
private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
|
||
public Result<PageInfo<SeaTunnelJobInstanceDto>> getTaskInstanceList( | ||
String jobDefineName, | ||
String executorName, | ||
String stateType, | ||
String startTime, | ||
String endTime, | ||
String syncTaskType, | ||
Integer pageNo, | ||
Integer pageSize) { | ||
String response = | ||
sendRequest( | ||
urlWithParam( | ||
"task/jobMetrics?jobDefineName=" | ||
+ jobDefineName | ||
+ "&executorName=" | ||
+ executorName | ||
+ "&stateType=" | ||
+ stateType | ||
+ "&startDate=" | ||
+ startTime | ||
+ "&endDate=" | ||
+ endTime | ||
+ "&syncTaskType=" | ||
+ syncTaskType | ||
+ "&pageNo=" | ||
+ pageNo | ||
+ "&pageSize=" | ||
+ pageSize)); | ||
return JSONTestUtils.parseObject( | ||
response, new TypeReference<Result<PageInfo<SeaTunnelJobInstanceDto>>>() {}); | ||
} | ||
|
||
public SeaTunnelJobInstanceDto getTaskInstanceList(String jobDefineName) { | ||
String startTime = | ||
URLEncoder.encode( | ||
dateFormat.format( | ||
new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24))); | ||
String endTime = | ||
URLEncoder.encode( | ||
dateFormat.format( | ||
new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 24))); | ||
String syncTaskType = "BATCH"; | ||
Integer pageNo = 1; | ||
Integer pageSize = 10; | ||
Result<PageInfo<SeaTunnelJobInstanceDto>> result = | ||
getTaskInstanceList( | ||
jobDefineName, | ||
null, | ||
null, | ||
startTime, | ||
endTime, | ||
syncTaskType, | ||
pageNo, | ||
pageSize); | ||
assertTrue(result.isSuccess()); | ||
if (result.getData().getTotalList().isEmpty()) { | ||
return null; | ||
} | ||
assertEquals(1, result.getData().getTotalList().size()); | ||
return result.getData().getTotalList().get(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.