Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move SearchExperiments endpoint #68

Merged

Conversation

dsuhinin
Copy link
Collaborator

No description provided.

Signed-off-by: Software Developer <7852635+dsuhinin@users.noreply.github.com>
Signed-off-by: Software Developer <7852635+dsuhinin@users.noreply.github.com>
Signed-off-by: Software Developer <7852635+dsuhinin@users.noreply.github.com>
Signed-off-by: Software Developer <7852635+dsuhinin@users.noreply.github.com>
@@ -9,6 +9,7 @@ linters:
- gosimple
- lll
disable:
- ireturn
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disabled it. sometimes it bothers.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabiovincenzi can you update Go for us to deal with this problem?
There was a fix for this, but only starting Go 1.23 I believe.
This is indeed annoying.

@@ -34,6 +34,7 @@ var validations = map[string]string{
"SetExperimentTag_ExperimentId": "required",
"SetExperimentTag_Key": "required,max=250,validMetricParamOrTagName",
"SetExperimentTag_Value": "max=5000",
"SearchExperiments_MaxResults": "positiveNonZeroInteger,max=50000",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

positiveNonZeroInteger because of Python tests.

Comment on lines +26 to +36
def test_search_experiments_max_results_validation(store: SqlAlchemyStore):
with pytest.raises(
MlflowException,
match=r"Invalid value 0 for parameter 'max_results' supplied",
):
store.search_experiments(max_results=0)
with pytest.raises(
MlflowException,
match=r"Invalid value 1000000 for parameter 'max_results' supplied",
):
store.search_experiments(max_results=1_000_000)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One sub tests removed -> related to None value in max_results. Other tests looks the same but expected messages a bit changed.

Signed-off-by: Software Developer <7852635+dsuhinin@users.noreply.github.com>
Signed-off-by: Software Developer <7852635+dsuhinin@users.noreply.github.com>
@dsuhinin dsuhinin marked this pull request as ready for review October 18, 2024 10:36
@dsuhinin dsuhinin requested a review from nojaf October 18, 2024 10:36
Copy link
Collaborator

@nojaf nojaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could probably benefit from some Go unit test, similar to search run that assert the SQL statements.

pkg/tracking/store/sql/experiments_search_builder.go Outdated Show resolved Hide resolved
return query, nil
}

func createExperimentsNextPageToken(experiments []models.Experiment, limit, offset int) (string, *contract.Error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure and I'm just asking, but is this the same next token thing as in search_runs? Can we reuse or did it not seem worth it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately not the same. it has a bit strange condition under the hood for experiments. Ive tried to make it generic but it seems like the way which works - to keep the separate.

pkg/tracking/store/store.go Outdated Show resolved Hide resolved
pkg/tracking/store/sql/runs_search_builder.go Show resolved Hide resolved
Signed-off-by: Software Developer <7852635+dsuhinin@users.noreply.github.com>
Copy link
Collaborator

@nojaf nojaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

pkg/tracking/store/sql/experiments.go Outdated Show resolved Hide resolved
entity, key, comparison := parts[1], strings.Trim(parts[2], "\"`"), parts[3]

switch entity {
case "", "attribute", "attributes", "attr":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some of these strings as constants in /pkg/tracking/service/query/parser/validate.go.
Perhaps we want a more generate mlflow constants package at some point?
Could be addressed in the future though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ill check and re use them if it possible. np.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahhh, they are exists in other packages on even different level. then I suggest to do not do that. packages are different, logic also and they are not in the same scope. Maybe later we can try to unify something and move common parts into the same layer.

Signed-off-by: Software Developer <7852635+dsuhinin@users.noreply.github.com>
Signed-off-by: Software Developer <7852635+dsuhinin@users.noreply.github.com>
@dsuhinin dsuhinin merged commit 5c15e67 into mlflow:main Oct 21, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants