Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
a4a8094
1
Parent(s):
ff399b1
try dumbed terminal
Browse files
ui/src/app/api/hf-jobs/route.ts
CHANGED
|
@@ -1044,8 +1044,11 @@ async function checkHFJobsCapacity(token: string): Promise<any> {
|
|
| 1044 |
const childProcess = spawn('hf', args, {
|
| 1045 |
env: {
|
| 1046 |
...process.env,
|
| 1047 |
-
HF_TOKEN: token
|
| 1048 |
-
|
|
|
|
|
|
|
|
|
|
| 1049 |
});
|
| 1050 |
|
| 1051 |
let output = '';
|
|
|
|
| 1044 |
const childProcess = spawn('hf', args, {
|
| 1045 |
env: {
|
| 1046 |
...process.env,
|
| 1047 |
+
HF_TOKEN: token,
|
| 1048 |
+
TERM: 'dumb', // Disable fancy terminal features
|
| 1049 |
+
NO_COLOR: '1', // Disable color output
|
| 1050 |
+
},
|
| 1051 |
+
stdio: ['ignore', 'pipe', 'pipe'] // Explicitly set stdio to avoid TTY issues
|
| 1052 |
});
|
| 1053 |
|
| 1054 |
let output = '';
|
ui/src/components/HFJobsWorkflow.tsx
CHANGED
|
@@ -221,21 +221,7 @@ export default function HFJobsWorkflow({ jobConfig, onComplete, hackathonEligibl
|
|
| 221 |
throw new Error('A valid Hugging Face token is required to continue.');
|
| 222 |
}
|
| 223 |
|
| 224 |
-
//
|
| 225 |
-
console.log('Checking HF Jobs capacity...');
|
| 226 |
-
const capacityResponse = await apiClient.post('/api/hf-jobs', {
|
| 227 |
-
action: 'checkCapacity',
|
| 228 |
-
token: effectiveToken,
|
| 229 |
-
});
|
| 230 |
-
|
| 231 |
-
console.log('Capacity check response:', capacityResponse.data);
|
| 232 |
-
console.log('Running jobs:', capacityResponse.data.runningJobs);
|
| 233 |
-
console.log('At capacity:', capacityResponse.data.atCapacity);
|
| 234 |
-
|
| 235 |
-
if (capacityResponse.data.atCapacity) {
|
| 236 |
-
throw new Error('Whoa, our GPUs are going brr 🔥, we are at capacity right now. Try again soon');
|
| 237 |
-
}
|
| 238 |
-
|
| 239 |
const response = await apiClient.post('/api/hf-hub', {
|
| 240 |
action: 'whoami',
|
| 241 |
token: effectiveToken,
|
|
@@ -248,6 +234,24 @@ export default function HFJobsWorkflow({ jobConfig, onComplete, hackathonEligibl
|
|
| 248 |
if (!namespace) {
|
| 249 |
setNamespace(resolvedName);
|
| 250 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
setCurrentStep('upload');
|
| 252 |
}
|
| 253 |
} catch (err: any) {
|
|
|
|
| 221 |
throw new Error('A valid Hugging Face token is required to continue.');
|
| 222 |
}
|
| 223 |
|
| 224 |
+
// Validate token first
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
const response = await apiClient.post('/api/hf-hub', {
|
| 226 |
action: 'whoami',
|
| 227 |
token: effectiveToken,
|
|
|
|
| 234 |
if (!namespace) {
|
| 235 |
setNamespace(resolvedName);
|
| 236 |
}
|
| 237 |
+
|
| 238 |
+
// After token is validated, check capacity if participating in hackathon
|
| 239 |
+
if (hackathonEligible && participateHackathon) {
|
| 240 |
+
console.log('Checking HF Jobs capacity for hackathon namespace...');
|
| 241 |
+
const capacityResponse = await apiClient.post('/api/hf-jobs', {
|
| 242 |
+
action: 'checkCapacity',
|
| 243 |
+
token: effectiveToken,
|
| 244 |
+
});
|
| 245 |
+
|
| 246 |
+
console.log('Capacity check response:', capacityResponse.data);
|
| 247 |
+
console.log('Running jobs:', capacityResponse.data.runningJobs);
|
| 248 |
+
console.log('At capacity:', capacityResponse.data.atCapacity);
|
| 249 |
+
|
| 250 |
+
if (capacityResponse.data.atCapacity) {
|
| 251 |
+
throw new Error('Whoa, our GPUs are going brr 🔥, we are at capacity right now. Try again soon');
|
| 252 |
+
}
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
setCurrentStep('upload');
|
| 256 |
}
|
| 257 |
} catch (err: any) {
|