apolinario commited on
Commit
630e591
·
1 Parent(s): 9716bcd

debug stuff

Browse files
ui/src/app/api/hf-jobs/route.ts CHANGED
@@ -1060,13 +1060,19 @@ async function checkHFJobsCapacity(token: string): Promise<any> {
1060
  childProcess.on('close', (code) => {
1061
  if (code === 0) {
1062
  try {
 
 
1063
  // Count RUNNING jobs in the output
1064
  const lines = output.split('\n');
1065
  let runningCount = 0;
1066
 
1067
- for (const line of lines) {
 
 
 
1068
  if (line.includes('RUNNING')) {
1069
  runningCount++;
 
1070
  }
1071
  }
1072
 
@@ -1084,6 +1090,8 @@ async function checkHFJobsCapacity(token: string): Promise<any> {
1084
  reject(new Error('Failed to parse capacity status'));
1085
  }
1086
  } else {
 
 
1087
  reject(new Error(error || output || 'Failed to check capacity'));
1088
  }
1089
  });
 
1060
  childProcess.on('close', (code) => {
1061
  if (code === 0) {
1062
  try {
1063
+ console.log('Raw hf jobs ps output:', output);
1064
+
1065
  // Count RUNNING jobs in the output
1066
  const lines = output.split('\n');
1067
  let runningCount = 0;
1068
 
1069
+ console.log(`Total lines in output: ${lines.length}`);
1070
+
1071
+ for (let i = 0; i < lines.length; i++) {
1072
+ const line = lines[i];
1073
  if (line.includes('RUNNING')) {
1074
  runningCount++;
1075
+ console.log(`Line ${i} contains RUNNING: "${line}"`);
1076
  }
1077
  }
1078
 
 
1090
  reject(new Error('Failed to parse capacity status'));
1091
  }
1092
  } else {
1093
+ console.error('hf jobs ps failed with code:', code);
1094
+ console.error('Error output:', error);
1095
  reject(new Error(error || output || 'Failed to check capacity'));
1096
  }
1097
  });
ui/src/components/HFJobsWorkflow.tsx CHANGED
@@ -222,11 +222,16 @@ export default function HFJobsWorkflow({ jobConfig, onComplete, hackathonEligibl
222
  }
223
 
224
  // Check capacity first
 
225
  const capacityResponse = await apiClient.post('/api/hf-jobs', {
226
  action: 'checkCapacity',
227
  token: effectiveToken,
228
  });
229
 
 
 
 
 
230
  if (capacityResponse.data.atCapacity) {
231
  throw new Error('Whoa, our GPUs are going brr 🔥, we are at capacity right now. Try again soon');
232
  }
 
222
  }
223
 
224
  // Check capacity first
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
  }