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

{Script} Add retry in get_whl_from_url and only verify latest version of an extension #2987

Merged
merged 8 commits into from
Feb 10, 2021

Conversation

fengzhou-msft
Copy link
Member

@fengzhou-msft fengzhou-msft commented Feb 8, 2021

To mitigate the increasing failures in Verify Extensions Index CI task recently.


This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally?

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your PR is merged into master branch, a new PR will be created to update src/index.json automatically.
The precondition is to put your code inside this repo and upgrade the version in the PR but do not modify src/index.json.

@yonzhan
Copy link
Collaborator

yonzhan commented Feb 8, 2021

Script

@fengzhou-msft fengzhou-msft changed the title {Script} Add retry in get_whl_from_url {Script} Add retry in get_whl_from_url and only verify latest version of an extension Feb 9, 2021
@@ -21,6 +21,10 @@

from util import get_ext_metadata, get_whl_from_url, get_index_data, verify_dependency

# Some extensions are published through manually submitted PRs and the latest version may not be in the end of
# the version list in index.json. Let's just test all versions for these extensions.
EXTS_TEST_ALL_VERSIONS = {'azure-cli-ml', 'alias', 'azure_iot'}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can sort all versions and only test the latest one?

Copy link
Member

Choose a reason for hiding this comment

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

Python's built-in function max supports a custom key extraction function and we can use packaging.version for version comparison.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated with picking a max version so the order of versions does not matter now.

scripts/ci/test_index.py Outdated Show resolved Hide resolved
item['sha256Digest'],
item['filename']))
# only test the latest version
item = max(exts, key=lambda ext: LooseVersion(ext['metadata']['version']))
Copy link
Member

Choose a reason for hiding this comment

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

distutils.version.LooseVersion is legacy and conformant only to the superseded PEP 386 (by PEP 440). Perhaps we can migrate to the latest packaging.version.

See https://stackoverflow.com/a/11887885/2199657

Copy link
Member

@jiasli jiasli Feb 9, 2021

Choose a reason for hiding this comment

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

LooseVersion doesn't comply with PEP 440 and can't handle pre-release versions.

>>> from distutils.version import LooseVersion, StrictVersion
>>> StrictVersion('1.0.0a1') < StrictVersion('1.0.0')
True
>>> LooseVersion('1.0.0a1') < LooseVersion('1.0.0')
False

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.

3 participants