Skip to content

Commit

Permalink
Support new client looking up 0.62 class
Browse files Browse the repository at this point in the history
  • Loading branch information
devennavani committed Oct 31, 2024
1 parent 42d99ad commit 6fcb498
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modal/cls.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ def _get_partial_functions(self) -> Dict[str, _PartialFunction]:
def _hydrate_metadata(self, metadata: Message):
assert isinstance(metadata, api_pb2.ClassHandleMetadata)
if self._class_service_function:
print("foo")
if self._class_service_function._method_functions:
# The class only has a class service service function and no method placeholders.
return
Expand All @@ -282,6 +283,17 @@ def _hydrate_metadata(self, metadata: Message):
self._class_service_function._method_functions[method.function_name] = _Function._new_hydrated(
method.function_id, self._client, method.function_handle_metadata
)
else:
# We are dealing with a pre 0.63 class that does not have a class service function and only method functions
async def _load():
pass

rep = "Function(class_function)"
self._class_service_function = _Function._from_loader(_load, rep)
for method in metadata.methods:
self._class_service_function._method_functions[method.function_name] = _Function._new_hydrated(
method.function_id, self._client, method.function_handle_metadata
)

def _get_metadata(self) -> api_pb2.ClassHandleMetadata:
class_handle_metadata = api_pb2.ClassHandleMetadata()
Expand Down

0 comments on commit 6fcb498

Please sign in to comment.