Skip to content

Commit

Permalink
Fix with_options
Browse files Browse the repository at this point in the history
  • Loading branch information
freider committed Feb 18, 2025
1 parent 8d72019 commit a609419
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 4 additions & 2 deletions modal/cls.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def hydrate_from_instance_service_function(new_function: _Function):
assert service_function.is_hydrated
assert cls.is_hydrated
# After 0.67 is minimum required version, we should be able to use method metadata directly
# from the service_function instead (see _Cls._hydrate_metadata), but for now we use the _Cls
# from the service_function instead (see _Cls._hydrate_metadata), but for now we use the Cls
# since it can take the data from the cls metadata OR function metadata depending on source
method_metadata = cls._method_metadata[method_name]
new_function._hydrate(service_function.object_id, service_function.client, method_metadata)

Expand Down Expand Up @@ -335,7 +336,7 @@ async def method_loader(fun, resolver: Resolver, existing_object_id):
# on local classes.
return _Function._from_loader(
method_loader,
rep=f"Method({k})",
rep=f"Method({self._cls._name}.{k})",
deps=lambda: [], # TODO: use cls as dep instead of loading inside method_loader?
hydrate_lazily=True,
)
Expand Down Expand Up @@ -381,6 +382,7 @@ def _initialize_from_other(self, other: "_Cls"):
self._options = other._options
self._callables = other._callables
self._name = other._name
self._method_metadata = other._method_metadata

def _get_partial_functions(self) -> dict[str, _PartialFunction]:
if not self._user_cls:
Expand Down
1 change: 0 additions & 1 deletion test/cls_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def test_call_class_sync(client, servicer, set_env_client):
assert function_map_request.function_id == service_function_id


@pytest.mark.skip()
def test_class_with_options(client, servicer):
with app.run(client=client):
with servicer.intercept() as ctx:
Expand Down

0 comments on commit a609419

Please sign in to comment.