Skip to content

Commit

Permalink
hydrate functions then classes in container entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
devennavani committed Nov 28, 2024
1 parent 6f2ffcb commit 74dab8a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions modal/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,17 @@ def _init_container(self, client: _Client, running_app: RunningApp):
_App._container_app = running_app

# Hydrate objects on app
indexed_objects = dict(**self._functions, **self._classes)
for tag, object_id in running_app.tag_to_object_id.items():
if tag in indexed_objects:
obj = indexed_objects[tag]
handle_metadata = running_app.object_handle_metadata[object_id]
obj._hydrate(object_id, client, handle_metadata)
def hydrate_objects(objects_dict):
for tag, object_id in running_app.tag_to_object_id.items():
if tag in objects_dict:
obj = objects_dict[tag]
handle_metadata = running_app.object_handle_metadata[object_id]
obj._hydrate(object_id, client, handle_metadata)

# Hydrate function objects
hydrate_objects(self._functions)
# Hydrate class objects
hydrate_objects(self._classes)

@property
def registered_functions(self) -> Dict[str, _Function]:
Expand Down

0 comments on commit 74dab8a

Please sign in to comment.