Skip to content

Cancel when running a delete #13092

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

Merged
merged 3 commits into from
May 25, 2022
Merged

Cancel when running a delete #13092

merged 3 commits into from
May 25, 2022

Conversation

benmoriceau
Copy link
Contributor

What

We currently don't cancel a running job when we are deleting a connection.

This PR is cancelling a running job if it is getting deleted.

It is calling the existing cancel activity if the job is running before deleting the connection.

@github-actions github-actions bot added area/platform issues related to the platform area/worker Related to worker labels May 23, 2022
@@ -700,6 +703,12 @@ private void deleteConnectionBeforeTerminatingTheWorkflow() {
* Set a job as cancel and continue to the next job if and continue as a reset if needed
*/
private void reportCancelledAndContinueWith(final boolean isReset, final ConnectionUpdaterInput connectionUpdaterInput) {
reportCancelled(isReset);
resetNewConnectionInput(connectionUpdaterInput);
prepareForNextRunAndContinueAsNew(connectionUpdaterInput);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do any of these methods throw exceptions, particularly RuntimeException, as I know that we like to use that as a way to signal failures? If so, should this be in a try/finally block to allow one or two of these methods to still fire if the first one or two raises an exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Most of the method are getter/setter so very unlikely to throw a RuntimeException. The method that can throw are run using runMandatoryActivity which catch any exception and set the job in quarantine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does it sounds protected enough to you?

Copy link
Contributor

@jdpgrailsdev jdpgrailsdev left a comment

Choose a reason for hiding this comment

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

:shipit:

@benmoriceau benmoriceau requested a review from jdpgrailsdev May 23, 2022 15:22
Copy link
Contributor

@lmossman lmossman left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -122,6 +122,9 @@ public void run(final ConnectionUpdaterInput connectionUpdaterInput) throws Retr
}

if (workflowState.isDeleted()) {
if (workflowState.isRunning()) {
reportCancelled(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add a log message here indicating that we are cancelling the job due to deleting the connection

Copy link
Contributor

@jdpgrailsdev jdpgrailsdev left a comment

Choose a reason for hiding this comment

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

:shipit:

@benmoriceau benmoriceau temporarily deployed to more-secrets May 25, 2022 15:30 Inactive
@benmoriceau benmoriceau merged commit a8a13bb into master May 25, 2022
@benmoriceau benmoriceau deleted the bmoric/cancel-upon-delete branch May 25, 2022 16:27
jscottpolevault pushed a commit to jscottpolevault/airbyte that referenced this pull request Jun 1, 2022
* Cancel when running a delete

* Add log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/platform issues related to the platform area/worker Related to worker
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants