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

Restart policy: resolve restarts #286

Conversation

ianmkenney
Copy link
Collaborator

No description provided.

New statestore method placeholders:
  - add_task_traceback
  - resolve_task_restarts

The compute api will add a Task Traceback and resolve restarts for
returned failed Tasks.

When a list of restart patterns are added, restarts are resolved.
* Renamed add_task_traceback to add_protocol_dag_result_ref_traceback
* Added tests for add_protocol_dag_result_ref_traceback
Implemented half of the resolve_task_restarts test
With this decorator, if a transaction isn't passed as a keyword arg, one
is automatically created (and closed). This allows a chaining behavior
where many method calls share a single transaction object.
@ianmkenney ianmkenney marked this pull request as ready for review August 23, 2024 20:10
@ianmkenney ianmkenney requested a review from dotsdl August 23, 2024 20:10
@ianmkenney ianmkenney force-pushed the feature/iss-277-restart-policy_resolve_restarts branch from 59a14b5 to c5084de Compare August 23, 2024 20:18
@ianmkenney ianmkenney force-pushed the feature/iss-277-restart-policy_resolve_restarts branch from c5084de to 8a6f980 Compare August 23, 2024 20:19
@dotsdl
Copy link
Member

dotsdl commented Aug 28, 2024

Reviewing today! Thanks @ianmkenney!

Copy link
Member

@dotsdl dotsdl left a comment

Choose a reason for hiding this comment

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

Great work @ianmkenney! There are some comments to address, but overall this is looking really slick!

Once you've addressed them, ping me for another review! I think it's likely we can merge after that.

alchemiscale/storage/models.py Outdated Show resolved Hide resolved
@@ -173,6 +178,17 @@ def transaction(self, ignore_exceptions=False) -> Transaction:
else:
tx.commit()

def chainable(func):
def inner(self, *args, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a functools.wraps to this? That will preserve the docstring when using the methods we apply this to (even though this is deep down the stack, and not user-facing).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I used the update_wrapper function instead rather than use another decorator. I think it does roughly the same thing.

alchemiscale/storage/statestore.py Outdated Show resolved Hide resolved
alchemiscale/storage/statestore.py Show resolved Hide resolved
alchemiscale/storage/statestore.py Outdated Show resolved Hide resolved
alchemiscale/tests/integration/storage/test_statestore.py Outdated Show resolved Hide resolved
alchemiscale/tests/integration/storage/test_statestore.py Outdated Show resolved Hide resolved
dotsdl and others added 8 commits September 4, 2024 10:53
* Removed custom tokenization
* Implemented _defaults to allow default tokenization to work
cancel_map has been changed from a defaultdict to a base dict and
instead using the dict.get method to return None. Additionally added a
set of all task/taskhub pairs that is later used to determine what
should be canceled.

I've also added grouping on taskhubs so the number of calls to
cancel_tasks is minimized.
Also expanded test to check behavior of the task that was meant to be
waiting.
We don't want to change `_defaults()` from what's done in the base class
unless we have real default values to leave out of the hash.
Copy link
Member

@dotsdl dotsdl left a comment

Choose a reason for hiding this comment

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

@ianmkenney much better, thank you! Good to merge into #280, though the unit tests for Tracebacks will fail without including source_keys and failure_keys in init.

@@ -137,40 +137,40 @@ def test_from_dict(self):
assert trp_reconstructed.taskhub_scoped_key == original_taskhub_scoped_key


class TestTraceback(object):
class TestTracebacks(object):
Copy link
Member

Choose a reason for hiding this comment

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

These tests don't currently pass, since we don't pass in source_keys or failure_keys in Tracebacks upon init.

@ianmkenney ianmkenney merged commit cf0e961 into feature/iss-277-restart-policy Sep 19, 2024
1 check passed
@ianmkenney ianmkenney deleted the feature/iss-277-restart-policy_resolve_restarts branch September 19, 2024 22:08
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.

2 participants