Skip to content

Change CDN files to download locally #11286

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

Merged
merged 13 commits into from
Apr 21, 2020
Merged

Change CDN files to download locally #11286

merged 13 commits into from
Apr 21, 2020

Conversation

rchiodo
Copy link

@rchiodo rchiodo commented Apr 21, 2020

For #11274

Download the index files ourselves to our temp folder. As part of this, realized we weren't actually working with jsdelivr.

// May have already been validated.
const url = moduleNameToCDNUrl(cdnBaseUrl, moduleName, moduleVersion);
if (CDNWidgetScriptSourceProvider.validUrls.has(url)) {
return url;
Copy link

@DonJayamanne DonJayamanne Apr 21, 2020

Choose a reason for hiding this comment

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

This won't work.
If the url does't exist, then we store a value into this map with a flag of false.
Its possible that httpClient.exists returns false due to 429 status code.
We might want to throw an exception when status code != 200 & !== 404, so we can retry or similar. #Resolved

Copy link
Author

Choose a reason for hiding this comment

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

Ah yes that's true. I'll fix that.


In reply to: 412309539 [](ancestors = 412309539)

Choose a reason for hiding this comment

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

Not sure this has been done.

@codecov-io
Copy link

codecov-io commented Apr 21, 2020

Codecov Report

Merging #11286 into master will decrease coverage by 0.17%.
The diff coverage is 68.21%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11286      +/-   ##
==========================================
- Coverage   61.13%   60.95%   -0.18%     
==========================================
  Files         602      603       +1     
  Lines       33151    33369     +218     
  Branches     4685     4724      +39     
==========================================
+ Hits        20266    20340      +74     
- Misses      11864    12000     +136     
- Partials     1021     1029       +8     
Impacted Files Coverage Δ
...nt/datascience/ipywidgets/ipyWidgetScriptSource.ts 12.59% <0.00%> (ø)
src/client/datascience/types.ts 100.00% <ø> (ø)
...cience/ipywidgets/cdnWidgetScriptSourceProvider.ts 79.54% <79.61%> (-4.77%) ⬇️
src/client/datascience/constants.ts 99.71% <100.00%> (+<0.01%) ⬆️
...cience/ipywidgets/ipyWidgetScriptSourceProvider.ts 88.88% <100.00%> (ø)
...ence/ipywidgets/localWidgetScriptSourceProvider.ts 88.13% <100.00%> (ø)
src/client/datascience/jupyter/jupyterSession.ts 74.38% <100.00%> (+0.21%) ⬆️
src/datascience-ui/react-common/arePathsSame.ts 75.00% <0.00%> (-12.50%) ⬇️
src/client/common/utils/platform.ts 64.70% <0.00%> (-11.77%) ⬇️
src/client/linters/pydocstyle.ts 86.66% <0.00%> (-2.23%) ⬇️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba779fa...9c5c4a8. Read the comment docs.

@rchiodo
Copy link
Author

rchiodo commented Apr 21, 2020

@DonJayamanne did you have any more changes?

Copy link

@DonJayamanne DonJayamanne left a comment

Choose a reason for hiding this comment

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

Not sure whether you have completed the pending work or not.
I think we need just one more piece of work.

// May have already been validated.
const url = moduleNameToCDNUrl(cdnBaseUrl, moduleName, moduleVersion);
if (CDNWidgetScriptSourceProvider.validUrls.has(url)) {
return url;

Choose a reason for hiding this comment

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

Not sure this has been done.

@rchiodo
Copy link
Author

rchiodo commented Apr 21, 2020

No that part is done. It looks like this now:

            const checkResult = CDNWidgetScriptSourceProvider.validUrls.get(url);
            if (checkResult) {
                return url;
            } else if (checkResult !== undefined) {
                return undefined;
            }

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@rchiodo rchiodo merged commit f95171e into master Apr 21, 2020
@rchiodo rchiodo deleted the rchiodo/cdn_local branch April 21, 2020 23:27
rchiodo added a commit that referenced this pull request Apr 22, 2020
* Working downloader

* Tests passing

* Add more tests

* Add retry test

* Fix build errors. Not sure why not happening locally.

* Fix unit tests

* Fix azure ml on windows
Rework error checking to use status

* Fix sonar error

* Add some more descriptive comments

* More comments

* Refactor some code

* Make sure to not use exists as we're downloading anyway
rchiodo added a commit that referenced this pull request Apr 22, 2020
* Change CDN files to download locally (#11286)

* Working downloader

* Tests passing

* Add more tests

* Add retry test

* Fix build errors. Not sure why not happening locally.

* Fix unit tests

* Fix azure ml on windows
Rework error checking to use status

* Fix sonar error

* Add some more descriptive comments

* More comments

* Refactor some code

* Make sure to not use exists as we're downloading anyway

* Fix container timeout from firing unnecessarily (#11336)

* Fix container timeout from firing unnecessarily

* Check for undefined for timer

* Update changelog
karthiknadig added a commit that referenced this pull request Apr 29, 2020
* Fix background (again) for ipywidgets (#11062) (#11064)

* Fix arrowing down through cells (#11095)

* Fix scrolling in the monaco editor  (#11089)

* Fix monaco editor scrolling and line height

* Add news entry

* Fixes for UI issues (#11130)

* Cherry pick commits from master into April release (#11138)

* Load widget scripts from CDN and/or local python interpreter (#10987)

* Address sonar issues
* Fix linter
* Fixes
* Better way to pas array buffer
* Added comments
* Oops

* Copy widget scripts to extension folder (#11082)

* Copy widget scripts to extension folder
* Fix test

* Remove aml scripts from extension (#11085)

* Validate python when nb opened not on extension activates (#11087)

For #10893

* Support workspace images in markdown cells (#11086)

For #10893

* Fix functional tests for ipywidgets and download just chrome b… (#11093)

For #11092

playwright downloads other browsers, we need just one chrome (as this is closest to what VSCode is built upon)

* Added tests for k3d widget (#11133)

For #10799, #11096

* Fix failing ipywidget tests (#11132)

For #11099

* Update change log

* Port perf fix to release branch (#11144)

* Fix code lens perf for interactive window (#11142)

* Eliminate first level of redundancy

* Working with a cache

* Add test to verify no more generating cell ranges

* Add news entry

* Clean up on closing

* Make sure close and reopen works

* Fix sonar errors

* Fix restart

* Fix wrong IDisposable type

* Rename restartedKernel to onKernelRestarted

* Recompute when changing settings

* Clear out document close event when document closes

* Update changelog

* Fix build error from missing file

* Port fix for transient data in notebooks. (#11168)

* Remove unwanted elements from cells when saving. (#11164)

* Remove unwanted elements from cells when saving.

* Fix a sonar warning

* FIx another sonar warning

* Update changelog

* Port undo fix to release branch (#11181)

* Fix undo in notebooks (#11167)

* Put back ctrl+z and 'z' for undo. Refactor to use one value to compute custom editor support

* Add news entry

* Update change log

* Ensure save works after saving untitled notebooks (#11190)

* Ensure save works after saving untitled notebooks
* Remove old document

* Port fix for PDF saving to release (#11194)

* Fix pdf viewer so that we just ship the standalone version. (#11192)

* Update changelog

* Fix scrolling when don't have focus (#11246)

* Account for scenarios where module name is undefined (#11248)

For #11241

* Add message when widget script is not found on CDN (#11249)

For #11247
* Add message
* Add tests
* Fix typo

* Fix failing unit tests on windows (#11191) (#11277)

Co-authored-by: Rich Chiodo <[email protected]>

* Display error message when fetching script source timesout (#11276)

For #11242
* Add error for timeout
* Add imports

* Update version and change log for release (#11279)

* Update version

* Update change logs

* Port two fixes to the release branch (#11337)

* Change CDN files to download locally (#11286)

* Working downloader

* Tests passing

* Add more tests

* Add retry test

* Fix build errors. Not sure why not happening locally.

* Fix unit tests

* Fix azure ml on windows
Rework error checking to use status

* Fix sonar error

* Add some more descriptive comments

* More comments

* Refactor some code

* Make sure to not use exists as we're downloading anyway

* Fix container timeout from firing unnecessarily (#11336)

* Fix container timeout from firing unnecessarily

* Check for undefined for timer

* Update changelog

* Wire unhandled widget messages to the jupyter output (#11273)

* Update changelog

* Cherry-pick fixes from master (#11367)

* Temporarily switch to node FS apis in KnownPathsService (#11340)
* Make sure user modules can be imported (#11353)

* Port fixes into April point release (#11392)

Cherry pick the following PRs:

#11248
#11276
#11249
#11280
#11364

* Remove isolate script when running unittest (#11378) (#11407)

* Ensure env gets used when running unittest

* Fix tests

* Move runStartupCommand to global location (#11409)

* Move startup to global (#11402)

* Update change log

* Update version and change logs (#11408)

* Fix widget tests (#11406)

Tests are broken in Release branch

* Disable CDN unit tests. Don't seem to pass on azure (#11441)

* Disable CDN unit tests. Don't seem to pass on azure

* Need to skip in other suite setup too.

* only close interactive session on interactive window close (#11405) (#11437)

* only close interactive session on interactive window close (#11405)

* Fix merge problems

Co-authored-by: Rich Chiodo <[email protected]>
Co-authored-by: Don Jayamanne <[email protected]>
Co-authored-by: Rich Chiodo <[email protected]>
Co-authored-by: Ian Huff <[email protected]>
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants