Skip to content

Commit

Permalink
cloudvision/cvlib: Do not specify path in inputs get all equality filter
Browse files Browse the repository at this point in the history
Studio input getter helper methods were added in v1.7 of the library.
These initially used a GetOne approach, but were updated in v1.15 to use
a GetAll to allow for inputs over the grpc message limits to be handled,
as the Studio inputs API would break these up across multiple requests.

However, the original key from the first GetOne approach was transitioned
to be used as the partial equality filter of the GetAll. This turned out
to be problematic as that original key had a path specified as the root [].
Once the inputs crosses the grpc message limits and is broken up, the path
that the update keys contains corresponds to the subpath of the entire
inputs tree that the update came from. As those update keys no longer have
a path of [], this leads to the partial equality filter to start dropping
these updates. This causes the helper method to falsely raise an exception
that no inputs exist for the request when they do

Change-Id: I6ff6ac8ac03e52f7ab30e76d85b56d1b3dcac6e2
  • Loading branch information
cianmcgrath committed Aug 14, 2024
1 parent 4e2a747 commit 7a37c86
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cloudvision/cvlib/studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def getStudioInputs(clientGetter, studioId: str, workspaceId: str, path: List[st
if path is None:
raise TypeError("Path must be a non-None value")

inputs = __getStudioInputs(clientGetter, studioId, workspaceId, path)
inputs = __getStudioInputs(clientGetter, studioId, workspaceId)
if not inputs:
# If we're searching for inputs on mainline and we receive none from the getAll,
# raise an exception
Expand All @@ -219,7 +219,7 @@ def getStudioInputs(clientGetter, studioId: str, workspaceId: str, path: List[st
# Get the lastRebasedAt timestamp, or if that's null, then the createdAt timestamp
# of the workspace such that the correct mainline state is retrieved
wsTs = getWorkspaceLastSynced(clientGetter, workspaceId)
mainlineInputs = __getStudioInputs(clientGetter, studioId, MAINLINE_WS_ID, path,
mainlineInputs = __getStudioInputs(clientGetter, studioId, MAINLINE_WS_ID,
start=wsTs, end=wsTs)
if not mainlineInputs:
raise InputNotFoundException(path, f"Inputs for studio {studioId} do not exist")
Expand Down Expand Up @@ -253,13 +253,11 @@ def getStudioInputs(clientGetter, studioId: str, workspaceId: str, path: List[st
return finalInput


def __getStudioInputs(clientGetter, studioId: str, workspaceId: str, path: List[str] = [],
start=None, end=None):
def __getStudioInputs(clientGetter, studioId: str, workspaceId: str, start=None, end=None):
client = clientGetter(services.InputsServiceStub)
wid = pb.StringValue(value=workspaceId)
sid = pb.StringValue(value=studioId)
key = models.InputsKey(studio_id=sid, workspace_id=wid,
path=fmp_wrappers.RepeatedString(values=path))
key = models.InputsKey(studio_id=sid, workspace_id=wid)
p_filter = models.Inputs(key=key)

startTs = None
Expand Down

0 comments on commit 7a37c86

Please sign in to comment.