-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce json-path style selection of metrics, where a map of JsonPath: Value can be used to filter metric results.
- Loading branch information
Showing
11 changed files
with
323 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 11 additions & 11 deletions
22
pkg/api/mlflow/dao/repositories/mock_metric_repository_provider.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package helpers | ||
|
||
import ( | ||
"bytes" | ||
|
||
"github.com/apache/arrow/go/v12/arrow/array" | ||
"github.com/apache/arrow/go/v12/arrow/ipc" | ||
"github.com/apache/arrow/go/v12/arrow/memory" | ||
"github.com/rotisserie/eris" | ||
|
||
"github.com/G-Research/fasttrackml/pkg/api/mlflow/dao/models" | ||
) | ||
|
||
func DecodeArrowMetrics(buf *bytes.Buffer) ([]models.Metric, error) { | ||
pool := memory.NewGoAllocator() | ||
|
||
// Create a new reader | ||
reader, err := ipc.NewReader(buf, ipc.WithAllocator(pool)) | ||
if err != nil { | ||
return nil, eris.Wrap(err, "error creating reader for arrow decode") | ||
} | ||
defer reader.Release() | ||
|
||
var metrics []models.Metric | ||
|
||
// Iterate over all records in the reader | ||
for reader.Next() { | ||
rec := reader.Record() | ||
for i := 0; i < int(rec.NumRows()); i++ { | ||
metric := models.Metric{ | ||
RunID: rec.Column(0).(*array.String).Value(i), | ||
Key: rec.Column(1).(*array.String).Value(i), | ||
Step: rec.Column(2).(*array.Int64).Value(i), | ||
Timestamp: rec.Column(3).(*array.Int64).Value(i), | ||
IsNan: rec.Column(4).(*array.Float64).IsNull(i), | ||
} | ||
if !metric.IsNan { | ||
metric.Value = rec.Column(4).(*array.Float64).Value(i) | ||
} | ||
metrics = append(metrics, metric) | ||
} | ||
rec.Release() | ||
} | ||
|
||
if reader.Err() != nil { | ||
return nil, eris.Wrap(reader.Err(), "error processing reader in arrow decode") | ||
} | ||
|
||
return metrics, nil | ||
} |
Oops, something went wrong.