-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fixed and Added unit tests for EnsureResourceAsync hanging issue #4943
Fixed and Added unit tests for EnsureResourceAsync hanging issue #4943
Conversation
This reverts commit 63b3f33.
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 added a check to ensure only resources downloaded from the "aka.ms" host can use EnsureResourceAsync(). I have also edited the unit test for EnsureResourceAsync() to reflect 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.
Fixed EnsureResourceAsync by removing the helper function ResourceManagerUtils.CheckValidDownload and by using WebClientResponseUri (an extension of WebClient). Also added unit test for EnsureResourceAsync.
ResourceManagerUtils.EnsureResourceAsync(...) appends the relative URL of a resource to the $MlNetResourcesUrl environment variable (equal to "https://aka.ms/mlnet-resources/" by default).
machinelearning/src/Microsoft.ML.Core/Utilities/ResourceManagerUtils.cs
Line 34 in cdb1e4b
For example, this occurs in the unit test WordEmbeddingsTest.TestWordEmbeddings(), where
sentimend.emd
is downloaded from https://aka.ms/mlnet-resources/Text/Sswe/sentiment.emd .There is a possibility of this combined URL not correctly pointing to a resource, which is why this CheckValidDownload function exists:
machinelearning/src/Microsoft.ML.Core/Utilities/ResourceManagerUtils.cs
Lines 168 to 184 in cdb1e4b
This function was not correctly warning that the HTML of www.microsoft.com was downloaded (instead of an intended data file), as the size of microsoft.com is bigger than 4 kilobytes, and the site should have the sub-strings <head and <body (not and ).