Add full context propagation and proper interrupt handling#675
Conversation
6a7420f to
f57c9e3
Compare
f57c9e3 to
f73701e
Compare
| return err | ||
| } | ||
| return fedora.Create( | ||
| cmd.Context(), |
There was a problem hiding this comment.
I know it is draft but if you are moving this all over, may would it make sense to make it part of the maptContext?
c82ccc3 to
1598095
Compare
668edfc to
10cec98
Compare
| return v.Struct(r) | ||
| } | ||
|
|
||
| func Create(mCtxArgs *mc.ContextArgs, args *EKSArgs) (err error) { |
There was a problem hiding this comment.
I am not against rename, but if you do not rename this...all these files will not be changed on this PR right?
There was a problem hiding this comment.
Well not all, actually the ekf.go it would require 1 change but bunch of them will not change if you just kept the original name mcCtxArgs no?
10cec98 to
90d96fc
Compare
…TERM cancellation This refactor removes all hard-coded context.Background() / context.TODO() calls and ensures the CLI's cancellable context (cmd.Context()) flows through every layer of MAPT: • CLI -> ContextArgs -> mc.Init() -> Providers -> Actions -> Data layer • AWS: AMI queries, region/zone discovery, S3 ops, Spot pricing, host waiters • Azure: compute selectors, image discovery, ResourceGraph queries • Pulumi: stack create/update/destroy, previews, refresh, output retrieval Key changes: - Add `Context` to ContextArgs and centralize fallback handling in mc.Init() - Update Provider interface so Init(ctx) receives the real execution context - Rename parameters for clarity (e.g., ca -> contextArgs) - Replace all Background()/TODO() calls with propagated context - Fix async loops and pagers to derive from parent context - Ensure cancellations interrupt in-flight SDK calls and Pulumi operations No functional logic changes besides enabling proper cancellation. This ensures Ctrl+C properly cancels in-flight operations while supporting library consumers who need custom context management. Signed-off-by: Jose Angel Morena <jmorenas@redhat.com>
90d96fc to
d953f56
Compare
|
Hey got one question did you try this out, I mean what is status for state file? if ctrl+c if you try to destroy them afterwards is it locked? |
Hey @adrianriobo, Here is the log when This demonstrates how a And here is the log when running Destroy runs normally. Pulumi emits the standard “pending operations” warning from the previously |
This MR adds full context propagation to MAPT so that interrupts (SIGINT/SIGTERM, e.g., Ctrl+C) cleanly cancel ongoing Pulumi tasks instead of leaving them running in the background. This completes the fix for #630.
Changes
ctx.context.Background()usages.Why
Previously, interrupting MAPT didn’t cancel the underlying Pulumi task, often leaving partial resources and inconsistent state. Cancellation is now fully propagated to Pulumi, ensuring immediate, deterministic shutdown.
Testing
Verified Ctrl+C cancels
aws fedora createmid-update.Command used:
Pulumi logs reflect clean cancellation events.
Destroy operations behave correctly after interruption.
Issue
Fixes #630.