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-824] Fixing error message when sdk_location not provided #1200

Closed
wants to merge 4 commits into from

Conversation

pabloem
Copy link
Member

@pabloem pabloem commented Oct 26, 2016

Be sure to do all of the following to help us incorporate your contribution
quickly and easily:

  • Make sure the PR title is formatted like:
    [BEAM-<Jira issue #>] Description of pull request
  • Make sure tests pass via mvn clean verify. (Even better, enable
    Travis-CI on your fork and ensure the whole test matrix passes).
  • Replace <Jira issue #> in the title with the actual Jira issue
    number, if there is one.
  • If this contribution is large, please file an Apache
    Individual Contributor License Agreement.

r: @aaltay can you take a look?
I tried adding the error strings to pkg_resources.DistributionNotFound's .args tuple, but it seems to have special formatting for them so I couldn't add extra information on the error message. Let me know how you think we can phrase the error message.

P.S. I'll remove the extra space in a new commit soon.

@@ -435,7 +435,13 @@ def _stage_dataflow_sdk_tarball(sdk_remote_location, staged_path, temp_dir):
_dependency_file_copy(sdk_remote_location, staged_path)
elif sdk_remote_location == 'pypi':
logging.info('Staging the SDK tarball from PyPI to %s', staged_path)
_dependency_file_copy(_download_pypi_sdk_package(temp_dir), staged_path)
import pkg_resources as pkg
Copy link
Member

Choose a reason for hiding this comment

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

It would make sense to push down this check to _download_pypi_sdk_package. This will remove the requirement for importing the same package here again, and you can raise the same RuntimeError there.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

try:
_dependency_file_copy(_download_pypi_sdk_package(temp_dir), staged_path)
except pkg.DistributionNotFound:
raise RuntimeError('Unable to stage SDK tarball. '
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure what would be a clear error message. There is no need to mention remote location that is an SDK internal.

Perhaps : 'Please set --sdk_location or install a valid GOOGLE_PACKAGE_NAME distribution.'

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@pabloem
Copy link
Member Author

pabloem commented Oct 28, 2016

@aaltay what do you think now? : )

try:
version = pkg.get_distribution(GOOGLE_PACKAGE_NAME).version
except pkg.DistributionNotFound:
raise RuntimeError('Please set --sdk_location or install a valid '
Copy link
Member

Choose a reason for hiding this comment

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

--sdk_location command-line option instead of just --sdk_location. Because this is how we refer to the same thing in a related error in this same file.

@aaltay
Copy link
Member

aaltay commented Oct 28, 2016

LGTM. Thank you!

@pabloem
Copy link
Member Author

pabloem commented Oct 28, 2016

@robertwb can you merge this, please? : )

asfgit pushed a commit that referenced this pull request Oct 31, 2016
@robertwb
Copy link
Contributor

robertwb commented Nov 3, 2016

@pabloem please manually close this PR (as apache doesn't give us write access to the repo).

@pabloem pabloem closed this Nov 3, 2016
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

3 participants