-
Notifications
You must be signed in to change notification settings - Fork 181
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
add an offline precompile workload #1195
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
86fb137
add an offline precompile workload
IanButterworth 4510bd2
suggestions
IanButterworth 4f3ecfc
fix
IanButterworth 72075d1
tweak inits
IanButterworth 9f82f5b
precompile https
IanButterworth b3e27a7
only run workload if precompiling pkgimages
IanButterworth 62d8390
Merge branch 'master' into ib/precompile
IanButterworth cb9b1f2
Update src/precompile.jl
quinnj b4358cd
Revert "Update src/precompile.jl"
IanButterworth 7ae48cd
precompile wheter or not pkgimages are used
IanButterworth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using PrecompileTools: @setup_workload, @compile_workload | ||
|
||
@setup_workload begin | ||
# These need to be safe to call here and bake into the pkgimage, i.e. called twice. | ||
Connections.__init__() | ||
IanButterworth marked this conversation as resolved.
Show resolved
Hide resolved
|
||
MultiPartParsing.__init__() | ||
Parsers.__init__() | ||
|
||
# Doesn't seem to be needed here, and might not be safe to call twice (here and during runtime) | ||
# ConnectionRequest.__init__() | ||
|
||
gzip_data(data::String) = read(GzipCompressorStream(IOBuffer(data))) | ||
|
||
cert, key = joinpath.(@__DIR__, "../test", "resources", ("cert.pem", "key.pem")) | ||
sslconfig = MbedTLS.SSLConfig(cert, key) | ||
|
||
server = HTTP.serve!("0.0.0.0", _port; verbose = -1, listenany=true, sslconfig=sslconfig) do req | ||
HTTP.Response(200, ["Content-Encoding" => "gzip"], gzip_data("dummy response")) | ||
end | ||
# listenany allows changing port if that one is already in use, so check the actual port | ||
_port = HTTP.port(server) | ||
url = "https://localhost:$_port" | ||
|
||
env = ["JULIA_NO_VERIFY_HOSTS" => "localhost", | ||
"JULIA_SSL_NO_VERIFY_HOSTS" => nothing, | ||
"JULIA_ALWAYS_VERIFY_HOSTS" => nothing] | ||
withenv(env...) do | ||
@compile_workload begin | ||
HTTP.get(url); | ||
end | ||
end | ||
|
||
HTTP.forceclose(server) | ||
server = nothing | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Yeesh; it'd be nice if PrecompileTools provided an API for all these conditions (
isprecompiling
?)