kubeflow / model-registry

Apache License 2.0
71 stars 40 forks source link

MLMD: order_by_creation_time on model iteration fails to execute #358

Open rareddy opened 1 week ago

rareddy commented 1 week ago

Describe the bug order_by_creation_time on model iteration fails to execute

To Reproduce

case 1:

On an existing model registry if I execute the following Python client code

for version in registry.get_model_versions("FLUX.1-dev").order_by_update_time():
    print(version)

it fails with

ServiceException: (500)
Reason: Internal Server Error
HTTP response headers: <CIMultiDictProxy('Content-Type': 'application/json; charset=UTF-8', 'Vary': 'Origin', 'Date': 'Fri, 06 Sep 2024 17:58:27 GMT', 'Content-Length': '467', 'x-envoy-upstream-service-time': '23', 'Server': 'istio-envoy')>
HTTP response body: code='' message="rpc error: code = Internal desc = mysql_query failed: errno: Expression #1 of ORDER BY clause is not in SELECT list, references column 'model_registry.table_0.create_time_since_epoch' which is not in SELECT list; this is incompatible with DISTINCT, error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'model_registry.table_0.create_time_since_epoch' which is not in SELECT list; this is incompatible with DISTINCT"

case 2:

if I execute the following Python client code

for version in registry.get_model_versions("FLUX.1-dev").order_by_creation_time():
    print(version)

it fails with

ServiceException: (500)
Reason: Internal Server Error
HTTP response headers: <CIMultiDictProxy('Content-Type': 'application/json; charset=UTF-8', 'Vary': 'Origin', 'Date': 'Fri, 06 Sep 2024 18:00:33 GMT', 'Content-Length': '477', 'x-envoy-upstream-service-time': '24', 'Server': 'istio-envoy')>
HTTP response body: code='' message="rpc error: code = Internal desc = mysql_query failed: errno: Expression #1 of ORDER BY clause is not in SELECT list, references column 'model_registry.table_0.last_update_time_since_epoch' which is not in SELECT list; this is incompatible with DISTINCT, error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'model_registry.table_0.last_update_time_since_epoch' which is not in SELECT list; this is incompatible with DISTINCT"

Expected behavior it return collection as expected by method contract.

Additional context Check all the functions that return an iterator for the behavior and fix if needs to be in other places and have functional tests to validate the fix.

tarilabs commented 1 week ago

I appreciate @isinyaaa the linking from https://github.com/opendatahub-io/ml-metadata/pull/12

but I don't believe that would actually fully fix this issue (https://github.com/kubeflow/model-registry/issues/358), since we rely on the upstream MLMD image shared with KFP in the KFMR manifests too:

https://github.com/kubeflow/model-registry/blob/533d2607ac649944589bde8d1884fa300144f5f0/manifests/kustomize/base/model-registry-deployment.yaml#L54

I would also encourage to create https://github.com/opendatahub-io/ml-metadata/pull/12 also upstream.

wdyt?

i.e. the https://github.com/opendatahub-io/ml-metadata/pull/12 is awesome, and thank you, but that will not be sufficient to close this https://github.com/kubeflow/model-registry/issues/358