11// Assumes you have installed the paperspace-node package globally.
22// Use "require('../../paperspace-node')" if running from the repository tree.
3- var paperspace_node = require ( '../../ paperspace-node' ) ;
3+ var paperspace_node = require ( 'paperspace-node' ) ;
44
55// Set apkKey for use of the paperspace api
66var paperspace = paperspace_node ( {
@@ -18,27 +18,32 @@ paperspace.templates.list(
1818 }
1919 console . log ( resp . body ) ;
2020
21- // Search the response body for a template with the label 'ML in a Box'
21+ // Search the response body for a template with the label 'Ubuntu 14.04 Server'
22+ // NOTE: to use the 'ML in a Box' template substitute 'ML in a Box' for 'Ubuntu 14.04 Server'
23+ // and substitute 'GPU+' or 'P5000' for the machineType value. The 'C1' machineType is CPU-only.
24+ var t_label = 'Ubuntu 14.04 Server' ; // or 'ML in a Box'
25+ var m_machineType = 'C1' ; // or 'GPU+' or 'P5000' if choosing the 'ML in a Box' template
26+
2227 var t_id ;
2328 for ( var i = 0 ; i < resp . body . length ; i ++ ) {
24- if ( resp . body [ i ] . label === 'ML in a Box' ) {
29+ if ( resp . body [ i ] . label === t_label ) {
2530 t_id = resp . body [ i ] . id ;
2631 break ;
2732 }
2833 }
2934 if ( ! t_id ) {
30- console . log ( 'Error: \'ML in a Box \' template not found.' ) ;
35+ console . log ( 'Error: \'' + t_label + ' \' template not found.') ;
3136 process . exit ( 1 ) ;
3237 }
3338
34- // Create a machine using the found template id
35- console . log ( '\npaperspace.machines.create({\n region: \'East Coast (NY2)\',\n machineType: \'GPU+ \',' ) ;
39+ // Create a machine using the found template id, and the specified machine typ from above
40+ console . log ( '\npaperspace.machines.create({\n region: \'East Coast (NY2)\',\n machineType: \'' + m_machineType + ' \',') ;
3641 console . log ( ' size: 50,\n billingType: \'hourly\',\n machineName: \'Test Machine\',' ) ;
3742 console . log ( ' templateId: \'' + t_id + '\'}, ...);' ) ;
3843
3944 paperspace . machines . create ( {
4045 region : 'East Coast (NY2)' ,
41- machineType : 'GPU+' ,
46+ machineType : m_machineType ,
4247 size : 50 ,
4348 billingType : 'hourly' ,
4449 machineName : 'Test Machine' ,
0 commit comments