Skip to content

Commit

Permalink
[serve] __init__ functions have no return values (ray-project#47144)
Browse files Browse the repository at this point in the history
even for serve deployments

Signed-off-by: Lonnie Liu <[email protected]>
  • Loading branch information
aslonnie authored and simonsays1980 committed Aug 15, 2024
1 parent 9c17e13 commit 7cc321a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
15 changes: 6 additions & 9 deletions python/ray/serve/tests/test_constructor_failure.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ def __init__(self):
else:
with open(file_path) as f:
content = f.read()
if content == serve.get_replica_context().replica_id.unique_id:
raise RuntimeError("Consistently throwing on same replica.")
else:
return True
if content == serve.get_replica_context().replica_id.unique_id:
raise RuntimeError("Consistently throwing on same replica.")

async def serve(self, request):
return "hi"
Expand All @@ -92,11 +90,10 @@ def test_deploy_with_transient_constructor_failure(serve_instance):
class TransientConstructorFailureDeployment:
def __init__(self):
if os.path.exists(file_path):
return True
else:
with open(file_path, "w") as f:
f.write("ONE")
raise RuntimeError("Intentionally throw on first try.")
return
with open(file_path, "w") as f:
f.write("ONE")
raise RuntimeError("Intentionally throw on first try.")

async def serve(self, request):
return "hi"
Expand Down
2 changes: 1 addition & 1 deletion python/ray/serve/tests/test_controller_recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_recover_start_from_replica_actor_names(serve_instance, deployment_optio
)
class TransientConstructorFailureDeployment:
def __init__(self):
return True
pass

def __call__(self, *args):
return "hii"
Expand Down

0 comments on commit 7cc321a

Please sign in to comment.