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: Add cancel button to playground runs #5566

Merged
merged 4 commits into from
Dec 2, 2024

Conversation

cephalization
Copy link
Contributor

@cephalization cephalization commented Dec 2, 2024

Can cancel runs with and without datasets.

  • Client side run cancellation
    - [ ] Server side run cancellation will do this in future work
    • This means that work continues on the server, even if requests are cancelled, for both fetch and websocket initiated requests.
Cancel.prompts.mov
Cancel.Datasets.mov

resolves: #5484

Can cancel runs with and without datasets. Cancellation is purely client-side.
The backend should abort its tasks when connection with the client is lost.

// Get the response as JSON
const json = await response.json();
function fetchJsonObservable<T>(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could not find any examples of how to trigger an abort controller from a relay disposable.

Had to whip this up, surprised it works 😂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

facebook/relay#2414

People have been asking for this since 2018 apparently

@cephalization cephalization marked this pull request as ready for review December 2, 2024 18:45
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 2, 2024
Comment on lines +22 to +39
icon={
!isRunning ? (
<Icon svg={<Icons.PlayCircleOutline />} />
) : (
<div
css={css`
margin-right: var(--ac-global-dimension-static-size-50);
& > * {
height: 1em;
width: 1em;
font-size: 1.3rem;
}
`}
>
<Loading size="S" />
</div>
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

we have a loading prop on our buttons you can use instead of this i think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It also disables the button, so I can't use it

Copy link
Contributor

Choose a reason for hiding this comment

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

ahh okay, this works then

@Parker-Stafford
Copy link
Contributor

can we get an issue to track server side cancel support?

@cephalization
Copy link
Contributor Author

See #5573 for backend work

@cephalization cephalization merged commit 6bafa46 into main Dec 2, 2024
35 of 37 checks passed
@cephalization cephalization deleted the cephalization/5484-playground-run-cancel-button branch December 2, 2024 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[playground][ui] provide a way to cancel an in-progress run over a dataset
2 participants