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

change: Remove throw from local task cancellation #856

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

shpface
Copy link
Contributor

@shpface shpface commented Jan 20, 2024

Issue #, if available:

Description of changes:
Cancellation of AWS tasks is a best effort process. Attempting to cancel an AWS task which has already completed is not an error. This change will make local tasks behave the same way.

Testing done:

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@shpface shpface requested a review from a team as a code owner January 20, 2024 03:59
Copy link

codecov bot commented Jan 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4b5f690) 100.00% compared to head (13b6781) 100.00%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #856   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          129       129           
  Lines         8519      8532   +13     
  Branches      1905      1908    +3     
=========================================
+ Hits          8519      8532   +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

speller26
speller26 previously approved these changes Jan 20, 2024
Since this class is instantiated with the results, there is nothing to cancel. Attempting
to cancel an already completed task is not an error.
"""
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

I have mixed feelings about using pass here. What would your thoughts be if we instead used a log line indicating local tasks are already complete on instantiation or some better worded statement?

@@ -42,8 +42,12 @@ def id(self) -> str:
return str(self._id)

def cancel(self) -> None:
"""Cancel the quantum task."""
raise NotImplementedError("Cannot cancel completed local task")
"""Attempt to cancel the quantum task.
Copy link
Contributor

@AbeCoull AbeCoull Jan 26, 2024

Choose a reason for hiding this comment

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

nit: if we are always using pass and the task is expected to be complete, attempt has the wrong implication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants