Skip to content

Commit b729a88

Browse files
committed
fixed test files
1 parent 2ceeda4 commit b729a88

File tree

5 files changed

+36
-16
lines changed

5 files changed

+36
-16
lines changed

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: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
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> {
59
const client = new RunClient('http://127.0.0.1:5000');
610
const experimentClient = new ExperimentClient('http://127.0.0.1:5000');
@@ -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

mlflow/tests/RunManagerTestFile.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import RunClient from '../src/tracking/RunClient';
22
import RunManager from '../src/workflows/RunManager';
33
import ExperimentClient from '../src/tracking/ExperimentClient';
44

5+
interface keyable {
6+
[key: string]: any
7+
}
8+
59
// test code for cleanupRuns
610
async function testCleanupRuns(): Promise<void> {
711
const myRunClient = new RunClient('http://127.0.0.1:5000');
@@ -22,11 +26,11 @@ async function testCleanupRuns(): Promise<void> {
2226

2327
// create two runs for each experiment
2428
console.log('Creating runs...');
25-
const run1 = await myRunClient.createRun(experiment_id1);
26-
const run2 = await myRunClient.createRun(experiment_id1);
29+
const run1:keyable = await myRunClient.createRun(experiment_id1);
30+
const run2:keyable = await myRunClient.createRun(experiment_id1);
2731
console.log('Created runs for Test Cleanup Run 1');
28-
const run3 = await myRunClient.createRun(experiment_id2);
29-
const run4 = await myRunClient.createRun(experiment_id2);
32+
const run3:keyable = await myRunClient.createRun(experiment_id2);
33+
const run4:keyable = await myRunClient.createRun(experiment_id2);
3034
console.log('Created runs for Test Cleanup Run 2');
3135

3236
// log metrics
@@ -75,7 +79,7 @@ async function testCopyRun(): Promise<void> {
7579

7680
// create a new run in the newly created experiment
7781
console.log('Creating run...');
78-
const run = await myRunClient.createRun(experiment_id1);
82+
const run:keyable = await myRunClient.createRun(experiment_id1);
7983
console.log('Created run: ', run);
8084

8185
// log batch for that run ID

0 commit comments

Comments
 (0)