flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] zentol commented on a change in pull request #9759: [FLINK-14169][history-server] Cleanup expired jobs from history server
Date Fri, 18 Oct 2019 13:23:39 GMT
zentol commented on a change in pull request #9759: [FLINK-14169][history-server] Cleanup expired
jobs from history server
URL: https://github.com/apache/flink/pull/9759#discussion_r336480054
 
 

 ##########
 File path: flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServerArchiveFetcher.java
 ##########
 @@ -221,17 +267,40 @@ public void run() {
 							}
 						}
 					}
-					if (numFetchedArchives > 0) {
-						updateJobOverview(webOverviewDir, webDir);
-						for (int x = 0; x < numFetchedArchives; x++) {
-							numArchivedJobs.countDown();
-						}
-					}
 				}
+
+				if (!jobsToRemove.isEmpty() && processArchiveDeletion) {
+					events.addAll(cleanupExpiredJobs(jobsToRemove));
+				}
+				if (!events.isEmpty()) {
+					updateJobOverview(webOverviewDir, webDir);
+				}
+				events.forEach(jobArchiveEventListener::accept);
 			} catch (Exception e) {
 				LOG.error("Critical failure while fetching/processing job archives.", e);
 			}
 		}
+
+		private List<ArchiveEvent> cleanupExpiredJobs(Set<String> jobsToRemove) {
+
+			List<ArchiveEvent> deleteOperations = new ArrayList<>();
+			LOG.info("Archive directories for jobs {} were deleted.", jobsToRemove);
+
+			cachedArchives.removeAll(jobsToRemove);
+			jobsToRemove.forEach(removedJobID -> {
+				try {
+					Files.deleteIfExists(new File(webOverviewDir, removedJobID + JSON_FILE_ENDING).toPath());
+					Files.deleteIfExists(new File(webJobDir, removedJobID + JSON_FILE_ENDING).toPath());
 
 Review comment:
   redundant, the subsequent directory deletion takes care of this file.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message