[EC Connector] Optimize remote cache check in scheduler (#32585)
Signed-off-by: knlnguyen1802 <knlnguyen1802@gmail.com>
This commit is contained in:
@@ -182,19 +182,19 @@ class ECConnectorBase(ABC):
|
||||
# ==============================
|
||||
|
||||
@abstractmethod
|
||||
def has_caches(
|
||||
def has_cache_item(
|
||||
self,
|
||||
request: "Request",
|
||||
) -> list[bool]:
|
||||
identifier: str,
|
||||
) -> bool:
|
||||
"""
|
||||
Check if encoder cache exists for each mm data of requests
|
||||
Check if a single encoder cache exists
|
||||
|
||||
Args:
|
||||
request (Request): the request object.
|
||||
identifier (str): the identifier of the media.
|
||||
|
||||
Returns:
|
||||
A list bool where ith value is True if cache exist for
|
||||
ith mm_data of requests
|
||||
A bool where value is True if cache exist for
|
||||
the media
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@@ -117,23 +117,20 @@ class ECExampleConnector(ECConnectorBase):
|
||||
safetensors.torch.save_file(tensors, filename)
|
||||
logger.debug("Save cache successful for mm_hash %s", mm_hash)
|
||||
|
||||
def has_caches(
|
||||
def has_cache_item(
|
||||
self,
|
||||
request: "Request",
|
||||
) -> list[bool]:
|
||||
identifier: str,
|
||||
) -> bool:
|
||||
"""
|
||||
Check if cache exist externally for each mm_data of request
|
||||
Check if cache exist externally for the media
|
||||
|
||||
Args:
|
||||
request (Request): the request object.
|
||||
identifier (str): the identifier of the media.
|
||||
|
||||
Returns:
|
||||
List of bool indicate that ith mm_data exist in cache or not
|
||||
Bool indicate that media exists in cache or not
|
||||
"""
|
||||
result = []
|
||||
for feature in request.mm_features:
|
||||
result.append(self._found_match_for_mm_data(feature.identifier))
|
||||
return result
|
||||
return self._found_match_for_mm_data(identifier)
|
||||
|
||||
def update_state_after_alloc(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user