Skip to content

Commit ec3d819

Browse files
authored
Merge branch 'main' into dsuhinin/update-readme
2 parents 20ff440 + 7e65622 commit ec3d819

File tree

15 files changed

+232
-83
lines changed

15 files changed

+232
-83
lines changed

conftest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,16 @@ def pytest_configure(config):
3434
"tests.store.tracking.test_sqlalchemy_store.test_log_batch_internal_error",
3535
"tests/override_test_sqlalchemy_store.py",
3636
),
37-
# This test uses monkeypatch.setenv which does not flow through to the
37+
# This test uses monkeypatch.setenv which does not flow through to the Go side.
3838
(
3939
"tests.store.tracking.test_sqlalchemy_store.test_log_batch_params_max_length_value",
4040
"tests/override_test_sqlalchemy_store.py",
4141
),
42+
# This test uses monkeypatch.setenv which does not flow through to the Go side.
43+
(
44+
"tests.store.tracking.test_sqlalchemy_store.test_log_param_max_length_value",
45+
"tests/override_test_sqlalchemy_store.py",
46+
),
4247
# This tests calls the store using invalid metric entity that cannot be converted
4348
# to its proto counterpart.
4449
# Example: entities.Metric("invalid_metric", None, (int(time.time() * 1000)), 0).to_proto()

magefiles/generate/endpoints.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var ServiceInfoMap = map[string]ServiceGenerationInfo{
2424
"deleteRun",
2525
"restoreRun",
2626
"logMetric",
27-
// "logParam",
27+
"logParam",
2828
// "setExperimentTag",
2929
// "setTag",
3030
// "setTraceTag",

magefiles/generate/validations.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ var validations = map[string]string{
77
"SearchRuns_RunViewType": "omitempty",
88
"SearchRuns_MaxResults": "gt=0,max=50000",
99
"DeleteExperiment_ExperimentId": "required,stringAsPositiveInteger",
10+
"LogParam_Key": "required,max=250,validMetricParamOrTagName,pathIsUnique",
11+
"LogParam_Value": "omitempty,truncate=6000",
1012
"LogBatch_RunId": "required,runId",
1113
"LogBatch_Params": "omitempty,uniqueParams,max=100,dive",
1214
"LogBatch_Metrics": "max=1000,dive",

mlflow_go/store/tracking.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
GetRun,
2020
LogBatch,
2121
LogMetric,
22+
LogParam,
2223
RestoreExperiment,
2324
RestoreRun,
2425
SearchRuns,
@@ -165,6 +166,14 @@ def log_metric(self, run_id, metric):
165166
)
166167
self.service.call_endpoint(get_lib().TrackingServiceLogMetric, request)
167168

169+
def log_param(self, run_id, param):
170+
request = LogParam(
171+
run_id=run_id,
172+
key=param.key,
173+
value=param.value,
174+
)
175+
self.service.call_endpoint(get_lib().TrackingServiceLogParam, request)
176+
168177

169178
def TrackingStore(cls):
170179
return type(cls.__name__, (_TrackingStore, cls), {})

pkg/contract/service/tracking.g.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/entities/param.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,26 @@ import "github.com/mlflow/mlflow-go/pkg/protos"
44

55
type Param struct {
66
Key string
7-
Value string
7+
Value *string
88
}
99

1010
func (p Param) ToProto() *protos.Param {
1111
return &protos.Param{
1212
Key: &p.Key,
13-
Value: &p.Value,
13+
Value: p.Value,
1414
}
1515
}
1616

1717
func ParamFromProto(proto *protos.Param) *Param {
1818
return &Param{
1919
Key: *proto.Key,
20-
Value: *proto.Value,
20+
Value: proto.Value,
21+
}
22+
}
23+
24+
func ParamFromLogMetricProtoInput(input *protos.LogParam) *Param {
25+
return &Param{
26+
Key: input.GetKey(),
27+
Value: input.Value,
2128
}
2229
}

pkg/lib/tracking.g.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/protos/service.pb.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/server/routes/tracking.g.go

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/tracking/service/metrics.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,13 @@ func (ts TrackingService) LogMetric(
1818

1919
return &protos.LogMetric_Response{}, nil
2020
}
21+
22+
func (ts TrackingService) LogParam(
23+
ctx context.Context, input *protos.LogParam,
24+
) (*protos.LogParam_Response, *contract.Error) {
25+
if err := ts.Store.LogParam(ctx, input.GetRunId(), entities.ParamFromLogMetricProtoInput(input)); err != nil {
26+
return nil, err
27+
}
28+
29+
return &protos.LogParam_Response{}, nil
30+
}

0 commit comments

Comments
 (0)