Skip to content

Commit b8c6c1e

Browse files
committed
vllm serving capabilities
Signed-off-by: Brent Salisbury <[email protected]>
1 parent 937dc0e commit b8c6c1e

File tree

90 files changed

+5877
-2029
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+5877
-2029
lines changed

src/Containerfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
FROM registry.access.redhat.com/ubi9/nodejs-22:9.5-1730543890
22

3+
USER root
4+
35
WORKDIR /opt/app-root/src
46

5-
COPY package*.json ./
7+
COPY ./ .
8+
9+
RUN dnf install -y jq
10+
RUN mkdir -p node_modules
11+
RUN chown -R default:root package*.json next-env.d.ts node_modules /opt/app-root/src/src/healthcheck-probe.sh
612

7-
USER root
8-
RUN chown -R default:root /opt/app-root/src/package*.json
913
USER default
10-
RUN npm install
11-
COPY ./ .
1214

15+
RUN npm install
1316
RUN npm run build
1417
CMD ["npm", "run", "start"]

src/app/api/envConfig/route.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ export async function GET() {
1515
UPSTREAM_REPO_OWNER: process.env.NEXT_PUBLIC_TAXONOMY_REPO_OWNER || '',
1616
UPSTREAM_REPO_NAME: process.env.NEXT_PUBLIC_TAXONOMY_REPO || '',
1717
DEPLOYMENT_TYPE: process.env.IL_UI_DEPLOYMENT || '',
18-
EXPERIMENTAL_FEATURES: process.env.NEXT_PUBLIC_EXPERIMENTAL_FEATURES || ''
18+
ENABLE_DEV_MODE: process.env.IL_ENABLE_DEV_MODE || 'false',
19+
EXPERIMENTAL_FEATURES: process.env.NEXT_PUBLIC_EXPERIMENTAL_FEATURES || '',
20+
TAXONOMY_ROOT_DIR: process.env.NEXT_PUBLIC_TAXONOMY_ROOT_DIR || ''
1921
};
2022

2123
return NextResponse.json(envConfig);
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// src/app/api/native/fine-tune/git/branches/route.ts
2+
import { NextResponse } from 'next/server';
3+
import * as git from 'isomorphic-git';
4+
import fs from 'fs';
5+
import path from 'path';
6+
7+
const REMOTE_TAXONOMY_ROOT_DIR = process.env.NEXT_PUBLIC_TAXONOMY_ROOT_DIR || '';
8+
9+
export async function GET() {
10+
const REPO_DIR = path.join(REMOTE_TAXONOMY_ROOT_DIR, '/taxonomy');
11+
try {
12+
console.log(`Checking local taxonomy directory for branches: ${REPO_DIR}`);
13+
14+
// Ensure the repository path exists
15+
if (!fs.existsSync(REPO_DIR)) {
16+
console.log('Local repository path does not exist:', REPO_DIR);
17+
return NextResponse.json({ error: 'Local repository path does not exist.' }, { status: 400 });
18+
}
19+
20+
console.log('Local taxonomy directory exists. Proceeding with branch listing.');
21+
22+
// List all branches in the repository
23+
const branches = await git.listBranches({ fs, dir: REPO_DIR });
24+
console.log(`Branches found: ${branches.join(', ')}`);
25+
26+
const branchDetails = [];
27+
28+
for (const branch of branches) {
29+
const branchCommit = await git.resolveRef({
30+
fs,
31+
dir: REPO_DIR,
32+
ref: branch
33+
});
34+
const commitDetails = await git.readCommit({
35+
fs,
36+
dir: REPO_DIR,
37+
oid: branchCommit
38+
});
39+
40+
const commitMessage = commitDetails.commit.message;
41+
42+
// Check for Signed-off-by line
43+
const signoffMatch = commitMessage.match(/^Signed-off-by: (.+)$/m);
44+
const signoff = signoffMatch ? signoffMatch[1] : null;
45+
const messageStr = commitMessage.split('Signed-off-by');
46+
47+
branchDetails.push({
48+
name: branch,
49+
creationDate: commitDetails.commit.committer.timestamp * 1000,
50+
message: messageStr[0].replace(/\n+$/, ''),
51+
author: signoff
52+
});
53+
}
54+
55+
// Sort by creation date, newest first
56+
branchDetails.sort((a, b) => b.creationDate - a.creationDate);
57+
58+
console.log('Total branches present in native taxonomy (fine-tune):', branchDetails.length);
59+
60+
return NextResponse.json({ branches: branchDetails }, { status: 200 });
61+
} catch (error) {
62+
console.error('Failed to list branches from local taxonomy (fine-tune):', error);
63+
return NextResponse.json({ error: 'Failed to list branches from local taxonomy (fine-tune)' }, { status: 500 });
64+
}
65+
}

src/app/api/fine-tune/model/train/route.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// src/app/api/fine-tune/model/train
1+
// src/app/api/fine-tune/model/train/route.ts
22
'use server';
33

44
import { NextResponse } from 'next/server';
@@ -8,16 +8,21 @@ export async function POST(request: Request) {
88
console.log('Received train job request');
99

1010
// Parse the request body for required data
11-
const { modelName, branchName } = await request.json();
11+
const { modelName, branchName, epochs } = await request.json();
1212
const API_SERVER = process.env.NEXT_PUBLIC_API_SERVER!;
1313

14-
console.log('Request body:', { modelName, branchName });
14+
console.log('Request body:', { modelName, branchName, epochs });
1515

1616
if (!modelName || !branchName) {
1717
console.error('Missing required parameters: modelName and branchName');
1818
return NextResponse.json({ error: 'Missing required parameters: modelName and branchName' }, { status: 400 });
1919
}
2020

21+
// Validate epochs if provided
22+
if (epochs !== undefined && (typeof epochs !== 'number' || epochs <= 0)) {
23+
return NextResponse.json({ error: "'epochs' must be a positive integer" }, { status: 400 });
24+
}
25+
2126
// Forward the request to the API server
2227
const endpoint = `${API_SERVER}/model/train`;
2328

@@ -30,7 +35,8 @@ export async function POST(request: Request) {
3035
},
3136
body: JSON.stringify({
3237
modelName,
33-
branchName
38+
branchName,
39+
epochs
3440
})
3541
});
3642

@@ -40,7 +46,8 @@ export async function POST(request: Request) {
4046
});
4147

4248
if (!response.ok) {
43-
console.error('Error response from API server:', response.status, response.statusText);
49+
const errorText = await response.text();
50+
console.error('Error response from API server:', response.status, response.statusText, errorText);
4451
return NextResponse.json({ error: 'Failed to train the model on the API server' }, { status: response.status });
4552
}
4653

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// src/app/api/model/vllm-status/route.ts
2+
'use server';
3+
4+
import { NextResponse } from 'next/server';
5+
6+
export async function GET(request: Request) {
7+
try {
8+
const { searchParams } = new URL(request.url);
9+
const modelName = searchParams.get('modelName');
10+
if (!modelName) {
11+
return NextResponse.json({ error: 'Missing modelName query param' }, { status: 400 });
12+
}
13+
14+
const API_SERVER = process.env.NEXT_PUBLIC_API_SERVER!;
15+
const endpoint = `${API_SERVER}/vllm-status?model_name=${modelName}`;
16+
17+
console.log('Forwarding request to vllm-status:', endpoint);
18+
19+
const response = await fetch(endpoint);
20+
if (!response.ok) {
21+
console.error('vllm-status error from API server:', response.status, response.statusText);
22+
return NextResponse.json({ error: 'Failed to get vllm status' }, { status: response.status });
23+
}
24+
25+
const statusData = await response.json();
26+
return NextResponse.json(statusData, { status: 200 });
27+
} catch (error) {
28+
console.error('Unexpected error in vllm-status route:', error);
29+
return NextResponse.json({ error: 'Unexpected error fetching vllm status' }, { status: 500 });
30+
}
31+
}
Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
1+
// src/app/api/fine-tune/pipeline/generate-train/route.ts
12
'use server';
23

34
import { NextResponse } from 'next/server';
45

56
export async function POST(request: Request) {
67
try {
78
// Parse the request body for required data
8-
const { modelName, branchName } = await request.json();
9+
const { modelName, branchName, epochs } = await request.json();
910
const API_SERVER = process.env.NEXT_PUBLIC_API_SERVER!;
1011

12+
console.log('Request body:', { modelName, branchName, epochs });
13+
1114
if (!modelName || !branchName) {
15+
console.error('Missing required parameters: modelName and branchName');
1216
return NextResponse.json({ error: 'Missing required parameters: modelName and branchName' }, { status: 400 });
1317
}
1418

19+
// Validate epochs if provided
20+
if (epochs !== undefined && (typeof epochs !== 'number' || epochs <= 0)) {
21+
return NextResponse.json({ error: "'epochs' must be a positive integer" }, { status: 400 });
22+
}
23+
1524
// Forward the request to the API server's pipeline endpoint
1625
const endpoint = `${API_SERVER}/pipeline/generate-train`;
1726

@@ -22,19 +31,42 @@ export async function POST(request: Request) {
2231
},
2332
body: JSON.stringify({
2433
modelName,
25-
branchName
34+
branchName,
35+
epochs
2636
})
2737
});
2838

39+
console.log('Response from API server:', {
40+
status: response.status,
41+
statusText: response.statusText
42+
});
43+
2944
if (!response.ok) {
30-
console.error('Error response from API server (pipeline):', response.status, response.statusText);
31-
return NextResponse.json({ error: 'Failed to run generate-train pipeline on the API server' }, { status: response.status });
45+
const errorText = await response.text();
46+
console.error('Error response from API server:', response.status, response.statusText, errorText);
47+
return NextResponse.json({ error: 'Failed to train the model on the API server' }, { status: response.status });
48+
}
49+
50+
const responseData;
51+
try {
52+
const text = await response.text();
53+
responseData = text ? JSON.parse(text) : {};
54+
console.log('Parsed response data:', responseData);
55+
} catch (error) {
56+
console.error('Error parsing JSON response from API server:', error);
57+
return NextResponse.json({ error: 'Invalid JSON response from the API server' }, { status: 500 });
58+
}
59+
60+
if (!responseData.job_id) {
61+
console.error('Missing job_id in API server response:', responseData);
62+
return NextResponse.json({ error: 'API server response does not contain job_id' }, { status: 500 });
3263
}
3364

34-
const responseData = await response.json();
65+
// Return the response from the API server to the client
66+
console.log('Returning success response with job_id:', responseData.job_id);
3567
return NextResponse.json(responseData, { status: 200 });
3668
} catch (error) {
37-
console.error('Error during generate-train pipeline:', error);
38-
return NextResponse.json({ error: 'An error occurred during generate-train pipeline' }, { status: 500 });
69+
console.error('Unexpected error during training:', error);
70+
return NextResponse.json({ error: 'An unexpected error occurred during training' }, { status: 500 });
3971
}
4072
}

src/app/api/local/clone-repo/route.ts

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)