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

[BEAM-1319] Add conflict resolution to the PipelineOptions internal argparse. #1848

Closed
wants to merge 1 commit into from

Conversation

aaltay
Copy link
Member

@aaltay aaltay commented Jan 26, 2017

In some instances where a PipelineOptions subclass was defined in the
main session and save_main_session option is enabled, that subclass may
appear multiple times in the PipelineOptions.subclassess() list.
This is causing problems with the argparse because options are not
unique any more.

This changes filter the subclasses by name, and pick the last unique
instance of each subclass.

As an alternative option, we could use the conflict_handler='resolve' of
the argparse. However, the drawback of this approach would be that allowing
accidental overriding of the same option name in two different PipelineOptions
subclasses.

Also moves wordcount example to use PipelineOptions. This both serves as an
example of using PipelineOptions, also it is already integrated with
tests and will continue to test this case.

In some instances where a PipelineOptions subclass was defined in the
main session and save_main_session option is enabled, that subclass may
appear multiple times in the PipelineOptions.__subclassess__() list.
This is causing problems with the argparse because options are not
unique any more.

This changes filter the subclasses by name, and pick the last unique
instance of each subclass.

As an alternative option, we could use the conflict_handler='resolve' of
the argparse. However, the drawback of this approach would be that allowing
accidental overriding of the same option name in two different PipelineOptions
subclasses.

Also moves wordcount to use PipelineOptions. This both serves as an
example of using PipelineOptions, also it is already integrated with
tests and will continue to test this case.
@aaltay
Copy link
Member Author

aaltay commented Jan 26, 2017

R: @chamikaramj

@asfbot
Copy link

asfbot commented Jan 26, 2017

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/beam_PreCommit_Java_MavenInstall/6817/
--none--

for cls in PipelineOptions.__subclasses__():
subset[str(cls)] = cls
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 add a test for this ?

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.

None yet

4 participants