@@ -135,6 +135,11 @@ async function buyOrderAction(options: SfBuyOptions) {
135135 return quoteAction ( options ) ;
136136 }
137137
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+
138143 // Grab the price per GPU hour, either
139144 let pricePerGpuHour : number | null = parsePricePerGpuHour ( options . price ) ;
140145 if ( ! pricePerGpuHour ) {
@@ -402,6 +407,10 @@ export async function placeBuyOrder(
402407 "totalPriceInCents must be a whole number" ,
403408 ) ;
404409 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+ ) ;
405414
406415 const api = await apiClient ( ) ;
407416 const { data, error, response } = await api . POST ( "/v0/orders" , {
@@ -422,7 +431,7 @@ export async function placeBuyOrder(
422431 if ( ! response . ok ) {
423432 switch ( response . status ) {
424433 case 400 :
425- return logAndQuit ( `Bad Request: ${ error ?. message } ` ) ;
434+ return logAndQuit ( `Bad Request: ${ error ?. message } ; ${ JSON . stringify ( error , null , 2 ) } ` ) ;
426435 case 401 :
427436 return await logSessionTokenExpiredAndQuit ( ) ;
428437 case 500 :
@@ -488,7 +497,6 @@ export async function getQuote(options: QuoteOptions) {
488497 if ( ! response . ok ) {
489498 switch ( response . status ) {
490499 case 400 :
491- console . log ( "Error:" , error ) ;
492500 return logAndQuit ( `Bad Request: ${ error ?. message } ` ) ;
493501 case 401 :
494502 return await logSessionTokenExpiredAndQuit ( ) ;
0 commit comments