[ https://issues.apache.org/jira/browse/YARN-11547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17765873#comment-17765873 ]
ASF GitHub Bot commented on YARN-11547: --------------------------------------- goiri commented on code in PR #6055: URL: https://github.com/apache/hadoop/pull/6055#discussion_r1327796374 ########## hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/Router.java: ########## @@ -362,6 +363,72 @@ public FedAppReportFetcher getFetcher() { return fetcher; } + @VisibleForTesting + public static void removeApplication(Configuration conf, String applicationId) + throws Exception { + FederationStateStoreFacade facade = FederationStateStoreFacade.getInstance(conf); + ApplicationId removeAppId = ApplicationId.fromString(applicationId); + LOG.info("Deleting application {} from state store.", removeAppId); + facade.deleteApplicationHomeSubCluster(removeAppId); + LOG.info("Application is deleted from state store"); + } + + private static void handFormatStateStore() { + // TODO: YARN-11548. [Federation] Router Supports Format FederationStateStore. + System.err.println("format-state-store is not yet supported."); + } + + private static void handRemoveApplicationFromStateStore(Configuration conf, + String applicationId) { + try { + removeApplication(conf, applicationId); + System.out.println("Application " + applicationId + " is deleted from state store"); + } catch (Exception e) { + System.err.println("Application " + applicationId + " error, exception = " + e); + } + } + + private static void executeRouterCommand(Configuration conf, String[] args) { + Options opts = new Options(); + Option formatStateStoreOpt = new Option("format-state-store", false, + " Formats the FederationStateStore. " + + "This will clear the FederationStateStore and " + + "is useful if past applications are no longer needed. " + + "This should be run only when the Router is not running."); + Option removeApplicationFromStateStoreOpt = new Option("remove-application-from-state-store", + false, " Remove the application from FederationStateStore. " + + " This should be run only when the Router is not running. "); + opts.addOption(formatStateStoreOpt); + opts.addOption(removeApplicationFromStateStoreOpt); + + String cmd = args[0]; + + CommandLine cliParser = null; Review Comment: Move the definition inside of the try. > [Federation] Router Supports Remove individual application records from > FederationStateStore. > --------------------------------------------------------------------------------------------- > > Key: YARN-11547 > URL: https://issues.apache.org/jira/browse/YARN-11547 > Project: Hadoop YARN > Issue Type: Sub-task > Components: federation > Affects Versions: 3.4.0 > Reporter: Shilun Fan > Assignee: Shilun Fan > Priority: Major > Labels: pull-request-available > > Similar to RM, Router should support clearing individual application from > FederationStateStore. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org