Skip to content
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

Merged
merged 1 commit into from
Oct 21, 2019

Conversation

govind-menon
Copy link
Contributor

… with non unix compliant flags

Copy link
Contributor

@Ethanlm Ethanlm left a 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"]
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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'

Copy link
Contributor Author

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)

Copy link
Contributor

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.

Copy link
Contributor Author

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)

Copy link
Contributor

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,
Copy link
Contributor

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

Copy link
Contributor Author

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'
Copy link
Contributor

@Ethanlm Ethanlm Oct 18, 2019

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'

Copy link
Contributor Author

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

@govind-menon govind-menon changed the title STORM-3521: Adds ugly workaround to deal with topology main arguments… STORM-3521: Ensures unrecognized Storm CLI flags/arguments are passed to main Java class if any Oct 21, 2019
Copy link
Contributor

@Ethanlm Ethanlm left a 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=',
Copy link
Contributor

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",
Copy link
Contributor

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 + ''

Copy link
Contributor

@Ethanlm Ethanlm left a 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.

@govind-menon govind-menon merged commit b2393ee into apache:master Oct 21, 2019
@govind-menon govind-menon deleted the STORM-3521 branch October 21, 2019 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants