Skip to content

Commit d525032

Browse files
committed
add lib, add process.env.MLFLOW_TRACKING_URI to example, clean up gitignore
1 parent 9528fc5 commit d525032

40 files changed

+2558
-10
lines changed

mlflow/.gitignore

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Dependencies
22
node_modules/
33

4+
# Environment variables
5+
.env
6+
7+
# IDE
8+
.vscode
9+
410
# Misc
511
.DS_Store
612
../.DS_Store
@@ -9,8 +15,12 @@ node_modules/
915
.venv/
1016
mlruns/
1117

12-
# Build output
13-
lib/
14-
1518
# Temporary files
16-
temp/
19+
temp/
20+
21+
# Test coverage
22+
coverage/
23+
24+
25+
26+
=

mlflow/examples/LinearRegressionExample.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,23 @@
1414
* @requires @tensorflow/tfjs-node
1515
* @requires @mlflow.js
1616
*
17-
* @note Ensure MLflow server is running at http://localhost:5001 before executing
17+
* @note Ensure MLflow server is running before executing
1818
*/
1919

2020
import * as tf from '@tensorflow/tfjs-node';
21-
import MLflow from 'mlflow-js';
21+
import Mlflow from 'mlflow-js';
2222
import { fileURLToPath } from 'url';
23-
import { dirname } from 'path';
23+
import { dirname, join } from 'path';
24+
import dotenv from 'dotenv';
2425

25-
const mlflow = new MLflow('http://localhost:5001');
26+
const __filename = fileURLToPath(import.meta.url);
27+
const __dirname = dirname(__filename);
28+
dotenv.config({ path: join(__dirname, '../.env') });
29+
30+
const MLFLOW_TRACKING_URI =
31+
process.env.MLFLOW_TRACKING_URI || 'http://localhost:5001';
32+
const mlflow = new Mlflow(MLFLOW_TRACKING_URI);
33+
console.log('MLflow server URL:', MLFLOW_TRACKING_URI);
2634

2735
const HYPERPARAMETERS = {
2836
learningRate: 0.25,

mlflow/lib/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import Mlflow from './mlflow.js';
2+
export default Mlflow;

mlflow/lib/index.js

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

mlflow/lib/index.js.map

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

mlflow/lib/mlflow.d.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import ExperimentClient from './tracking/ExperimentClient.js';
2+
import ExperimentManager from './workflows/ExperimentManager.js';
3+
import RunClient from './tracking/RunClient.js';
4+
import RunManager from './workflows/RunManager.js';
5+
import ModelRegistryClient from './model-registry/ModelRegistryClient.js';
6+
import ModelVersionClient from './model-registry/ModelVersionClient.js';
7+
import ModelManager from './workflows/ModelManager.js';
8+
declare class Mlflow {
9+
private components;
10+
constructor(trackingUri: string);
11+
private initializeMethods;
12+
getExperimentClient(): ExperimentClient;
13+
getRunClient(): RunClient;
14+
getModelRegistryClient(): ModelRegistryClient;
15+
getModelVersionClient(): ModelVersionClient;
16+
getExperimentManager(): ExperimentManager;
17+
getRunManager(): RunManager;
18+
getModelManager(): ModelManager;
19+
}
20+
export default Mlflow;

mlflow/lib/mlflow.js

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

mlflow/lib/mlflow.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
declare class ModelRegistryClient {
2+
private baseUrl;
3+
constructor(trackingUri: string);
4+
/**
5+
* Creates a new registered model.
6+
*
7+
* @param {string} name - The name of the model to register (required)
8+
* @param {Array<{key: string, value: string}>} [tags] - Optional tags for the model
9+
* @param {string} [description] - Optional description for the model
10+
* @returns {Promise<RegisteredModel>} The created registered model object
11+
* @throws {ApiError} If the API request fails
12+
*/
13+
createRegisteredModel(name: string, tags?: Array<{
14+
key: string;
15+
value: string;
16+
}>, description?: string): Promise<object>;
17+
/**
18+
* Retrieves a registered model by name.
19+
*
20+
* @param {string} name - The name of the registered model to retrieve (required)
21+
* @returns {Promise<RegisteredModel>} The registered model object
22+
* @throws {ApiError} If the API request fails
23+
*/
24+
getRegisteredModel(name: string): Promise<object>;
25+
/**
26+
* Renames a registered model.
27+
*
28+
* @param {string} name - The current name of the registered model (required)
29+
* @param {string} newName - The new name for the registered model (required)
30+
* @returns {Promise<RegisteredModel>} The updated registered model object
31+
* @throws {ApiError} If the API request fails
32+
*/
33+
renameRegisteredModel(name: string, newName: string): Promise<object>;
34+
/**
35+
* Updates a registered model's description.
36+
*
37+
* @param {string} name - The name of the registered model to update (required)
38+
* @param {string} [description] - The new description for the model
39+
* @returns {Promise<RegisteredModel>} The updated registered model object
40+
* @throws {ApiError} If the API request fails
41+
*/
42+
updateRegisteredModel(name: string, description?: string): Promise<object>;
43+
/**
44+
* Deletes a registered model.
45+
*
46+
* @param {string} name - The name of the registered model to delete (required)
47+
* @returns {Promise<void>}
48+
* @throws {ApiError} If the API request fails
49+
*/
50+
deleteRegisteredModel(name: string): Promise<void>;
51+
/**
52+
* Gets the latest versions of a registered model.
53+
*
54+
* @param {string} name - The name of the registered model (required)
55+
* @param {string[]} [stages] - Optional array of stages to filter the versions by
56+
* @returns {Promise<ModelVersion[]>} An array of the latest model versions
57+
* @throws {ApiError} If the API request fails
58+
*/
59+
getLatestModelVersions(name: string, stages?: string[]): Promise<Array<object>>;
60+
/**
61+
* Searches for registered models based on filter criteria.
62+
*
63+
* @param {string} [filter] - Optional filter string to apply to the search
64+
* @param {number} [maxResults] - Optional maximum number of results to return
65+
* @param {string[]} [orderBy] - Optional array of fields to order the results by
66+
* @param {string} [pageToken] - Optional token for pagination
67+
* @returns {Promise<{registered_models: RegisteredModel[], next_page_token: string}>} An object containing the search results and pagination information
68+
* @throws {ApiError} If the API request fails
69+
*/
70+
searchRegisteredModels(filter?: string, maxResults?: number, orderBy?: string[], pageToken?: string): Promise<object>;
71+
/**
72+
* Sets a tag on a registered model.
73+
*
74+
* @param {string} name - The name of the registered model (required)
75+
* @param {string} key - The key of the tag (required)
76+
* @param {string} value - The value of the tag (required)
77+
* @returns {Promise<void>}
78+
* @throws {ApiError} If the API request fails
79+
*/
80+
setRegisteredModelTag(name: string, key: string, value: string): Promise<void>;
81+
/**
82+
* Deletes a tag from a registered model.
83+
*
84+
* @param {string} name - The name of the registered model (required)
85+
* @param {string} key - The key of the tag to delete (required)
86+
* @returns {Promise<void>}
87+
* @throws {ApiError} If the API request fails
88+
*/
89+
deleteRegisteredModelTag(name: string, key: string): Promise<void>;
90+
/**
91+
* Sets an alias for a specific version of a registered model.
92+
*
93+
* @param {string} name - The name of the registered model (required)
94+
* @param {string} alias - The alias to set (required)
95+
* @param {string} version - The version number to associate with the alias (required)
96+
* @returns {Promise<void>}
97+
* @throws {ApiError} If the API request fails
98+
*/
99+
setRegisteredModelAlias(name: string, alias: string, version: string): Promise<void>;
100+
/**
101+
* Deletes an alias from a registered model.
102+
*
103+
* @param {string} name - The name of the registered model (required)
104+
* @param {string} alias - The alias to delete (required)
105+
* @returns {Promise<void>}
106+
* @throws {ApiError} If the API request fails
107+
*/
108+
deleteRegisteredModelAlias(name: string, alias: string): Promise<void>;
109+
/**
110+
* Retrieves a model version using its alias.
111+
*
112+
* @param {string} name - The name of the registered model (required)
113+
* @param {string} alias - The alias of the model version to retrieve (required)
114+
* @returns {Promise<ModelVersion>} The model version object
115+
* @throws {ApiError} If the API request fails
116+
*/
117+
getModelVersionByAlias(name: string, alias: string): Promise<object>;
118+
}
119+
export default ModelRegistryClient;

0 commit comments

Comments
 (0)