Skip to content

Commit 5158022

Browse files
authored
Merge pull request #71 from oslabs-beta/kyler/fixedRunBuildErrors
fix: Fixed npm run build Errors
2 parents c580d0d + ead4645 commit 5158022

File tree

10 files changed

+93
-60
lines changed

10 files changed

+93
-60
lines changed

mlflow-site/src/app/components/Button.tsx

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,8 @@
33
const Button = () => {
44
return (
55
<div className='button'>
6-
<button
7-
onClick={() => {
8-
window.location.assign('https://github.com/oslabs-beta/mlflow-js');
9-
}}
10-
className='homeButton homeButtonDownload text-white'
11-
>
12-
Download
13-
</button>
14-
<button
15-
onClick={() => {
16-
window.location.assign('https://github.com/oslabs-beta/mlflow-js/tree/dev/mlflow/docs');
17-
}}
18-
className='homeButton homeButtonRead'
19-
>
20-
Read the Docs
21-
</button>
6+
<a href='https://github.com/oslabs-beta/mlflow-js' className='homeButton homeButtonDownload text-white'>Download</a>
7+
<a href='https://github.com/oslabs-beta/mlflow-js/tree/dev/mlflow/docs' className='homeButton homeButtonRead'>Read the Docs</a>
228
</div>
239
);
2410
};

mlflow-site/src/app/globals.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,14 @@ body {
175175

176176
.homeButtonDownload {
177177
background-color: rgb(66, 107, 31);
178+
padding-top: 0.6rem;
179+
padding-bottom: 0.6rem;
178180
}
179181

180182
.homeButtonRead {
181183
background-color: rgb(204, 204, 204);
184+
padding-top: 0.6rem;
185+
padding-bottom: 0.6rem;
182186
}
183187

184188
.button {

mlflow/src/workflows/ExperimentManager.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import ExperimentClient from '@tracking/ExperimentClient';
22
import RunClient from '@tracking/RunClient';
33
import { ApiError } from '@utils/apiError';
44

5+
interface keyable {
6+
[key: string]: any
7+
}
8+
59
class ExperimentManager {
610
private experimentClient: ExperimentClient;
711
private runClient: RunClient;
@@ -46,7 +50,7 @@ class ExperimentManager {
4650
): Promise<object> {
4751
try {
4852
// create run
49-
const run = await this.runClient.createRun(experiment_id, run_name);
53+
const run:keyable = await this.runClient.createRun(experiment_id, run_name);
5054
const run_id = run.info.run_id;
5155

5256
// log metric, params, and tags via logBatch
@@ -114,7 +118,7 @@ class ExperimentManager {
114118
);
115119

116120
// create run
117-
const run = await this.runClient.createRun(experiment_id, run_name);
121+
const run:keyable = await this.runClient.createRun(experiment_id, run_name);
118122
const run_id = run.info.run_id;
119123

120124
// log metric, params, and tags via logBatch
@@ -203,7 +207,7 @@ class ExperimentManager {
203207
if (order === 1 || order === 'DESC') orderString = 'DESC';
204208
else if (order === -1 || order === 'ASC') orderString = 'ASC';
205209
const arg = `metrics.${primaryMetric} ${orderString}`;
206-
const data = await this.runClient.searchRuns(
210+
const data:keyable = await this.runClient.searchRuns(
207211
[experiment_id],
208212
'',
209213
undefined,

mlflow/src/workflows/ModelManager.ts

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import ModelRegistryClient from '@model-registry/ModelRegistryClient';
33
import ModelVersionClient from '@model-registry/ModelVersionClient';
44
import { ApiError } from '@utils/apiError';
55

6+
interface keyable {
7+
[key: string]: any;
8+
}
9+
610
class ModelManager {
711
private modelRegistry: ModelRegistryClient;
812
private modelVersion: ModelVersionClient;
@@ -103,11 +107,13 @@ class ModelManager {
103107
value: string
104108
): Promise<object> {
105109
try {
106-
const data = await this.modelRegistry.getLatestModelVersions(name);
110+
const data: keyable = await this.modelRegistry.getLatestModelVersions(
111+
name
112+
);
107113
if (!data) {
108114
throw new Error('Model has no version to update.');
109115
} else {
110-
const [{ version }] = data;
116+
const version = data[0].version;
111117
await this.modelRegistry.setRegisteredModelAlias(name, alias, version);
112118
await this.modelVersion.setModelVersionTag(name, version, key, value);
113119
const response = await this.modelVersion.updateModelVersion(
@@ -143,11 +149,13 @@ class ModelManager {
143149
value: string
144150
): Promise<void> {
145151
try {
146-
const data = await this.modelRegistry.getLatestModelVersions(name);
152+
const data: keyable = await this.modelRegistry.getLatestModelVersions(
153+
name
154+
);
147155
if (!data) {
148156
throw new Error('Model has no version to set tag for.');
149157
} else {
150-
const [{ version }] = data;
158+
const version = data[0].version;
151159
this.modelVersion.setModelVersionTag(name, version, key, value);
152160
return;
153161
}
@@ -172,11 +180,13 @@ class ModelManager {
172180
*/
173181
async setLatestModelVersionAlias(name: string, alias: string): Promise<void> {
174182
try {
175-
const data = await this.modelRegistry.getLatestModelVersions(name);
183+
const data: keyable = await this.modelRegistry.getLatestModelVersions(
184+
name
185+
);
176186
if (!data) {
177187
throw new Error('Model has no version to set alias for.');
178188
} else {
179-
const [{ version }] = data;
189+
const version = data[0].version;
180190
this.modelRegistry.setRegisteredModelAlias(name, alias, version);
181191
return;
182192
}
@@ -204,11 +214,13 @@ class ModelManager {
204214
description: string
205215
): Promise<object> {
206216
try {
207-
const data = await this.modelRegistry.getLatestModelVersions(name);
217+
const data: keyable = await this.modelRegistry.getLatestModelVersions(
218+
name
219+
);
208220
if (!data) {
209221
throw new Error('Model has no version to set description for.');
210222
} else {
211-
const [{ version }] = data;
223+
const version = data[0].version;
212224
const response = await this.modelVersion.updateModelVersion(
213225
name,
214226
version,
@@ -277,11 +289,13 @@ class ModelManager {
277289
*/
278290
async deleteLatestModelVersion(name: string): Promise<void> {
279291
try {
280-
const data = await this.modelRegistry.getLatestModelVersions(name);
292+
const data: keyable = await this.modelRegistry.getLatestModelVersions(
293+
name
294+
);
281295
if (!data) {
282296
throw new Error('Model has no version to delete.');
283297
} else {
284-
const [{ version }] = data;
298+
const version = data[0].version;
285299
this.modelVersion.deleteModelVersion(name, version);
286300
return;
287301
}
@@ -305,7 +319,7 @@ class ModelManager {
305319
* @param {string[]} experiment_ids - An array containing an experiment id. (Required)
306320
* @param {string} filterMetric - The name of the metric that we're filtering by. (Required)
307321
* @param {string} metricMinOrMax - A string specifying if we want the minimum or maximum
308-
* value of the specified metric. Can be either 'min' or
322+
* value of the specified metric. Can be either 'min' or
309323
* 'max'(Required)
310324
* @param {string} modelName - The name of the new model that will be created. (Required)
311325
* @returns {Promise<void>}
@@ -318,10 +332,11 @@ class ModelManager {
318332
modelName: string
319333
): Promise<void> {
320334
try {
321-
const { runs } = await this.runClient.searchRuns(
335+
const data: keyable = await this.runClient.searchRuns(
322336
experiment_ids,
323337
`metrics.${filterMetric} != -99999`
324338
);
339+
const runs = data.runs;
325340
let num;
326341
if (metricMinOrMax === 'min') {
327342
num = Infinity;
@@ -354,7 +369,7 @@ class ModelManager {
354369
bestRun.info.artifact_uri,
355370
bestRun.info.run_id
356371
);
357-
return
372+
return;
358373
} catch (error) {
359374
if (error instanceof ApiError) {
360375
console.error(`API Error (${error.statusCode}): ${error.message}`);

mlflow/src/workflows/RunManager.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import RunClient from '@tracking/RunClient';
22
import ModelVersionClient from '@model-registry/ModelVersionClient';
33
import { ApiError } from '@utils/apiError';
44

5+
interface keyable {
6+
[key: string]: any
7+
}
8+
59
interface Run {
610
info: {
711
run_id: string;
@@ -64,7 +68,7 @@ class RunManager {
6468
try {
6569
do {
6670
// get all runs
67-
const searchResult = await this.runClient.searchRuns(
71+
const searchResult:keyable = await this.runClient.searchRuns(
6872
experimentIds,
6973
'',
7074
undefined, // run_view_type
@@ -74,7 +78,7 @@ class RunManager {
7478
);
7579

7680
// get runs that match the keep crteria
77-
const keepRunsResult = await this.runClient.searchRuns(
81+
const keepRunsResult:keyable = await this.runClient.searchRuns(
7882
experimentIds,
7983
query_string,
8084
undefined, // run_view_type
@@ -143,10 +147,10 @@ class RunManager {
143147
): Promise<object> {
144148
try {
145149
// get original run
146-
const originalRun = await this.runClient.getRun(runId);
150+
const originalRun:keyable = await this.runClient.getRun(runId);
147151

148152
// create a new run in the target experiment
149-
const newRun = await this.runClient.createRun(
153+
const newRun:keyable = await this.runClient.createRun(
150154
targetExperimentId,
151155
undefined,
152156
originalRun.info.start_time

mlflow/tests/ModelManagerTest.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import ModelManager from '../src/workflows/ModelManager';
22
import RunClient from '../src/tracking/RunClient';
33

4+
interface keyable {
5+
[key: string]: any
6+
}
7+
48
async function testModelManager() {
59
const modelManager = new ModelManager('http://localhost:5001');
610
const runClient = new RunClient('http://localhost:5001');
@@ -20,7 +24,7 @@ async function testModelManager() {
2024
const runMetricValueLow = 1;
2125

2226
console.log('\n5. Creating a run...');
23-
const run = await runClient.createRun('0'); // Using '0' as the default experiment ID
27+
const run:keyable = await runClient.createRun('0'); // Using '0' as the default experiment ID
2428
console.log('Created run:', run);
2529

2630
console.log('1. Creating a new registered model with a version...');
@@ -96,7 +100,7 @@ async function testModelManager() {
96100
console.log(`Deleted Latest version of ${modelName}`);
97101

98102
console.log('9. Creating model from run with best metric...');
99-
const run2 = await runClient.createRun('0'); // Using '0' as the default experiment ID
103+
const run2:keyable = await runClient.createRun('0'); // Using '0' as the default experiment ID
100104
console.log('Created run:', run2);
101105

102106
await runClient.logMetric(
@@ -111,7 +115,7 @@ async function testModelManager() {
111115
runMetricValueLow
112116
);
113117

114-
const runData = await runClient.getRun(
118+
const runData:keyable = await runClient.getRun(
115119
run.info.run_id
116120
);
117121

mlflow/tests/ModelRegistryClientTest.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import ModelRegistryClient from '../src/model-registry/ModelRegistryClient';
22
import RunClient from '../src/tracking/RunClient';
33
import ModelVersionClient from '../src/model-registry/ModelVersionClient';
44

5+
interface keyable {
6+
[key: string]: any
7+
}
8+
59
async function testModelRegistryClient() {
610
const client = new ModelRegistryClient('http://localhost:5001');
711
const runClient = new RunClient('http://localhost:5001');
@@ -44,12 +48,12 @@ async function testModelRegistryClient() {
4448

4549
// 5. Create a run
4650
console.log('\n5. Creating a run...');
47-
const run = await runClient.createRun('0'); // Using '0' as the default experiment ID
51+
const run:keyable = await runClient.createRun('0'); // Using '0' as the default experiment ID
4852
console.log('Created run:', run);
4953

5054
// 6. Get the run to retrieve the artifact URI
5155
console.log('\n6. Getting run details...');
52-
const runDetails = await runClient.getRun(run.info.run_id);
56+
const runDetails:keyable = await runClient.getRun(run.info.run_id);
5357
console.log('Run artifact URI:', runDetails.info.artifact_uri);
5458

5559
// 7. Test creating a model version
@@ -75,7 +79,7 @@ async function testModelRegistryClient() {
7579
}
7680

7781
// Perform initial search with a small max_results to force pagination
78-
const initialSearchResults = await client.searchRegisteredModels(
82+
const initialSearchResults:keyable = await client.searchRegisteredModels(
7983
`name LIKE '${renamedBaseName}%'`,
8084
3, // Small max_results to force pagination
8185
['name ASC']
@@ -88,7 +92,7 @@ async function testModelRegistryClient() {
8892

8993
if (initialSearchResults.next_page_token) {
9094
// Perform second search using the page token
91-
const secondSearchResults = await client.searchRegisteredModels(
95+
const secondSearchResults:keyable = await client.searchRegisteredModels(
9296
`name LIKE '${renamedBaseName}%'`,
9397
3,
9498
['name ASC'],

mlflow/tests/ModelVersionClientTest.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import ModelVersionClient from '../src/model-registry/ModelVersionClient';
22
import ModelRegistryClient from '../src/model-registry/ModelRegistryClient';
33
import RunClient from '../src/tracking/RunClient';
44

5+
interface keyable {
6+
[key: string]: any
7+
}
8+
59
async function testModelVersionClient() {
610
const client = new ModelVersionClient('http://localhost:5001');
711
const modelRegistryClient = new ModelRegistryClient('http://localhost:5001');
@@ -21,7 +25,7 @@ async function testModelVersionClient() {
2125
);
2226

2327
console.log('\n5. Creating a run...');
24-
const run = await runClient.createRun('0'); // Using '0' as the default experiment ID
28+
const run:keyable = await runClient.createRun('0'); // Using '0' as the default experiment ID
2529
console.log('Created run:', run);
2630

2731
// 1. Creating a registered model version

mlflow/tests/RunClientTest.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import RunClient from '../src/tracking/RunClient';
22
import ExperimentClient from '../src/tracking/ExperimentClient';
33

4+
interface keyable {
5+
[key: string]: any
6+
}
7+
48
async function testRunClient(): Promise<void> {
5-
const client = new RunClient('http://127.0.0.1:5000');
6-
const experimentClient = new ExperimentClient('http://127.0.0.1:5000');
9+
const client = new RunClient('http://127.0.0.1:5001');
10+
const experimentClient = new ExperimentClient('http://127.0.0.1:5001');
711

812
try {
913
// createRun
@@ -12,7 +16,7 @@ async function testRunClient(): Promise<void> {
1216
console.log('Created experiment ID: ', experiment_id);
1317

1418
console.log('1. Creating run...');
15-
const run = await client.createRun(experiment_id);
19+
const run:keyable = await client.createRun(experiment_id);
1620
console.log('Created run: ', run);
1721

1822
// deleteRun
@@ -48,7 +52,7 @@ async function testRunClient(): Promise<void> {
4852

4953
// logBatch
5054
console.log('Creating another run...');
51-
const run2 = await client.createRun(experiment_id);
55+
const run2:keyable = await client.createRun(experiment_id);
5256
console.log('Created run2: ', run2);
5357
const run2Id = run2.info.run_id;
5458

@@ -120,7 +124,7 @@ async function testRunClient(): Promise<void> {
120124

121125
// setTag
122126
console.log('Creating another run...');
123-
const run3 = await client.createRun(experiment_id);
127+
const run3:keyable = await client.createRun(experiment_id);
124128
console.log('Created run3: ', run3);
125129
const run3Id = run3.info.run_id;
126130

0 commit comments

Comments
 (0)