gpueater 1.0.7 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +54 -22
- data/lib/gpueater.rb +41 -69
- data/lib/gpueater/version.rb +1 -1
- data/lib/test.rb +135 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50817cbee4b0de663c0b9e233365f52a60c266c7
|
4
|
+
data.tar.gz: 30b97d04bc9322d74676140e9fbffacb5706dca2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fbb449018de2c927a0820f08b7fe0a64b98bb59eb8d33053be64988958d9c1a74216f4ac0b38c07bdfc199ac43686279e3ed7bccc249e3047072316359ec145
|
7
|
+
data.tar.gz: 05dc12ca6d11cea53523336d4e77bc50e3c8c45a13bd3479fd4dd60c06e1c4bed1dc6ca884b4133e8c91f998eafa52514c7403fdcc063e156219ea263281d160
|
data/README.md
CHANGED
@@ -8,6 +8,37 @@ This document is intended to describe how to set up this API and how to control
|
|
8
8
|
Before getting started, register your account on GPUEater.
|
9
9
|
https://www.gpueater.com/
|
10
10
|
|
11
|
+
<br>
|
12
|
+
<br>
|
13
|
+
|
14
|
+
----------------------------------------
|
15
|
+
|
16
|
+
|
17
|
+
### AMD RadeonGPU ROCm-TensorFlow information (https://github.com/aieater/rocm_tensorflow_info)
|
18
|
+
<br>
|
19
|
+
This README is intended to provide helpful information for Deep Learning developers with AMD ROCm.<br>
|
20
|
+
<br>
|
21
|
+
Unfortunately, AMD's official repository for ROCm sometimes includes old or missing information. Therefore, on this readme, we will endeavor to describe accurate information based on the knowledge gained by GPUEater infrastructure development and operation.<br>
|
22
|
+
<br>
|
23
|
+
<br>
|
24
|
+
|
25
|
+
- How to setup Radeon GPU Driver (ROCm) on Ubuntu16.04/18.04
|
26
|
+
- How to setup ROCm-Tensorflow on Ubuntu16.04/18.04
|
27
|
+
+ ROCm(AMDGPU)-TensorFlow 1.8 Python2.7/Python3.5 + UbuntuOS
|
28
|
+
+ ROCm(AMDGPU)-TensorFlow 1.10.0-x Python2.7/Python3.5/Python3.6 + UbuntuOS
|
29
|
+
+ CPU-TensorFlow 1.10.1 Python3.7 + MacOSX
|
30
|
+
- Lightweight ROCm-TensorFlow docker
|
31
|
+
+ ROCm-TensorFlow on GPUEater
|
32
|
+
+ ROCm-TensorFlow1.8 docker
|
33
|
+
|
34
|
+
ROCm information URL : https://github.com/aieater/rocm_tensorflow_info
|
35
|
+
<br>
|
36
|
+
<br>
|
37
|
+
<br>
|
38
|
+
|
39
|
+
----------------------------------------
|
40
|
+
|
41
|
+
|
11
42
|
### Prerequisites
|
12
43
|
1. Ruby 2.x is required to run GPUEater API Console.
|
13
44
|
2. Create a JSON file in accordance with the following instruction.
|
@@ -146,10 +177,11 @@ res.select{|e| e['tag'] == 'HappyGPUProgramming' }.each{|e|
|
|
146
177
|
| Version | Function | Required | Description |
|
147
178
|
| ---- | ---- | ---- | ---- |
|
148
179
|
| v0.8 | image_list() | | Listing all OS images |
|
149
|
-
| v1.
|
150
|
-
| v1.
|
180
|
+
| v1.7 | snapshot_instance(form) | instance_id, machine_resource_id | Creating a snapshot |
|
181
|
+
| v1.7 | delete_snapshot(form) | instance_id, machine_resource_id | Deleting a snapshot |
|
182
|
+
| v1.5 | registered_image_list() | | Listing all user defined OS images |
|
151
183
|
| v1.5 | create_image(form) | instance_id, machine_resource_id | Adding an user defined OS image |
|
152
|
-
| v2.0 |
|
184
|
+
| v2.0 | import_image(form) | url | Registering an user defined OS image on the internet |
|
153
185
|
| v1.5 | delete_image(form) | image | Deleting an OS image |
|
154
186
|
|
155
187
|
|
@@ -204,7 +236,7 @@ puts g.ssh_key_list
|
|
204
236
|
| v0.8 | instance_list() | | Listing all launched instances |
|
205
237
|
| v1.0 | change_instance_tag(form) | instance_id, tag | Changing an instance tag |
|
206
238
|
| v1.0 | start_instance(form) | instance_id, machine_resource_id | Starting an instance. If the instance is already RUNNING, nothing is going to happen |
|
207
|
-
| v1.0 | stop_instance(form) | instance_id, machine_resource_id | Stopping an instance. If the instance is already STOPPED, nothing is going to happen |
|
239
|
+
| v1.0 | ~~stop_instance(form)~~[Deprecated] | instance_id, machine_resource_id | Stopping an instance. If the instance is already STOPPED, nothing is going to happen |
|
208
240
|
| v1.0 | restart_instance(form) | instance_id, machine_resource_id | Restarting an instance |
|
209
241
|
| v0.8 | terminate_instance(form) | instance_id, machine_resource_id | Terminating an instance |
|
210
242
|
| v1.0 | emergency_restart_instance(form) | instance_id, machine_resource_id | Restarting an instance emergently when an instance is hung up |
|
@@ -228,7 +260,7 @@ g.terminate_instance(instance)
|
|
228
260
|
| v1.0 | open_port(form) | instance_id, connection_id, port | Opening a port for inbound traffic |
|
229
261
|
| v1.0 | close_port(form) | instance_id, connection_id, port | Closing a port for inbound traffic |
|
230
262
|
| v1.0 | renew_ipv4(form) | instance_id | Getting a new IPv4 address |
|
231
|
-
| v1.0 | network_description(form) | instance_id | This API reports current network status
|
263
|
+
| v1.0 | network_description(form) | instance_id | This API reports current network status |
|
232
264
|
|
233
265
|
##### Storage
|
234
266
|
| Version | Function | Required | Description |
|
@@ -241,47 +273,47 @@ g.terminate_instance(instance)
|
|
241
273
|
##### Subscription
|
242
274
|
| Version | Function | Required | Description |
|
243
275
|
| ---- | ---- | ---- | ---- |
|
244
|
-
| v2.0 | subscription_instance_list() | | Listing all
|
245
|
-
| v2.0 | subscription_storage_list() | | Listing all
|
246
|
-
| v2.0 | subscription_network_list() | | Listing all
|
276
|
+
| v2.0 | subscription_instance_list() | | Listing all subscription instances |
|
277
|
+
| v2.0 | subscription_storage_list() | | Listing all storage volumes |
|
278
|
+
| v2.0 | subscription_network_list() | | Listing all subscription networks |
|
247
279
|
| v2.0 | subscribe_instance(form) | subscription_id | Subscribing a subscription instance |
|
248
280
|
| v2.0 | unsubscribe_instance(form) | subscription_id | Canceling a subscription instance |
|
249
|
-
| v2.0 | subscribe_storage(form) | subscription_id | Subscribing a storage volume
|
250
|
-
| v2.0 | unsubscribe_storage(form) | subscription_id | Canceling a storage volume
|
281
|
+
| v2.0 | subscribe_storage(form) | subscription_id | Subscribing a storage volume |
|
282
|
+
| v2.0 | unsubscribe_storage(form) | subscription_id | Canceling a storage volume |
|
251
283
|
| v2.0 | subscribe_network(form) | subscription_id | Subscribing a network product |
|
252
284
|
| v2.0 | unsubscribe_network(form) | subscription_id | Canceling a network product |
|
253
285
|
|
254
286
|
##### Special
|
255
287
|
| Version | Function | Required | Description |
|
256
288
|
| ---- | ---- | ---- | ---- |
|
257
|
-
| v2.5 | live_migration(form) | product_id, region_id, connection_id | Moving a running instance
|
289
|
+
| v2.5 | live_migration(form) | product_id, region_id, connection_id | Moving a running instance to another physical machine without termination |
|
258
290
|
| v2.5 | cancel_transaction(form) | transaction_id | Canceling a transaction |
|
259
|
-
| v2.5 | peak_transaction(form) | transaction_id |
|
291
|
+
| v2.5 | peak_transaction(form) | transaction_id | checking a current transaction status |
|
260
292
|
|
261
293
|
##### Payment
|
262
294
|
| Version | Function | Required | Description |
|
263
295
|
| ---- | ---- | ---- | ---- |
|
264
296
|
| v1.0 | invoice_list() | | Listing invoices for on-demand instances |
|
265
297
|
| v2.0 | subscription_invoice_list() | | Listing invoices for subscription instances |
|
266
|
-
| v1.
|
298
|
+
| v1.7 | make_invoice(form) | invoice_id | Obtain a pdf invoice |
|
267
299
|
|
268
300
|
##### Extensions
|
269
301
|
| Version | Function | Required | Description |
|
270
302
|
| ---- | ---- | ---- | ---- |
|
271
|
-
| v1.
|
272
|
-
| v1.
|
273
|
-
| v1.
|
274
|
-
| v1.
|
275
|
-
| v1.
|
276
|
-
| v1.
|
277
|
-
| v1.
|
278
|
-
| v1.
|
303
|
+
| v1.7 | copy_file(form) | action("get"or"put"), src, dst | Copying a file. "get" obtains a file from a remote host to your local host, and "put" is the opposite. "src" is a source file path, and "dst" is a destination file path |
|
304
|
+
| v1.7 | delete_file(form) | src, recursive | Deleting a remote file |
|
305
|
+
| v1.7 | move_file(form) | action("get"or"put"), src, dst | Moving a file. "get" obtains a file from a remote host to your local host, and "put" is the opposite. "src" is a source file path, and "dst" is a destination file path |
|
306
|
+
| v1.7 | make_directory(form) | dst | Making a directory in a remote host |
|
307
|
+
| v1.7 | file_list(form) | src | Listing all files in a remote host |
|
308
|
+
| v1.7 | synchronize_files(form) | action, src, dst | This API is similar to the "rsync" |
|
309
|
+
| v1.7 | login_instance(form) | instance_id | Logging in a specific instance through the SSH |
|
310
|
+
| v1.7 | tunnel(form) | instance_id, port | This API enables a port tunneling between your local and a remote host |
|
279
311
|
|
280
312
|
##### Class API
|
281
313
|
| Version | Function | Required | Description |
|
282
314
|
| ---- | ---- | ---- | ---- |
|
283
315
|
| v0.8 | new() | | Instantiating a gpueater object |
|
284
|
-
| v1.
|
316
|
+
| v1.7 | api_list() | | Listing all available APIs. |
|
285
317
|
|
286
318
|
|
287
319
|
|
data/lib/gpueater.rb
CHANGED
@@ -24,10 +24,11 @@ module GPUEater
|
|
24
24
|
builder.use Faraday::Request::UrlEncoded
|
25
25
|
# builder.use Faraday::Response::Logger
|
26
26
|
builder.use Faraday::Adapter::NetHttpPersistent # gem install net-http-persistent
|
27
|
+
builder.options[:timeout] = 1800
|
27
28
|
end
|
28
29
|
@alist=["raccoon", "dog", "wild boar", "rabbit", "cow", "horse", "wolf", "hippopotamus", "kangaroo", "fox", "giraffe", "bear", "koala", "bat", "gorilla", "rhinoceros", "monkey", "deer", "zebra", "jaguar", "polar bear", "skunk", "elephant", "raccoon dog", "animal", "reindeer", "rat", "tiger", "cat", "mouse", "buffalo", "hamster", "panda", "sheep", "leopard", "pig", "mole", "goat", "lion", "camel", "squirrel", "donkey"]
|
29
30
|
@blist=["happy", "glad", "comfortable", "pleased", "delighted", "relieved", "calm", "surprised", "exciting"]
|
30
|
-
|
31
|
+
|
31
32
|
begin
|
32
33
|
@g_config = JSON.load(open(".eater").read)
|
33
34
|
rescue
|
@@ -45,6 +46,11 @@ module GPUEater
|
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
49
|
+
# def clear_cache
|
50
|
+
# puts @cookie_path
|
51
|
+
# File.delete(@cookie_path)
|
52
|
+
# end
|
53
|
+
|
48
54
|
|
49
55
|
def _get(u,q={})
|
50
56
|
puts u if @debug
|
@@ -59,7 +65,7 @@ module GPUEater
|
|
59
65
|
end
|
60
66
|
return response
|
61
67
|
end
|
62
|
-
|
68
|
+
|
63
69
|
def _post(u,form)
|
64
70
|
puts u if @debug
|
65
71
|
response = @conn.post do |req|
|
@@ -106,9 +112,9 @@ module GPUEater
|
|
106
112
|
[@images,@ssh_keys,@products].to_s
|
107
113
|
end
|
108
114
|
end
|
109
|
-
|
110
|
-
|
111
|
-
|
115
|
+
|
116
|
+
|
117
|
+
|
112
118
|
def func_get(api,required_fields=[],query={}, e=nil, try=2)
|
113
119
|
raise e if try <= 0
|
114
120
|
required_fields.each{|v| raise "Required field => #{v}" unless query.include?(v) }
|
@@ -136,7 +142,7 @@ module GPUEater
|
|
136
142
|
raise j['error'] if j['error']
|
137
143
|
j['data']
|
138
144
|
end
|
139
|
-
|
145
|
+
|
140
146
|
def func_post_inss(api,required_fields=[],form={}, e=nil, try=2)
|
141
147
|
raise e if try <= 0
|
142
148
|
required_fields.each{|v| raise "Required field => #{v}" unless form.include?(v) }
|
@@ -151,7 +157,7 @@ module GPUEater
|
|
151
157
|
raise j['error'] if j['error']
|
152
158
|
j['data']
|
153
159
|
end
|
154
|
-
|
160
|
+
|
155
161
|
# def func_post_launch(api,required_fields=[],form={}, e=nil, try=2)
|
156
162
|
# raise e if try <= 0
|
157
163
|
# tag = form['tag']
|
@@ -175,16 +181,20 @@ module GPUEater
|
|
175
181
|
# raise j['error'] if j['error']
|
176
182
|
# j['data']
|
177
183
|
# end
|
178
|
-
|
184
|
+
|
179
185
|
def ___________image___________;end #@
|
180
186
|
def image_list; func_get('/console/servers/images'); end #@
|
181
|
-
def
|
182
|
-
def
|
183
|
-
def
|
184
|
-
def
|
185
|
-
|
186
|
-
|
187
|
-
|
187
|
+
def snapshot_list; func_get('/console/servers/snapshots'); end #@
|
188
|
+
def take_snapshot(form); func_post('/console/servers/take_snapshot',['instance_id','tag'],form); end #@
|
189
|
+
def change_snapshot_tag(form); func_post('/console/servers/change_snapshot_tag',['snapshot_id','tag'],form); end #@
|
190
|
+
def delete_snapshot(form); func_post('/console/servers/delete_snapshot',['snapshot_id'],form); end #@
|
191
|
+
|
192
|
+
def registered_image_list; func_get('/console/servers/registered_image_list'); end #@
|
193
|
+
def create_image(form); func_post('/console/servers/create_user_defined_image',['instance_id','image_name'],form); end #@
|
194
|
+
def delete_image(form); func_post('/console/servers/delete_user_defined_image',['fingerprint'],form); end #@
|
195
|
+
def import_image(form); func_post('/console/servers/import_image',['url','image_name'],form); end #@
|
196
|
+
|
197
|
+
|
188
198
|
def ___________ssh_key___________;end #@
|
189
199
|
def ssh_key_list; func_get('/console/servers/ssh_keys'); end #@
|
190
200
|
def generate_ssh_key; func_get('/console/servers/ssh_key_gen'); end #@
|
@@ -198,52 +208,14 @@ module GPUEater
|
|
198
208
|
def launch_subcription_instance(form); raise "Not implemented yet"; end #@
|
199
209
|
def instance_list; func_get('/console/servers/instance_list'); end #@
|
200
210
|
def change_instance_tag(form); func_post('/console/servers/change_instance_tag',['instance_id','tag'],form); end #@
|
211
|
+
|
201
212
|
def start_instance(form); func_post_inss('/console/servers/start',['instance_id','machine_resource_id'],form); end #@
|
202
213
|
def stop_instance(form); func_post_inss('/console/servers/stop',['instance_id','machine_resource_id'],form); end #@
|
203
214
|
def restart_instance(form); func_post_inss('/console/servers/stop',['instance_id','machine_resource_id'],form); func_post_inss('/console/servers/start',['instance_id','machine_resource_id'],form); end #@
|
204
215
|
def terminate_instance(form); func_post_inss('/console/servers/force_terminate',['instance_id','machine_resource_id'],form); end #@
|
205
216
|
def emergency_restart_instance(form); func_post_inss('/console/servers/emergency_restart',['instance_id','machine_resource_id'],form); end #@
|
206
|
-
|
207
|
-
|
208
|
-
ins = instance_list()[0]
|
209
|
-
puts network_description(ins)
|
210
|
-
ins['port'] = 9999
|
211
|
-
open_port(ins)
|
212
|
-
puts port_list(ins)
|
213
|
-
close_port(ins)
|
214
|
-
puts port_list(ins)
|
215
|
-
|
216
|
-
end
|
217
|
-
def test
|
218
|
-
pd = ondemand_list
|
219
|
-
image = pd.find_image "Ubuntu16.04 x64"
|
220
|
-
ssh_key = pd.find_ssh_key "my_ssh_key2"
|
221
|
-
product = pd.find_product "n1.p400"
|
222
|
-
|
223
|
-
emergency_restart_instance(instance_list[0]);
|
224
|
-
p image
|
225
|
-
p ssh_key["id"]
|
226
|
-
p product["id"]
|
227
|
-
|
228
|
-
#launch_ondemand_instance({"tag"=>"ponkoponko","product_id"=>product["id"], "ssh_key_id"=>ssh_key["id"], "image" => image["alias"]});
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
def ssh_key_test
|
233
|
-
key = generate_ssh_key
|
234
|
-
keyname = 'my_ssh_key2'
|
235
|
-
ssh_key_list().select{|e| delete_ssh_key(e) if e["name"] == keyname }
|
236
|
-
register_ssh_key({"name"=>keyname,"public_key"=>key["public_key"]})
|
237
|
-
pem = File.join(@homedir,'.ssh',keyname+".pem")
|
238
|
-
fp = open(pem,"w")
|
239
|
-
fp.write(key["private_key"])
|
240
|
-
fp.close
|
241
|
-
FileUtils.chmod(0600,pem)
|
242
|
-
puts ssh_key_list
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
|
217
|
+
|
218
|
+
|
247
219
|
def __________network__________;end #@
|
248
220
|
def port_list(form); func_get('/console/servers/port_list',['instance_id'],form); end #@
|
249
221
|
def open_port(form); func_post('/console/servers/add_port',['instance_id','connection_id','port'],form); end #@
|
@@ -251,13 +223,13 @@ module GPUEater
|
|
251
223
|
def renew_ipv4(form); func_post('/console/servers/renew_ipv4',['instance_id'],form); end #@
|
252
224
|
def refresh_ipv4(form); func_post('/console/servers/refresh_ipv4',['instance_id'],form); end #@
|
253
225
|
def network_description(form); func_get('/console/servers/instance_info',['instance_id'],form); end #@
|
254
|
-
|
255
|
-
|
226
|
+
|
227
|
+
|
256
228
|
def __________storage__________;end #@
|
257
229
|
def create_volume; raise "Not implemented yet"; end #@
|
258
230
|
def delete_volume; raise "Not implemented yet"; end #@
|
259
231
|
def transfer_volume; raise "Not implemented yet"; end #@
|
260
|
-
|
232
|
+
|
261
233
|
def _________subscription__________;end #@
|
262
234
|
def subscription_instance_list; raise "Not implemented yet"; end #@
|
263
235
|
def subscription_storage_list; raise "Not implemented yet"; end #@
|
@@ -268,7 +240,7 @@ module GPUEater
|
|
268
240
|
def unsubscribe_storage; raise "Not implemented yet"; end #@
|
269
241
|
def subscribe_network; raise "Not implemented yet"; end #@
|
270
242
|
def unsubscribe_network; raise "Not implemented yet"; end #@
|
271
|
-
|
243
|
+
|
272
244
|
def _________special__________;end #@
|
273
245
|
def live_migration; raise "Not implemented yet"; end #@
|
274
246
|
def cancel_transaction; raise "Not implemented yet"; end #@
|
@@ -277,7 +249,7 @@ module GPUEater
|
|
277
249
|
def invoice_list; func_get('/console/servers/charge_list'); end #@
|
278
250
|
def subscription_invoice_list; raise "Not implemented yet"; end #@
|
279
251
|
def make_invoice; raise "Not implemented yet"; end #@
|
280
|
-
|
252
|
+
|
281
253
|
def payment_test
|
282
254
|
puts invoice_list
|
283
255
|
end
|
@@ -291,16 +263,16 @@ module GPUEater
|
|
291
263
|
def synchronize_files; raise "Not implemented yet"; end #@
|
292
264
|
def login_instance; raise "Not implemented yet"; end #@
|
293
265
|
def tunnel; raise "Not implemented yet"; end #@
|
294
|
-
|
266
|
+
|
295
267
|
def __________________________;end #@
|
296
|
-
|
268
|
+
|
297
269
|
end
|
298
|
-
|
299
|
-
|
300
|
-
|
301
270
|
|
302
271
|
|
303
|
-
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
304
276
|
def self.new #@
|
305
277
|
return APIv1.new
|
306
278
|
end
|
@@ -336,7 +308,7 @@ if __FILE__ == $0
|
|
336
308
|
end
|
337
309
|
end
|
338
310
|
}
|
339
|
-
|
311
|
+
|
340
312
|
st2 = ret2.join("\n")
|
341
313
|
fp = open(__FILE__,"w")
|
342
314
|
fp.write(st2)
|
@@ -413,4 +385,4 @@ end
|
|
413
385
|
# login_instance
|
414
386
|
# tunnel
|
415
387
|
# __________________________
|
416
|
-
# new
|
388
|
+
# new
|
data/lib/gpueater/version.rb
CHANGED
data/lib/test.rb
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift('.')
|
3
|
+
|
4
|
+
require 'gpueater'
|
5
|
+
|
6
|
+
|
7
|
+
def clear_instance
|
8
|
+
g = GPUEater.new
|
9
|
+
ls = g.instance_list
|
10
|
+
p ls
|
11
|
+
ls.each{|e|
|
12
|
+
puts e
|
13
|
+
ret = g.terminate_instance(e)
|
14
|
+
puts ret
|
15
|
+
}
|
16
|
+
puts "clear_instance - done"
|
17
|
+
end
|
18
|
+
|
19
|
+
def clear_images
|
20
|
+
g = GPUEater.new
|
21
|
+
ls = g.registered_image_list
|
22
|
+
p ls
|
23
|
+
|
24
|
+
ls.each{|e|
|
25
|
+
puts "+++++++++"
|
26
|
+
puts e
|
27
|
+
ret = g.delete_image(e);
|
28
|
+
puts ret
|
29
|
+
}
|
30
|
+
puts "clear_images - done."
|
31
|
+
end
|
32
|
+
|
33
|
+
def create_test_instance
|
34
|
+
g = GPUEater.new
|
35
|
+
ps = g.ondemand_list()
|
36
|
+
image = ps.find_image("Ubuntu16.04 x64")
|
37
|
+
ssh_key = ps.find_ssh_key("guest")
|
38
|
+
product = ps.find_product("a1.vegafe")
|
39
|
+
ret = g.launch_ondemand_instance({"tag"=>"test_instance","product_id"=>product["id"], "ssh_key_id"=>ssh_key["id"], "image" => image["alias"]});
|
40
|
+
puts ret
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
def test_instance
|
45
|
+
puts "------------------------------------------"
|
46
|
+
|
47
|
+
clear_instance()
|
48
|
+
|
49
|
+
create_test_instance()
|
50
|
+
|
51
|
+
clear_instance()
|
52
|
+
|
53
|
+
puts "------------------------------------------"
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
def create_user_defined_image()
|
58
|
+
g = GPUEater.new
|
59
|
+
puts "registered_image_list"
|
60
|
+
p g.registered_image_list()
|
61
|
+
ins = g.instance_list().pop()
|
62
|
+
puts ins
|
63
|
+
ins['image_name'] = 'test_image'
|
64
|
+
ret = g.create_image(ins)
|
65
|
+
puts ret
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
def test_image
|
71
|
+
puts "------------------------------------------"
|
72
|
+
|
73
|
+
clear_images()
|
74
|
+
clear_instance()
|
75
|
+
|
76
|
+
|
77
|
+
g = GPUEater.new
|
78
|
+
puts "image_list"
|
79
|
+
p g.image_list()
|
80
|
+
|
81
|
+
puts "registered_image_list"
|
82
|
+
p g.registered_image_list()
|
83
|
+
|
84
|
+
create_user_defined_image()
|
85
|
+
|
86
|
+
puts "------------------------------------------"
|
87
|
+
end
|
88
|
+
|
89
|
+
|
90
|
+
create_user_defined_image()
|
91
|
+
|
92
|
+
def test_networking
|
93
|
+
puts "------------------------------------------"
|
94
|
+
puts "Start networking test"
|
95
|
+
g = GPUEater.new
|
96
|
+
is = g.instance_list()
|
97
|
+
if is.length > 0
|
98
|
+
ins = g.instance_list()[0]
|
99
|
+
puts g.network_description(ins)
|
100
|
+
ins['port'] = 9999
|
101
|
+
g.open_port(ins)
|
102
|
+
puts g.port_list(ins)
|
103
|
+
g.close_port(ins)
|
104
|
+
puts g.port_list(ins)
|
105
|
+
else
|
106
|
+
puts "No instance"
|
107
|
+
end
|
108
|
+
puts "networking test - done."
|
109
|
+
puts "------------------------------------------"
|
110
|
+
end
|
111
|
+
|
112
|
+
def test
|
113
|
+
pd = ondemand_list
|
114
|
+
image = pd.find_image "Ubuntu16.04 x64"
|
115
|
+
ssh_key = pd.find_ssh_key "my_ssh_key2"
|
116
|
+
product = pd.find_product "n1.p400"
|
117
|
+
|
118
|
+
emergency_restart_instance(instance_list[0]);
|
119
|
+
p image
|
120
|
+
p ssh_key["id"]
|
121
|
+
p product["id"]
|
122
|
+
|
123
|
+
def ssh_key_test
|
124
|
+
key = generate_ssh_key
|
125
|
+
keyname = 'my_ssh_key2'
|
126
|
+
ssh_key_list().select{|e| delete_ssh_key(e) if e["name"] == keyname }
|
127
|
+
register_ssh_key({"name"=>keyname,"public_key"=>key["public_key"]})
|
128
|
+
pem = File.join(@homedir,'.ssh',keyname+".pem")
|
129
|
+
fp = open(pem,"w")
|
130
|
+
fp.write(key["private_key"])
|
131
|
+
fp.close
|
132
|
+
FileUtils.chmod(0600,pem)
|
133
|
+
puts ssh_key_list
|
134
|
+
end
|
135
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gpueater
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pegara, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- gpueater.gemspec
|
99
99
|
- lib/gpueater.rb
|
100
100
|
- lib/gpueater/version.rb
|
101
|
+
- lib/test.rb
|
101
102
|
- release.sh
|
102
103
|
homepage: https://www.gpueater.com/
|
103
104
|
licenses:
|