winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
4.97k stars 196 forks source link

feat(console): show resource status #6622

Closed skyrpex closed 3 months ago

skyrpex commented 3 months ago

The intent of this change is to improve the Console diagnostics when a construct fails to initialize during inflight.

image

Also, the simulator should emit these events for every resource:

Proposal: #6593.

skyrpex commented 3 months ago

@eladb @Chriscbr I have a problem. I'm trying to implement the new statuses of resources: starting, error, stopping, started, stopped. But see the following example:

bring sim;
new sim.Resource(inflight (ctx) => {
  throw "oops";
}) as "MyResource";

The "oops" error is logged after MyResource is successfully started, and there's no way for me to infer that it really was an initialization error afterwards.

I'm currently trying to figure out if I can change how this works and run these initialization inflights before marking a resource as "started", but may need a hand.

Chriscbr commented 3 months ago

I think we need to update the simulator so when it's initializing resources, if any resource fails to start, we should stop all resources that were started instead of continuing to initialize other resources. (It seems like I'm able to find some examples where this doesn't happen) @eladb WDYT?

skyrpex commented 3 months ago

I wouldn't stop all resources but any resources that depend on resources that failed to initialize.

It'd be beneficial to allow interacting with whatever is working from the app IMO, and also to detect more than one problem in different unrelated resources, too.

eladb commented 3 months ago

I am with Chris. Let's keep this transactional and simple.

I am not sure I see much value in interacting with an app that didn't fully initialize properly.

(For example, in CloudFormation if an update fails, it reverts back all the updated resources)

skyrpex commented 3 months ago

Fair enough, will do it tha way 👍🏻

monadabot commented 3 months ago

Congrats! :rocket: This was released in Wing 0.75.8.