fuweng11 commented on code in PR #11532:
URL: https://github.com/apache/inlong/pull/11532#discussion_r1855701779
##########
inlong-manager/manager-schedule/src/main/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleUtils.java:
##########
@@ -489,17 +493,35 @@ public static void delete(String url, String token, long
code) {
Map<String, String> header = buildHeader(token);
String requestUrl = url + "/" + code;
+ for (int attempt = 1; attempt <= DS_DEFAULT_RETRY_TIMES;
attempt++) {
+ JsonObject response = executeHttpRequest(requestUrl, DELETE,
new HashMap<>(), header);
- JsonObject response = executeHttpRequest(requestUrl, DELETE, new
HashMap<>(), header);
- LOGGER.info("delete process or project success, response data:
{}", response);
+ if (response.get(DS_SUCCESS).getAsBoolean()) {
+ LOGGER.info("Delete process or project success, response
data: {}", response);
+ return;
+ }
+
+ if (response.get(DS_CODE).getAsInt() ==
PROCESS_DEFINITION_IN_USED_ERROR) {
+ LOGGER.warn("Attempt {} of {}, retrying after {} ms...",
attempt, DS_DEFAULT_RETRY_TIMES,
+ DS_DEFAULT_WAIT_MILLS);
+ Thread.sleep(DS_DEFAULT_WAIT_MILLS);
+ }
+ }
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ LOGGER.error("Thread interrupted while retrying delete process or
project: ", e);
+ throw new DolphinScheduleException(
+ DELETION_FAILED,
+ String.format("Thread interrupted while retrying delete
for code: %d at URL: %s", code, url), e);
} catch (JsonParseException e) {
LOGGER.error("JsonParseException during deleting process or
project", e);
throw new DolphinScheduleException(
JSON_PARSE_ERROR,
String.format("Error deleting process or project with
code: %d at URL: %s", code, url), e);
Review Comment:
```suggestion
String.format("Error deleting process or project with
code: %d at URL: %s", code, url));
```
##########
inlong-manager/manager-schedule/src/main/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleUtils.java:
##########
@@ -489,17 +493,35 @@ public static void delete(String url, String token, long
code) {
Map<String, String> header = buildHeader(token);
String requestUrl = url + "/" + code;
+ for (int attempt = 1; attempt <= DS_DEFAULT_RETRY_TIMES;
attempt++) {
+ JsonObject response = executeHttpRequest(requestUrl, DELETE,
new HashMap<>(), header);
- JsonObject response = executeHttpRequest(requestUrl, DELETE, new
HashMap<>(), header);
- LOGGER.info("delete process or project success, response data:
{}", response);
+ if (response.get(DS_SUCCESS).getAsBoolean()) {
+ LOGGER.info("Delete process or project success, response
data: {}", response);
+ return;
+ }
+
+ if (response.get(DS_CODE).getAsInt() ==
PROCESS_DEFINITION_IN_USED_ERROR) {
+ LOGGER.warn("Attempt {} of {}, retrying after {} ms...",
attempt, DS_DEFAULT_RETRY_TIMES,
+ DS_DEFAULT_WAIT_MILLS);
+ Thread.sleep(DS_DEFAULT_WAIT_MILLS);
+ }
+ }
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ LOGGER.error("Thread interrupted while retrying delete process or
project: ", e);
+ throw new DolphinScheduleException(
+ DELETION_FAILED,
+ String.format("Thread interrupted while retrying delete
for code: %d at URL: %s", code, url), e);
} catch (JsonParseException e) {
LOGGER.error("JsonParseException during deleting process or
project", e);
throw new DolphinScheduleException(
JSON_PARSE_ERROR,
String.format("Error deleting process or project with
code: %d at URL: %s", code, url), e);
} catch (DolphinScheduleException e) {
+ LOGGER.error("Error deleting process or project: ", e);
throw new DolphinScheduleException(
DELETION_FAILED,
String.format("Error deleting process or project with
code: %d at URL: %s", code, url), e);
Review Comment:
```suggestion
String.format("Error deleting process or project with
code: %d at URL: %s", code, url));
```
##########
inlong-manager/manager-schedule/src/main/java/org/apache/inlong/manager/schedule/dolphinscheduler/DolphinScheduleUtils.java:
##########
@@ -489,17 +493,35 @@ public static void delete(String url, String token, long
code) {
Map<String, String> header = buildHeader(token);
String requestUrl = url + "/" + code;
+ for (int attempt = 1; attempt <= DS_DEFAULT_RETRY_TIMES;
attempt++) {
+ JsonObject response = executeHttpRequest(requestUrl, DELETE,
new HashMap<>(), header);
- JsonObject response = executeHttpRequest(requestUrl, DELETE, new
HashMap<>(), header);
- LOGGER.info("delete process or project success, response data:
{}", response);
+ if (response.get(DS_SUCCESS).getAsBoolean()) {
+ LOGGER.info("Delete process or project success, response
data: {}", response);
+ return;
+ }
+
+ if (response.get(DS_CODE).getAsInt() ==
PROCESS_DEFINITION_IN_USED_ERROR) {
+ LOGGER.warn("Attempt {} of {}, retrying after {} ms...",
attempt, DS_DEFAULT_RETRY_TIMES,
+ DS_DEFAULT_WAIT_MILLS);
+ Thread.sleep(DS_DEFAULT_WAIT_MILLS);
+ }
+ }
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ LOGGER.error("Thread interrupted while retrying delete process or
project: ", e);
+ throw new DolphinScheduleException(
+ DELETION_FAILED,
+ String.format("Thread interrupted while retrying delete
for code: %d at URL: %s", code, url), e);
Review Comment:
```suggestion
String.format("Thread interrupted while retrying delete
for code: %d at URL: %s", code, url));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]