-
Notifications
You must be signed in to change notification settings - Fork 647
WaitFor/WaitForCompletion implementation. #5394
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
Conversation
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Co-authored-by: David Fowler <davidfowl@gmail.com>
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/// </example> | ||
public static IResourceBuilder<T> WaitFor<T>(this IResourceBuilder<T> builder, IResourceBuilder<IResource> dependency) where T : IResource | ||
{ | ||
builder.ApplicationBuilder.Eventing.Subscribe<BeforeResourceStartedEvent>(builder.Resource, async (e, ct) => |
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.
Another downside to doing it this way instead of a single wait for callback with lots of data is that first one to throw will stop other errors from coming through since the wait is sequential.
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.
Maybe for this event we should invoke them all in parallel and then await them all together.
…ils before going into a running state.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Follow up feedback for dotnet#5394.
Follow up feedback for #5394.
Description
This PR introduces two new extension APIs to the
IResourceBuilder<T>
interface:Using these APIs it is possible to block the start of one resource depending on the start or completion of another resource.
The
WaitFor(...)
extension will wait until the resource enters theRunning
state, and theWaitForCompletion
will wait until it is in theFinished
state.The
WaitFor
/WaitForCompletion
methods build upon the eventing mechanism that was recently added. It waits for the resource started event and then uses theResourceNotification
service to wait until the resource reaches the desired state. In a subsequent PR we will build on this to support waiting until the resource is healthy in addition to just being in a running state.Resources in a waiting state will have their state changed to
Waiting
with the same iconography as Starting (hence the small changes to dashboard/known state code).Fixes # (issue)
Checklist
<remarks />
and<code />
elements on your triple slash comments?Microsoft Reviewers: Open in CodeFlow