-
Notifications
You must be signed in to change notification settings - Fork 3
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
now pylzy does not abort workflow in case of grpc error[WIP] #1074
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ | |
TypeVar, cast, Set, ) | ||
|
||
from ai.lzy.v1.whiteboard.whiteboard_pb2 import Whiteboard | ||
from grpc.aio import AioRpcError | ||
|
||
from lzy.api.v1.env import Env | ||
from lzy.api.v1.provisioning import Provisioning | ||
from lzy.api.v1.snapshot import Snapshot, DefaultSnapshot | ||
|
@@ -41,15 +43,15 @@ def get_active(cls) -> Optional["LzyWorkflow"]: | |
return cls.instance | ||
|
||
def __init__( | ||
self, | ||
name: str, | ||
owner: "Lzy", | ||
env: Env, | ||
provisioning: Provisioning, | ||
auto_py_env: PyEnv, | ||
*, | ||
eager: bool = False, | ||
interactive: bool = True | ||
self, | ||
name: str, | ||
owner: "Lzy", | ||
env: Env, | ||
provisioning: Provisioning, | ||
auto_py_env: PyEnv, | ||
*, | ||
eager: bool = False, | ||
interactive: bool = True | ||
): | ||
if not is_name_valid(name): | ||
raise ValueError(f"Invalid workflow name. Name can contain only {NAME_VALID_SYMBOLS}") | ||
|
@@ -145,6 +147,8 @@ def __enter__(self) -> "LzyWorkflow": | |
self.__snapshot = DefaultSnapshot(self.owner.serializer_registry, storage_uri, self.owner.storage_client, | ||
self.owner.storage_name) | ||
return self | ||
except AioRpcError as e: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
raise e | ||
except Exception as e: | ||
try: | ||
self.__abort() | ||
|
@@ -167,6 +171,8 @@ def __exit__(self, exc_type, exc_val, exc_tb) -> None: | |
finally: | ||
if exc_type is None: | ||
self.__destroy() | ||
elif exc_type is AioRpcError: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here may be UNAVAILABLE, so we must abort wf in this case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. UNAVAILABLE is retryable error. Python lzy-client should repeat request in case. If after an amount of attempts lzy service is still unavailable so I believe that it is really UNAVAILABLE and an abort request is useless :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
raise exc_val | ||
else: | ||
try: | ||
self.__abort() | ||
|
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.
Remove tab here please
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.
ok