Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.apache.hadoop.security.HttpCrossOriginFilterInitializer;
import org.apache.hadoop.security.SecurityUtil;
import org.apache.hadoop.service.CompositeService;
import org.apache.hadoop.util.GenericOptionsParser;
import org.apache.hadoop.util.JvmPauseMonitor;
import org.apache.hadoop.util.ShutdownHookManager;
import org.apache.hadoop.util.StringUtils;
Expand Down Expand Up @@ -290,7 +291,9 @@ private String getHostName(Configuration config)

public static void main(String[] argv) {
try {
startGPG(argv, new YarnConfiguration());
YarnConfiguration conf = new YarnConfiguration();
new GenericOptionsParser(conf, argv);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with this but this use looks not complete.
Most other places use the getRemainingArgs().

Copy link
Contributor Author

@slfan1989 slfan1989 Aug 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for helping review the code! When I first saw YARN-11433, my thoughts were aligned with yours, and I also had concerns about whether such an implementation was necessary.

I noticed YARN-3255, where RM, NM, JobHistoryServer, and WebAppProxyServer's main() should support generic options. Other components in YARN, such as RM, NM, and JobHistoryServer, have implemented similar logic. I believe Router and GPG should be able to implement this logic as well.

public static void main(String[] args) throws IOException {
Thread.setDefaultUncaughtExceptionHandler(new YarnUncaughtExceptionHandler());
StringUtils.startupShutdownMessage(NodeManager.class, args, LOG);
@SuppressWarnings("resource")
NodeManager nodeManager = new NodeManager();
Configuration conf = new YarnConfiguration();
new GenericOptionsParser(conf, args);
nodeManager.initAndStartNodeManager(conf, false);

startGPG(argv, conf);
} catch (Throwable t) {
LOG.error("Error starting global policy generator", t);
System.exit(-1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.hadoop.security.HttpCrossOriginFilterInitializer;
import org.apache.hadoop.security.SecurityUtil;
import org.apache.hadoop.service.CompositeService;
import org.apache.hadoop.util.GenericOptionsParser;
import org.apache.hadoop.util.JvmPauseMonitor;
import org.apache.hadoop.util.ShutdownHookManager;
import org.apache.hadoop.util.StringUtils;
Expand Down Expand Up @@ -246,6 +247,8 @@ public static void main(String[] argv) {
Router router = new Router();
try {

new GenericOptionsParser(conf, argv);

// Remove the old hook if we are rebooting.
if (null != routerShutdownHook) {
ShutdownHookManager.get().removeShutdownHook(routerShutdownHook);
Expand Down