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

feat(sdk): reuse volumes for sim.Container #6336

Merged
merged 4 commits into from
Apr 26, 2024
Merged

Conversation

Chriscbr
Copy link
Contributor

@Chriscbr Chriscbr commented Apr 25, 2024

Another pass at solving #6284

The approach taken in #6295 where we allow users to bind to the state directory is problematic because docker sometimes changes the permissions of directories on the user's file system after mounting them. This was causing wing test to fail (fixed in #6320) and wing pack to fail as well.

This PR reworks the API so that data can be persisted via named volumes. Specifically, an anonymous docker volume can be specified, and Wing will automatically name it and reuse it across Wing Console runs. The change should fix the previous issues since named volumes are managed by docker.

The main downside of this approach is that deleting your target directory or the state files in .state/ will not clean everything up all resources/files created by Wing from your machine, as Docker volumes may still exist. Eventually we can provide some facilities for automatically cleaning these, but we're leaving it intentionally out of scope until this general approach has been validated.

Checklist

  • Title matches Winglang's style guide
  • Description explains motivation and solution
  • Tests added (always)
  • Docs updated (only required for features)
  • Added pr/e2e-full label if this feature requires end-to-end testing

By submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.

@Chriscbr Chriscbr requested a review from a team as a code owner April 25, 2024 20:05
Copy link

Thanks for opening this pull request! 🎉
Please consult the contributing guidelines for details on how to contribute to this project.
If you need any assistence, don't hesitate to ping the relevant owner over Slack.

Topic Owner
Wing SDK and utility APIs @chriscbr
Wing Console @ainvoner, @skyrpex, @polamoros
JSON, structs, primitives and collections @hasanaburayyan
Platforms and plugins @hasanaburayyan
Frontend resources (website, react, etc) @tsuf239
Language design @chriscbr
VSCode extension and language server @markmcculloh
Compiler architecture, inflights, lifting @yoav-steinberg
Wing Testing Framework @tsuf239
Wing CLI @markmcculloh
Build system, dev environment, releases @markmcculloh
Library Ecosystem @chriscbr
Documentation @hasanaburayyan
SDK test suite @tsuf239
Examples @hasanaburayyan
Wing Playground @eladcon

@monadabot
Copy link
Contributor

monadabot commented Apr 25, 2024

Console preview environment is available at https://wing-console-pr-6336.fly.dev 🚀

Last Updated (UTC) 2024-04-25 20:34

@monadabot
Copy link
Contributor

monadabot commented Apr 25, 2024

Benchmarks

Comparison to Baseline ⬜⬜⬜⬜🟥⬜🟥🟥🟥⬜⬜🟥⬜
Benchmark Before After Change
version 59ms±0.67 59ms±0.68 0ms (-0.12%)⬜
functions_1.test.w -t sim 399ms±7.65 395ms±3.46 -4ms (-1.05%)⬜
functions_1.test.w -t tf-aws 816ms±7.94 824ms±7.39 +8ms (+1%)⬜
jsii_big.test.w -t sim 2780ms±18.44 2818ms±18.5 +38ms (+1.36%)⬜
jsii_big.test.w -t tf-aws 2988ms±15.77 3021ms±15.46 +34ms (+1.12%)🟥
functions_10.test.w -t sim 489ms±8.11 494ms±11.72 +4ms (+0.9%)⬜
functions_10.test.w -t tf-aws 1997ms±12.67 2045ms±8.44 +47ms (+2.37%)🟥
jsii_small.test.w -t sim 367ms±3.06 375ms±3.34 +9ms (+2.44%)🟥
jsii_small.test.w -t tf-aws 599ms±5.47 612ms±3.97 +13ms (+2.17%)🟥
empty.test.w -t sim 364ms±7.31 369ms±6.13 +5ms (+1.46%)⬜
empty.test.w -t tf-aws 600ms±3.93 603ms±4.63 +3ms (+0.48%)⬜
hello_world.test.w -t sim 391ms±3.63 404ms±4.03 +13ms (+3.38%)🟥
hello_world.test.w -t tf-aws 1504ms±7.75 1517ms±10.56 +13ms (+0.86%)⬜

⬜ Within 1.5 standard deviations
🟩 Faster, Above 1.5 standard deviations
🟥 Slower, Above 1.5 standard deviations

Benchmarks may vary outside of normal expectations, especially when running in GitHub Actions CI.

Results
name mean min max moe sd
version 59ms 58ms 61ms 1ms 1ms
functions_1.test.w -t sim 395ms 387ms 401ms 3ms 5ms
functions_1.test.w -t tf-aws 824ms 810ms 845ms 7ms 10ms
jsii_big.test.w -t sim 2818ms 2789ms 2865ms 19ms 26ms
jsii_big.test.w -t tf-aws 3021ms 2989ms 3048ms 15ms 22ms
functions_10.test.w -t sim 494ms 469ms 510ms 12ms 16ms
functions_10.test.w -t tf-aws 2045ms 2026ms 2070ms 8ms 12ms
jsii_small.test.w -t sim 375ms 368ms 384ms 3ms 5ms
jsii_small.test.w -t tf-aws 612ms 604ms 622ms 4ms 6ms
empty.test.w -t sim 369ms 356ms 384ms 6ms 9ms
empty.test.w -t tf-aws 603ms 591ms 612ms 5ms 6ms
hello_world.test.w -t sim 404ms 396ms 413ms 4ms 6ms
hello_world.test.w -t tf-aws 1517ms 1495ms 1540ms 11ms 15ms
Last Updated (UTC) 2024-04-25 20:40

@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Apr 25, 2024
@Chriscbr Chriscbr removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Apr 25, 2024
Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

This is very cool. Like this solution better than the magic env var.

Copy link
Contributor

mergify bot commented Apr 26, 2024

Thanks for contributing, @Chriscbr! This PR will now be added to the merge queue, or immediately merged if rybickic/named-volumes is up-to-date with main and the queue is empty.

mergify bot added a commit that referenced this pull request Apr 26, 2024
@mergify mergify bot merged commit 9bb0624 into main Apr 26, 2024
25 checks passed
@mergify mergify bot deleted the rybickic/named-volumes branch April 26, 2024 11:41
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.72.10.

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.

3 participants