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

Adjust workaround for Windows precompilation on Julia 1.8.2+ #4451

Closed
wants to merge 8 commits into from

Conversation

BioTurboNick
Copy link
Member

My goal here is to still precompile on normal computers, but only skip it if there's a problem in CI

Providing a warning will also allow the issue to be monitored, and if someone ever encounters it outside of the CI system, maybe we can learn more about the issue.

Adjustment to #4406, based on work in #4445

My goal here is to still precompile on normal computers, but only skip it if there's a problem.

Providing a warning will also allow the issue to be monitored, and if someone ever encounters it outside of the CI system, maybe we can learn more about the issue.
@codecov
Copy link

codecov bot commented Oct 9, 2022

Codecov Report

Base: 80.60% // Head: 79.61% // Decreases project coverage by -0.98% ⚠️

Coverage data is based on head (409c3a1) compared to base (e9fb3b3).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4451      +/-   ##
==========================================
- Coverage   80.60%   79.61%   -0.99%     
==========================================
  Files          30       41      +11     
  Lines        7466     8218     +752     
==========================================
+ Hits         6018     6543     +525     
- Misses       1448     1675     +227     
Impacted Files Coverage Δ
src/precompilation.jl 0.00% <0.00%> (ø)
RecipesPipeline/src/plot_recipe.jl 96.00% <0.00%> (ø)
RecipesPipeline/src/recipes.jl 18.75% <0.00%> (ø)
RecipesPipeline/src/utils.jl 62.66% <0.00%> (ø)
RecipesPipeline/src/group.jl 46.05% <0.00%> (ø)
RecipesPipeline/src/series_recipe.jl 93.10% <0.00%> (ø)
RecipesPipeline/src/series.jl 79.01% <0.00%> (ø)
RecipesPipeline/src/api.jl 47.91% <0.00%> (ø)
RecipesPipeline/src/type_recipe.jl 94.11% <0.00%> (ø)
RecipesPipeline/src/user_recipe.jl 67.50% <0.00%> (ø)
... and 2 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@BioTurboNick
Copy link
Member Author

This works to avoid the CI error but the warning doesn't show up...

@t-bltg
Copy link
Member

t-bltg commented Oct 10, 2022

I'm a bit reluctant to use try catch, but if there is no other solution 🤷

Can you check that this has no impact on TTFP by running this snippet against PR and master ?

For this PR to go in, it's mandatory that the warning shows up somehow ...

@BioTurboNick
Copy link
Member Author

Will do, though my expectation is that try/catch has 0 cost unless an exception occurs.

Also will see if there's a way to get the warning to show up...

@BioTurboNick
Copy link
Member Author

Hopefully Pkg will get updated to print warnings... but in the meantime I'm trying to split out the precompilation step.

No meaningful changes with your test:

This PR:

[ Info: Testing plot: gr:1:Lines
  5.655193 seconds (619.41 k allocations: 30.557 MiB, 96.26% compilation time: 17% of which was recompilation)
[ Info: Testing plot: gr:5:Global
  7.506398 seconds (5.35 M allocations: 278.584 MiB, 0.72% gc time, 98.57% compilation time: 15% of which was recompilation)
[ Info: Testing plot: gr:10:Histogram2D
  7.062520 seconds (5.31 M allocations: 273.760 MiB, 0.77% gc time, 97.69% compilation time: 24% of which was recompilation)
[ Info: Testing plot: gr:11:Line types
  6.189333 seconds (1.80 M allocations: 94.286 MiB, 0.18% gc time, 97.44% compilation time: 15% of which was recompilation)
[ Info: Testing plot: gr:13:Marker types
  5.648293 seconds (1.27 M allocations: 65.038 MiB, 0.41% gc time, 96.66% compilation time: 17% of which was recompilation)
[ Info: Testing plot: gr:14:Bar
  5.976484 seconds (2.36 M allocations: 122.219 MiB, 0.44% gc time, 97.55% compilation time: 15% of which was recompilation)
[ Info: Testing plot: gr:15:Histogram
  6.275911 seconds (2.16 M allocations: 111.721 MiB, 0.46% gc time, 97.58% compilation time: 15% of which was recompilation)
[ Info: Testing plot: gr:16:Subplots
  5.654838 seconds (2.44 M allocations: 127.513 MiB, 0.61% gc time, 97.36% compilation time: 5% of which was recompilation)
[ Info: Testing plot: gr:19:Open/High/Low/Close
  5.382036 seconds (622.97 k allocations: 30.632 MiB, 97.27% compilation time: 17% of which was recompilation)
[ Info: Testing plot: gr:20:Annotations
  6.147232 seconds (1.46 M allocations: 76.049 MiB, 0.38% gc time, 97.30% compilation time: 15% of which was recompilation)
[ Info: Testing plot: gr:23:Pie
  5.684500 seconds (2.12 M allocations: 109.684 MiB, 0.47% gc time, 97.34% compilation time: 16% of which was recompilation)
[ Info: Testing plot: gr:24:3D
  7.345284 seconds (6.56 M allocations: 347.045 MiB, 0.97% gc time, 97.69% compilation time: 17% of which was recompilation)
[ Info: Testing plot: gr:27:Polar Plots
  5.793958 seconds (2.33 M allocations: 119.470 MiB, 0.43% gc time, 97.15% compilation time: 16% of which was recompilation)
[ Info: Testing plot: gr:28:Heatmap, categorical axes, and aspect_ratio
  6.037911 seconds (5.02 M allocations: 258.289 MiB, 0.84% gc time, 97.41% compilation time: 11% of which was recompilation)
[ Info: Testing plot: gr:35:Lines and markers with varying colors
  7.012856 seconds (3.38 M allocations: 171.590 MiB, 0.49% gc time, 97.42% compilation time: 20% of which was recompilation)
[ Info: Testing plot: gr:38:Histogram2D (complex values)
  7.699116 seconds (5.36 M allocations: 277.040 MiB, 0.78% gc time, 97.50% compilation time: 23% of which was recompilation)
[ Info: Testing plot: gr:53:Step Types
  6.307477 seconds (1.38 M allocations: 70.910 MiB, 0.25% gc time, 96.82% compilation time: 17% of which was recompilation)
[ Info: Testing plot: gr:54:Guide positions and alignment
  6.537754 seconds (2.43 M allocations: 127.004 MiB, 0.53% gc time, 97.12% compilation time: 15% of which was recompilation)
[ Info: Testing plot: gr:56:Bar plot customizations
  8.401432 seconds (6.46 M allocations: 336.032 MiB, 0.78% gc time, 97.57% compilation time: 16% of which was recompilation)
[ Info: Testing plot: gr:57:Vertical and horizonal spans
  5.964574 seconds (2.29 M allocations: 119.582 MiB, 0.57% gc time, 99.07% compilation time: 16% of which was recompilation)
[ Info: Testing plot: gr:58:Stacked area chart
  5.805148 seconds (1.88 M allocations: 98.845 MiB, 0.38% gc time, 97.38% compilation time: 16% of which was recompilation)
[ Info: Testing plot: gr:60:3D projection
  6.386352 seconds (3.74 M allocations: 201.672 MiB, 0.69% gc time, 97.05% compilation time: 15% of which was recompilation)

Master:

[ Info: Testing plot: gr:1:Lines
  5.613083 seconds (619.41 k allocations: 30.557 MiB, 97.31% compilation time: 17% of which was recompilation)
[ Info: Testing plot: gr:5:Global
  8.354652 seconds (5.35 M allocations: 278.554 MiB, 0.78% gc time, 98.58% compilation time: 14% of which was recompilation)
[ Info: Testing plot: gr:10:Histogram2D
  7.507841 seconds (5.31 M allocations: 273.706 MiB, 0.75% gc time, 97.41% compilation time: 24% of which was recompilation)
[ Info: Testing plot: gr:11:Line types
  6.684317 seconds (1.80 M allocations: 94.287 MiB, 0.19% gc time, 96.55% compilation time: 15% of which was recompilation)
[ Info: Testing plot: gr:13:Marker types
  6.077824 seconds (1.27 M allocations: 65.038 MiB, 0.40% gc time, 96.36% compilation time: 17% of which was recompilation)
[ Info: Testing plot: gr:14:Bar
  6.550258 seconds (2.36 M allocations: 122.184 MiB, 0.44% gc time, 96.95% compilation time: 16% of which was recompilation)
[ Info: Testing plot: gr:15:Histogram
  6.731952 seconds (2.16 M allocations: 111.684 MiB, 0.45% gc time, 97.42% compilation time: 14% of which was recompilation)
[ Info: Testing plot: gr:16:Subplots
  6.197699 seconds (2.44 M allocations: 127.459 MiB, 0.58% gc time, 96.64% compilation time: 5% of which was recompilation)
[ Info: Testing plot: gr:19:Open/High/Low/Close
  5.714670 seconds (623.41 k allocations: 30.669 MiB, 97.04% compilation time: 17% of which was recompilation)
[ Info: Testing plot: gr:20:Annotations
  6.609132 seconds (1.46 M allocations: 76.049 MiB, 0.37% gc time, 96.92% compilation time: 15% of which was recompilation)
[ Info: Testing plot: gr:23:Pie
  6.078643 seconds (2.12 M allocations: 109.684 MiB, 0.51% gc time, 97.47% compilation time: 16% of which was recompilation)
[ Info: Testing plot: gr:24:3D
  8.208433 seconds (6.56 M allocations: 347.044 MiB, 0.94% gc time, 97.23% compilation time: 17% of which was recompilation)
[ Info: Testing plot: gr:27:Polar Plots
  6.280720 seconds (2.33 M allocations: 119.471 MiB, 0.42% gc time, 97.38% compilation time: 16% of which was recompilation)
[ Info: Testing plot: gr:28:Heatmap, categorical axes, and aspect_ratio
  6.415254 seconds (5.02 M allocations: 258.289 MiB, 0.99% gc time, 96.97% compilation time: 11% of which was recompilation)
[ Info: Testing plot: gr:35:Lines and markers with varying colors
  7.124340 seconds (3.38 M allocations: 171.590 MiB, 0.52% gc time, 97.51% compilation time: 20% of which was recompilation)
[ Info: Testing plot: gr:38:Histogram2D (complex values)
  7.863605 seconds (5.36 M allocations: 277.060 MiB, 0.65% gc time, 97.49% compilation time: 24% of which was recompilation)
[ Info: Testing plot: gr:53:Step Types
  5.988806 seconds (1.38 M allocations: 70.910 MiB, 0.27% gc time, 97.16% compilation time: 16% of which was recompilation)
[ Info: Testing plot: gr:54:Guide positions and alignment
  6.512555 seconds (2.43 M allocations: 126.898 MiB, 0.53% gc time, 96.69% compilation time: 15% of which was recompilation)
[ Info: Testing plot: gr:56:Bar plot customizations
  8.057016 seconds (6.46 M allocations: 335.961 MiB, 0.87% gc time, 97.95% compilation time: 17% of which was recompilation)
[ Info: Testing plot: gr:57:Vertical and horizonal spans
  5.926309 seconds (2.29 M allocations: 119.582 MiB, 0.56% gc time, 99.04% compilation time: 16% of which was recompilation)
[ Info: Testing plot: gr:58:Stacked area chart
  5.822009 seconds (1.88 M allocations: 98.845 MiB, 0.40% gc time, 97.47% compilation time: 16% of which was recompilation)
[ Info: Testing plot: gr:60:3D projection
  6.718975 seconds (3.74 M allocations: 201.672 MiB, 0.68% gc time, 96.71% compilation time: 14% of which was recompilation)

@BioTurboNick
Copy link
Member Author

Hmm. Tried a few things and no way so far to get precompilation to print anything unless there's an error thrown?

Inquiring here: JuliaLang/Pkg.jl#3224

Comment on lines +28 to +34
# During precompilation on the Windows GitHub CI in Julia 1.8.2+,
# can fail here due to GR potentially failing to write out the
# temporary file. Pending a fix, swallow the error and continue.
$func()
catch
@debug "Plots: Failed a trial save during precompilation"
end
Copy link
Member

@t-bltg t-bltg Oct 11, 2022

Choose a reason for hiding this comment

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

Suggested change
# During precompilation on the Windows GitHub CI in Julia 1.8.2+,
# can fail here due to GR potentially failing to write out the
# temporary file. Pending a fix, swallow the error and continue.
$func()
catch
@debug "Plots: Failed a trial save during precompilation"
end
$func()
catch e
if e isa SystemError && Sys.iswindows() && get(ENV, "CI", "false") == "true"
# During precompilation on the Windows GitHub CI in Julia 1.8.2+,
# can fail here due to GR potentially failing to write out the
# temporary file. Pending a fix, swallow the error and continue.
@debug "Plots: Failed a trial save during precompilation" e
else
rethrow()
end
end

If the warning doesn't work as expected, then maybe silently ignore precompilation SystemEror on windows ci, else throw for hard error.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's fair. We probably want rethrow() though?

Copy link
Member

Choose a reason for hiding this comment

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

Ha, yes I took rethrow(e) note in https://docs.julialang.org/en/v1/base/base/#Base.rethrow too seriously.

Comment on lines +52 to +62
env:
JULIA_PKG_PRECOMPILE_AUTO: 0

# surface errors during precompilation
# auto-precompile in build step suppresses errors currently.
- name: Precompile
env:
JULIA_DEBUG: Plots
shell: julia --project=@. --color=yes {0}
run: |
using Pkg; Pkg.precompile()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
env:
JULIA_PKG_PRECOMPILE_AUTO: 0
# surface errors during precompilation
# auto-precompile in build step suppresses errors currently.
- name: Precompile
env:
JULIA_DEBUG: Plots
shell: julia --project=@. --color=yes {0}
run: |
using Pkg; Pkg.precompile()

That does not seem to work as intended right ? No warning appear on windows 1.8.2.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, at the moment it does not. Was hoping for another workaround from the Pkg issue.

@t-bltg
Copy link
Member

t-bltg commented Jan 12, 2023

Superseded by #4617.

@t-bltg t-bltg closed this Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants