MLflow experiments and runs
Log run batch
Log a batch of metrics, params, and tags for a run.
If any data failed to be persisted, the server will respond with an error (non-200 status code).
In case of error (due to internal server error or an invalid request), partial data may be written.
You can write metrics, params, and tags in interleaving fashion, but within a given entity type are guaranteed to follow the order specified in the request body. That is, for an API request like
.. code-block:: json
{
"run_id": "2a14ed5c6a87499199e0106c3501eab8",
"metrics": [
{"key": "mae", "value": 2.5, "timestamp": 1552550804},
{"key": "rmse", "value": 2.7, "timestamp": 1552550804},
],
"params": [
{"key": "model_class", "value": "LogisticRegression"},
]
}
the server is guaranteed to write metric "rmse" after "mae", though it may write param
"model_class" before both metrics, after "mae", or after both metrics.
The overwrite behavior for metrics, params, and tags is as follows:
- Metrics: metric values are never overwritten. Logging a metric (key, value, timestamp) appends to the set of values for the metric with the provided key.
- Tags: tag values can be overwritten by successive writes to the same tag key. That is, if multiple tag values with the same key are provided in the same API request, the last-provided tag value is written. Logging the same tag (key, value) is permitted - that is, logging a tag is idempotent.
- Params: once written, param values cannot be changed (attempting to overwrite a param value will result in an error). However, logging the same param (key, value) is permitted - that is, logging a param is idempotent.
Request Limits
--------------
A single JSON-serialized API request may be up to 1 MB in size and contain:
- No more than 1000 metrics, params, and tags in total
- Up to 1000 metrics
- Up to 100 params
- Up to 100 tags
For example, a valid request might contain 900 metrics, 50 params, and 50 tags, but logging
900 metrics, 50 params, and 51 tags is invalid. The following limits also apply
to metric, param, and tag keys and values:
- Metric, param, and tag keys can be up to 250 characters in length
- Param and tag values can be up to 250 characters in length
POST
/
api
/
2.0
/
mlflow
/
runs
/
log-batch
cURL
curl --request POST \
--url https://mycluster.domino.tech/api/2.0/mlflow/runs/log-batch \
--header 'Content-Type: application/json' \
--data '
{
"run_id": "<string>",
"metrics": [
{
"key": "<string>",
"step": "0",
"timestamp": 123,
"value": 123
}
],
"params": [
{
"key": "<string>",
"value": "<string>"
}
],
"tags": [
{
"key": "<string>",
"value": "<string>"
}
]
}
'import requests
url = "https://mycluster.domino.tech/api/2.0/mlflow/runs/log-batch"
payload = {
"run_id": "<string>",
"metrics": [
{
"key": "<string>",
"step": "0",
"timestamp": 123,
"value": 123
}
],
"params": [
{
"key": "<string>",
"value": "<string>"
}
],
"tags": [
{
"key": "<string>",
"value": "<string>"
}
]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
run_id: '<string>',
metrics: [{key: '<string>', step: '0', timestamp: 123, value: 123}],
params: [{key: '<string>', value: '<string>'}],
tags: [{key: '<string>', value: '<string>'}]
})
};
fetch('https://mycluster.domino.tech/api/2.0/mlflow/runs/log-batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mycluster.domino.tech/api/2.0/mlflow/runs/log-batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'run_id' => '<string>',
'metrics' => [
[
'key' => '<string>',
'step' => '0',
'timestamp' => 123,
'value' => 123
]
],
'params' => [
[
'key' => '<string>',
'value' => '<string>'
]
],
'tags' => [
[
'key' => '<string>',
'value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mycluster.domino.tech/api/2.0/mlflow/runs/log-batch"
payload := strings.NewReader("{\n \"run_id\": \"<string>\",\n \"metrics\": [\n {\n \"key\": \"<string>\",\n \"step\": \"0\",\n \"timestamp\": 123,\n \"value\": 123\n }\n ],\n \"params\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"tags\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mycluster.domino.tech/api/2.0/mlflow/runs/log-batch")
.header("Content-Type", "application/json")
.body("{\n \"run_id\": \"<string>\",\n \"metrics\": [\n {\n \"key\": \"<string>\",\n \"step\": \"0\",\n \"timestamp\": 123,\n \"value\": 123\n }\n ],\n \"params\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"tags\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mycluster.domino.tech/api/2.0/mlflow/runs/log-batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"run_id\": \"<string>\",\n \"metrics\": [\n {\n \"key\": \"<string>\",\n \"step\": \"0\",\n \"timestamp\": 123,\n \"value\": 123\n }\n ],\n \"params\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"tags\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{}{
"error_code": "INTERNAL_ERROR",
"message": "<string>"
}Body
application/json
ID of the run to log under
Metrics to log. A single request can contain up to 1000 metrics, and up to 1000 metrics, params, and tags in total.
Show child attributes
Show child attributes
Params to log. A single request can contain up to 100 params, and up to 1000 metrics, params, and tags in total.
Show child attributes
Show child attributes
Tags to log. A single request can contain up to 100 tags, and up to 1000 metrics, params, and tags in total.
Show child attributes
Show child attributes
Response
Run batch logged successfully
The response is of type object.
Was this page helpful?
⌘I
cURL
curl --request POST \
--url https://mycluster.domino.tech/api/2.0/mlflow/runs/log-batch \
--header 'Content-Type: application/json' \
--data '
{
"run_id": "<string>",
"metrics": [
{
"key": "<string>",
"step": "0",
"timestamp": 123,
"value": 123
}
],
"params": [
{
"key": "<string>",
"value": "<string>"
}
],
"tags": [
{
"key": "<string>",
"value": "<string>"
}
]
}
'import requests
url = "https://mycluster.domino.tech/api/2.0/mlflow/runs/log-batch"
payload = {
"run_id": "<string>",
"metrics": [
{
"key": "<string>",
"step": "0",
"timestamp": 123,
"value": 123
}
],
"params": [
{
"key": "<string>",
"value": "<string>"
}
],
"tags": [
{
"key": "<string>",
"value": "<string>"
}
]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
run_id: '<string>',
metrics: [{key: '<string>', step: '0', timestamp: 123, value: 123}],
params: [{key: '<string>', value: '<string>'}],
tags: [{key: '<string>', value: '<string>'}]
})
};
fetch('https://mycluster.domino.tech/api/2.0/mlflow/runs/log-batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://mycluster.domino.tech/api/2.0/mlflow/runs/log-batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'run_id' => '<string>',
'metrics' => [
[
'key' => '<string>',
'step' => '0',
'timestamp' => 123,
'value' => 123
]
],
'params' => [
[
'key' => '<string>',
'value' => '<string>'
]
],
'tags' => [
[
'key' => '<string>',
'value' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://mycluster.domino.tech/api/2.0/mlflow/runs/log-batch"
payload := strings.NewReader("{\n \"run_id\": \"<string>\",\n \"metrics\": [\n {\n \"key\": \"<string>\",\n \"step\": \"0\",\n \"timestamp\": 123,\n \"value\": 123\n }\n ],\n \"params\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"tags\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mycluster.domino.tech/api/2.0/mlflow/runs/log-batch")
.header("Content-Type", "application/json")
.body("{\n \"run_id\": \"<string>\",\n \"metrics\": [\n {\n \"key\": \"<string>\",\n \"step\": \"0\",\n \"timestamp\": 123,\n \"value\": 123\n }\n ],\n \"params\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"tags\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mycluster.domino.tech/api/2.0/mlflow/runs/log-batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"run_id\": \"<string>\",\n \"metrics\": [\n {\n \"key\": \"<string>\",\n \"step\": \"0\",\n \"timestamp\": 123,\n \"value\": 123\n }\n ],\n \"params\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"tags\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{}{
"error_code": "INTERNAL_ERROR",
"message": "<string>"
}