-
Notifications
You must be signed in to change notification settings - Fork 189
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): in-place app updates in simulator #5821
Conversation
In order to reduce iteration time when updating an application, introduce a new simulator API to support in-place updates of an app in the simulator. It is now possible to use `simulator.update(simDir)` without needing to stop the simulator and start a new instance. This method will analyze the diff between the currently loaded app and the new app defined in `simDir` and will create/update/delete resources accordingly. This implies that if a resource was not updated, it won't be restarted across app updates. As a future improvement, we can add support for watching the sim directory and automatically updating the app inside the simulator. Wow!
Thanks for opening this pull request! 🎉
|
Console preview environment is available at https://wing-console-pr-5821.fly.dev 🚀 Last Updated (UTC) 2024-03-12 16:20 |
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.
This looks very good! Can't wait to use it.
BenchmarksComparison to Baseline ⬜⬜🟩⬜⬜⬜⬜🟥⬜⬜⬜⬜🟥
⬜ Within 1.5 standard deviations Benchmarks may vary outside of normal expectations, especially when running in GitHub Actions CI. Results
Last Updated (UTC) 2024-03-12 16:26 |
Signed-off-by: monada-bot[bot] <monabot@monada.co>
Co-authored-by: Cristian Pallarés <cristianp@wing.cloud>
Co-authored-by: Mark McCulloh <Mark.McCulloh@gmail.com>
Signed-off-by: monada-bot[bot] <monabot@monada.co>
libs/wingsdk/test/simulator/__snapshots__/simulator.test.ts.snap
Outdated
Show resolved
Hide resolved
Signed-off-by: monada-bot[bot] <monabot@monada.co>
Signed-off-by: monada-bot[bot] <monabot@monada.co>
Thanks for contributing, @eladb! This PR will now be added to the merge queue, or immediately merged if |
Congrats! 🚀 This was released in Wing 0.61.0. |
Wing Console used `tryGetResource` and expected it to return `undefined` if the node was not found, but #5821 did not respect this contract. Fixed and added a test. Fixes #5923 Fixes #5922 ## Checklist - [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [x] Description explains motivation and solution - [x] Tests added (always) - [x] Docs updated (only required for features) - [x] 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](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
In order to improve iteration speed when updating an application, introduce a new simulator API to support in-place updates of an app in the simulator.
It is now possible to use
simulator.update(simDir)
without needing to stop the simulator and start a new instance. This method will analyze the diff between the currently loaded app and the new app defined insimDir
and will create/update/delete resources accordingly.This implies that if a resource was not updated, it won't be restarted across app updates.
The way this works is that when
update(simDir)
is called, we read the newsimulator.json
file and analyze the diff between the current resource configuration and the new one to determine which resources were added (exists only in the new config), removed (doesn't exist in the new config), updated (an attribute was changed) or retained (no change). Then, we:Modeled dependencies via an execution graph. This allows us to automatically replace any dependent resources and start in topological order.
Until we can deprecate
sim.State
(waiting for #5882), we sill have an initialization loop which allows late resolution of tokens.Next step is to update the Wing Console to use this new API when a new version of the app is compiled.
Future improvements
give resources an opportunity to do an in-place update (basically call
resource.update()
).updating the app inside the simulator. Wow!
Misc
The
api.cleanup()
method did not wait for the server to close.Checklist
pr/e2e-full
label if this feature requires end-to-end testingBy submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.