public class ActiveRun extends Object
Modifier and Type | Method and Description |
---|---|
void |
endRun()
Ends the active MLflow run.
|
void |
endRun(Service.RunStatus status)
Ends the active MLflow run.
|
String |
getArtifactUri()
Get the absolute URI of the run artifact directory root.
|
String |
getId()
Gets the run id of this run.
|
void |
logArtifact(Path localPath)
Like
logArtifact(Path, String) with the artifactPath set to the root of the
artifact directory. |
void |
logArtifact(Path localPath,
String artifactPath)
Uploads the given local file to the run's root artifact directory.
|
void |
logArtifacts(Path localPath)
Like
logArtifacts(Path, String) with the artifactPath set to the root of the
artifact directory. |
void |
logArtifacts(Path localPath,
String artifactPath)
Uploads all files within the given local director an artifactPath within the run's root
artifact directory.
|
void |
logMetric(String key,
double value)
Like
logMetric(String, double, int) with a default step of 0. |
void |
logMetric(String key,
double value,
int step)
Logs a metric under this run.
|
void |
logMetrics(Map<String,Double> metrics)
Like
logMetrics(Map, int) with a default step of 0. |
void |
logMetrics(Map<String,Double> metrics,
int step)
Log multiple metrics for this run.
|
void |
logParam(String key,
String value)
Log a parameter under this run.
|
void |
logParams(Map<String,String> params)
Log multiple params for this run.
|
void |
setTag(String key,
String value)
Sets a tag under this run.
|
void |
setTags(Map<String,String> tags)
Sets multiple tags for this run.
|
public String getId()
public void logParam(String key, String value)
key
- The name of the parameter.value
- The value of the parameter.public void setTag(String key, String value)
key
- The name of the tag.value
- The value of the tag.public void logMetric(String key, double value)
logMetric(String, double, int)
with a default step of 0.public void logMetric(String key, double value, int step)
key
- The name of the metric.value
- The value of the metric.step
- The metric step.public void logMetrics(Map<String,Double> metrics)
logMetrics(Map, int)
with a default step of 0.public void logMetrics(Map<String,Double> metrics, int step)
metrics
- A map of metric name to value.step
- The metric step.public void logParams(Map<String,String> params)
params
- A map of param name to value.public void setTags(Map<String,String> tags)
tags
- A map of tag name to value.public void logArtifact(Path localPath)
logArtifact(Path, String)
with the artifactPath set to the root of the
artifact directory.localPath
- Path of file to upload. Must exist, and must be a simple file
(not a directory).public void logArtifact(Path localPath, String artifactPath)
activeRun.logArtifact("/my/localModel", "model") mlflowClient.listArtifacts(activeRun.getId(), "model") // returns "model/localModel"
localPath
- Path of file to upload. Must exist, and must be a simple file
(not a directory).artifactPath
- Artifact path relative to the run's root directory given by
getArtifactUri()
. Should NOT start with a /.public void logArtifacts(Path localPath)
logArtifacts(Path, String)
with the artifactPath set to the root of the
artifact directory.localPath
- Directory to upload. Must exist, and must be a directory (not a simple file).public void logArtifacts(Path localPath, String artifactPath)
activeRun.logArtifacts("/my/local/dir", "model") mlflowClient.listArtifacts(activeRun.getId(), "model") // returns "model/file1" and // "model/file2"(i.e., the contents of the local directory are now available in model/).
localPath
- Directory to upload. Must exist, and must be a directory (not a simple file).artifactPath
- Artifact path relative to the run's root directory given by
getArtifactUri()
. Should NOT start with a /.public String getArtifactUri()
public void endRun()
public void endRun(Service.RunStatus status)
status
- The status of the run.Copyright © 2020. All rights reserved.