@@ -135,6 +135,11 @@ async function buyOrderAction(options: SfBuyOptions) {
135
135
return quoteAction ( options ) ;
136
136
}
137
137
138
+ const nodes = parseAccelerators ( options . accelerators )
139
+ if ( ! Number . isInteger ( nodes ) ) {
140
+ return logAndQuit ( `You can only buy whole nodes, or 8 GPUs at a time. Got: ${ options . accelerators } ` ) ;
141
+ }
142
+
138
143
// Grab the price per GPU hour, either
139
144
let pricePerGpuHour : number | null = parsePricePerGpuHour ( options . price ) ;
140
145
if ( ! pricePerGpuHour ) {
@@ -402,6 +407,10 @@ export async function placeBuyOrder(
402
407
"totalPriceInCents must be a whole number" ,
403
408
) ;
404
409
invariant ( options . numberNodes > 0 , "numberNodes must be greater than 0" ) ;
410
+ invariant (
411
+ options . numberNodes === Math . ceil ( options . numberNodes ) ,
412
+ "numberNodes must be a whole number" ,
413
+ ) ;
405
414
406
415
const api = await apiClient ( ) ;
407
416
const { data, error, response } = await api . POST ( "/v0/orders" , {
@@ -422,7 +431,7 @@ export async function placeBuyOrder(
422
431
if ( ! response . ok ) {
423
432
switch ( response . status ) {
424
433
case 400 :
425
- return logAndQuit ( `Bad Request: ${ error ?. message } ` ) ;
434
+ return logAndQuit ( `Bad Request: ${ error ?. message } ; ${ JSON . stringify ( error , null , 2 ) } ` ) ;
426
435
case 401 :
427
436
return await logSessionTokenExpiredAndQuit ( ) ;
428
437
case 500 :
@@ -488,7 +497,6 @@ export async function getQuote(options: QuoteOptions) {
488
497
if ( ! response . ok ) {
489
498
switch ( response . status ) {
490
499
case 400 :
491
- console . log ( "Error:" , error ) ;
492
500
return logAndQuit ( `Bad Request: ${ error ?. message } ` ) ;
493
501
case 401 :
494
502
return await logSessionTokenExpiredAndQuit ( ) ;
0 commit comments