-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STORM-3521: Ensures unrecognized Storm CLI flags/arguments are passed to main Java class if any #3146
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have several questions about this PR
bin/storm.py
Outdated
jvmtype="-client", | ||
extrajars=[USER_CONF_DIR, STORM_BIN_DIR]) | ||
|
||
def is_not_conflicting_jar_argument(raw_arg): | ||
# TODO refactor underlying Topology main classes to avoid this ugly hack | ||
conflicting_flags = ["-hdfsConf"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it specific to -hdfsConf
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the ugly part - the conflict is that the way the HdfsTopology specifies the argument is non-unix compliant. And there's no consistent way to identify all such possible flags so I'm only filtering this one for now and add more later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea why flags starting with -h
will fail, e.g. -htt
?
storm jar: error: argument -h/--help: ignored explicit argument 'tt'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because -htt is equivalent to -h -tt. The correct way to specify it is --htt. The HdfsTopology acceps -htt (which is non-Unix compliant it should be single dashes for single characters or double dashes for multiple characters)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I finally find a work around: set allow_abbrev=False
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't solve the underlying issue - there are single flag arguments that we had previously in the CLI. Setting that will make it backwards incompatible (like the -c)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had an offline discussion with @govind-menon and verified this would work.
If allow_abbrev
is true, then -htt
will be parsed as -h tt
. And that's why it failed.
The only problem is allow_abbrev
is not available in python2.
@@ -1401,7 +1401,7 @@ def drpc_client(args): | |||
|
|||
exec_storm_class( | |||
"org.apache.storm.command.BasicDrpcClient", | |||
args=remove_common_options(sys.argv[2:]), storm_config_opts=args.storm_config_opts, | |||
main_class_args=remove_common_options(sys.argv[2:]), storm_config_opts=args.storm_config_opts, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to change this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just to make the name more descriptive
+ '/extlib:/path/to/jar.jar:' + self.storm_dir + '/conf:' + self.storm_dir + '/bin:', | ||
'-Dstorm.jar=/path/to/jar.jar', '-Dstorm.dependency.jars=', '-Dstorm.dependency.artifacts={}', | ||
'some.Topology.Class', '-name', 'run-topology', 'randomArgument', '-randomFlag', 'randomFlagValue', | ||
'-rotateSize', '0.0001', 'dfs.namenode.kerberos.principal.pattern=hdfs/*.EV..COM', '-hdfsConf' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this correct?
'dfs.namenode.kerberos.principal.pattern=hdfs/*.EV..COM', '-hdfsConf'
? Shouldn't -hdfsConf
appear before 'dfs.namenode.kerberos.principal.pattern=hdfs/*.EV..COM'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch - the filtered flags are re-added at the end. The argument is of the form -hdfsConf=someValue so the order shouldn't matter
5d797e1
to
ae5848b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix. Left some very minor comments.
'--hdfsConf', 'someOtherHdfsConf', 'dfs.namenode.kerberos.principal.pattern=hdfs/*.EV..COM' | ||
], self.mock_execvp, mock.call( | ||
self.java_cmd, [ | ||
self.java_cmd, '-client','-Ddaemon.name=', '-Dstorm.options=', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: space after ,
], self.mock_execvp, mock.call( | ||
self.java_cmd, [ | ||
self.java_cmd, '-client','-Ddaemon.name=', '-Dstorm.options=', | ||
'-Dstorm.home=' + self.storm_dir + '', '-Dstorm.log.dir=' + self.storm_dir + "/logs", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we delete + ''
in self.storm_dir + ''
ae5848b
to
d86ee85
Compare
… with non unix compliant flags
d86ee85
to
3c14c1f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 Thanks for fixing it.
… with non unix compliant flags