gpueater 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +43 -0
- data/LICENSE.txt +21 -0
- data/README.md +142 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/gpueater.gemspec +40 -0
- data/lib/gpueater/version.rb +3 -0
- data/lib/gpueater.rb +174 -0
- metadata +125 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: beccaca8018c31fd575f0fe8add66e126bdb4dd7
|
4
|
+
data.tar.gz: 8d2dc17153a2aa26c139aa91f4988ce65c1156e4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c56a439d43bd23fb05969e3030b6f4ce1e4df92f8c0be7adca2ce694e8099ed0a831ae4b8a3d70fed07b24dcc87488b9ebb438b9d58f41681cd6deafd3dbc1d0
|
7
|
+
data.tar.gz: 1e2a2b07f5de78b7586b261320831ca9a8c26bc22bd176fa206622e461ef0b8a8b2a95af765f423f9ae2ff9b6dd51b0281a37cb4b98552d04e80c6183c8447c7
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at aki.nakatsuka@pegara.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
gpueater (0.0.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
connection_pool (2.2.2)
|
10
|
+
diff-lcs (1.3)
|
11
|
+
faraday (0.15.2)
|
12
|
+
multipart-post (>= 1.2, < 3)
|
13
|
+
multipart-post (2.0.0)
|
14
|
+
net-http-persistent (3.0.0)
|
15
|
+
connection_pool (~> 2.2)
|
16
|
+
rake (10.4.2)
|
17
|
+
rspec (3.7.0)
|
18
|
+
rspec-core (~> 3.7.0)
|
19
|
+
rspec-expectations (~> 3.7.0)
|
20
|
+
rspec-mocks (~> 3.7.0)
|
21
|
+
rspec-core (3.7.1)
|
22
|
+
rspec-support (~> 3.7.0)
|
23
|
+
rspec-expectations (3.7.0)
|
24
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
25
|
+
rspec-support (~> 3.7.0)
|
26
|
+
rspec-mocks (3.7.0)
|
27
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
+
rspec-support (~> 3.7.0)
|
29
|
+
rspec-support (3.7.1)
|
30
|
+
|
31
|
+
PLATFORMS
|
32
|
+
ruby
|
33
|
+
|
34
|
+
DEPENDENCIES
|
35
|
+
bundler (~> 1.16)
|
36
|
+
faraday (~> 0.15.2)
|
37
|
+
gpueater!
|
38
|
+
net-http-persistent (~> 3.0.0)
|
39
|
+
rake (~> 10.0)
|
40
|
+
rspec (~> 3.0)
|
41
|
+
|
42
|
+
BUNDLED WITH
|
43
|
+
1.16.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Pegara, Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
# GPUEater Console API
|
2
|
+
|
3
|
+
## Getting Started
|
4
|
+
GPUEater is a cloud computing service focusing on Machine Learning and Deep Learning. Now, AMD Radeon GPUs and NVIDIA Quadro GPUs are available.
|
5
|
+
|
6
|
+
This document is intended to describe how to set up this API and how to control your instances through this API.
|
7
|
+
|
8
|
+
Before getting started, register your account on GPUEater.
|
9
|
+
https://www.gpueater.com/
|
10
|
+
|
11
|
+
### Prerequisites
|
12
|
+
1. Ruby 2.x is required to run GPUEater Console API.
|
13
|
+
2. Create a JSON file in accordance with the following instruction.
|
14
|
+
|
15
|
+
At first, open your account page(https://www.gpueater.com/console/account) and copy your access_token. The next, create a JSON file on ~/.eater
|
16
|
+
|
17
|
+
```
|
18
|
+
{
|
19
|
+
"gpueater": {
|
20
|
+
"access_token":"[YourAccessToken]",
|
21
|
+
"secret_token":"[YourSecretToken]"
|
22
|
+
}
|
23
|
+
}
|
24
|
+
```
|
25
|
+
|
26
|
+
or
|
27
|
+
|
28
|
+
```
|
29
|
+
{
|
30
|
+
"gpueater": {
|
31
|
+
"email":"[YourEmail]",
|
32
|
+
"password":"[YourPassword]"
|
33
|
+
}
|
34
|
+
}
|
35
|
+
```
|
36
|
+
* At this time, permission control for each token is not available. Still in development.
|
37
|
+
|
38
|
+
## Installation
|
39
|
+
|
40
|
+
Add this line to your application's Gemfile:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
gem 'gpueater'
|
44
|
+
```
|
45
|
+
|
46
|
+
And then execute:
|
47
|
+
|
48
|
+
$ bundle
|
49
|
+
|
50
|
+
Or install it yourself as:
|
51
|
+
|
52
|
+
$ gem install gpueater
|
53
|
+
|
54
|
+
|
55
|
+
## Run GPUEater API
|
56
|
+
|
57
|
+
Before launching an instance, you need to decide product, ssh key, OS image. Get each info with the following APIs.
|
58
|
+
|
59
|
+
#### Get available on-demand product list
|
60
|
+
|
61
|
+
This API returns current available on-demand products.
|
62
|
+
```
|
63
|
+
require('gpueater')
|
64
|
+
|
65
|
+
g = GPUEater.new
|
66
|
+
puts g.ondemand_list()
|
67
|
+
```
|
68
|
+
#### Get registered ssh key list
|
69
|
+
|
70
|
+
This API returns your registered ssh keys.
|
71
|
+
```
|
72
|
+
require('gpueater')
|
73
|
+
|
74
|
+
g = GPUEater.new
|
75
|
+
puts g.ssh_keys()
|
76
|
+
```
|
77
|
+
|
78
|
+
#### Get OS image list
|
79
|
+
|
80
|
+
This API returns available OS images.
|
81
|
+
```
|
82
|
+
require('gpueater')
|
83
|
+
|
84
|
+
g = GPUEater.new
|
85
|
+
puts g.image_list()
|
86
|
+
```
|
87
|
+
|
88
|
+
#### Instance launch
|
89
|
+
|
90
|
+
Specify product, OS image, and ssh_key for instance launching.
|
91
|
+
|
92
|
+
```
|
93
|
+
require('gpueater')
|
94
|
+
|
95
|
+
g = GPUEater.new
|
96
|
+
res = g.ondemand_list()
|
97
|
+
|
98
|
+
image = res.find_image('Ubuntu16.04 x64')
|
99
|
+
ssh_key = res.find_ssh_key('[Your ssh key]')
|
100
|
+
product = res.find_product('a1.rx580')
|
101
|
+
|
102
|
+
param = {
|
103
|
+
'product_id' => product['id'],
|
104
|
+
'image' => image['alias'],
|
105
|
+
'ssh_key_id' => ssh_key['id'],
|
106
|
+
'tag' => 'HappyGPUProgramming'
|
107
|
+
}
|
108
|
+
|
109
|
+
res = g.launch_ondemand_instance(param)
|
110
|
+
puts res
|
111
|
+
```
|
112
|
+
In the event, the request has succeeded, then the API returns the following empty data.
|
113
|
+
{data:null, error:null}
|
114
|
+
|
115
|
+
In the event, errors occurred during the instance instantiation process, then the API returns details about the error.
|
116
|
+
|
117
|
+
#### Launched instance list
|
118
|
+
|
119
|
+
This API returns your launched instance info.
|
120
|
+
```
|
121
|
+
require('gpueater')
|
122
|
+
|
123
|
+
g = GPUEater.new
|
124
|
+
res = g.instance_list()
|
125
|
+
```
|
126
|
+
#### Terminate instance
|
127
|
+
|
128
|
+
Before terminating an instance, get instance info through instance list API. Your instance_id and machine_resource_id are needed to terminate.
|
129
|
+
|
130
|
+
```
|
131
|
+
require('gpueater')
|
132
|
+
|
133
|
+
g = GPUEater.new
|
134
|
+
res = g.instance_list()
|
135
|
+
res.select{|e| e['tag'] == 'HappyGPUProgramming' }.each{|e|
|
136
|
+
puts g.terminate_instance(e)
|
137
|
+
}
|
138
|
+
```
|
139
|
+
|
140
|
+
## License
|
141
|
+
|
142
|
+
This project is licensed under the MIT License - see the [LICENSE.txt](LICENSE.txt) file for details
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "gpueater"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/gpueater.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "gpueater/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "gpueater"
|
8
|
+
spec.version = GPUEater::VERSION
|
9
|
+
spec.authors = ["Pegara, Inc."]
|
10
|
+
spec.email = ["info@pegara.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{GPUEater Console API}
|
13
|
+
spec.description = %q{This module is API for GPUEater web console.}
|
14
|
+
spec.homepage = "https://www.gpueater.com/"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# # to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
# if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata["allowed_push_host"] = "https://www.gpueater.com'"
|
21
|
+
# else
|
22
|
+
# raise "RubyGems 2.x or newer is required to protect against " \
|
23
|
+
# "public gem pushes."
|
24
|
+
# end
|
25
|
+
|
26
|
+
# Specify which files should be added to the gem when it is released.
|
27
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
28
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
29
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
30
|
+
end
|
31
|
+
spec.bindir = "exe"
|
32
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
|
+
spec.require_paths = ["lib"]
|
34
|
+
|
35
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
36
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
37
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
38
|
+
spec.add_development_dependency "faraday", "~> 0.15.2"
|
39
|
+
spec.add_development_dependency "net-http-persistent", "~> 3.0.0"
|
40
|
+
end
|
data/lib/gpueater.rb
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
require "gpueater/version"
|
2
|
+
require 'faraday' # gem install net-http-persistent faraday
|
3
|
+
require 'tmpdir'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
|
7
|
+
module GPUEater
|
8
|
+
class APIv1
|
9
|
+
def initialize
|
10
|
+
@base = 'https://www.gpueater.com'
|
11
|
+
if ENV['GPUEATER_URL']
|
12
|
+
@base = ENV['GPUEATER_URL']
|
13
|
+
end
|
14
|
+
|
15
|
+
@homedir = File.expand_path('~')
|
16
|
+
@tmpdir = Dir.tmpdir
|
17
|
+
@cookie_path = File.join(@tmpdir,"gpueater_cookie.txt")
|
18
|
+
|
19
|
+
@g_config = {}
|
20
|
+
@g_header = {'User-Agent':'RubyAPI'}
|
21
|
+
@conn = Faraday::Connection.new(:url => @base) do |builder|
|
22
|
+
builder.use Faraday::Request::UrlEncoded
|
23
|
+
# builder.use Faraday::Response::Logger
|
24
|
+
builder.use Faraday::Adapter::NetHttpPersistent # gem install net-http-persistent
|
25
|
+
end
|
26
|
+
|
27
|
+
begin
|
28
|
+
@g_config = JSON.load(open(".eater").read)
|
29
|
+
rescue
|
30
|
+
@g_config = JSON.load(open(File.join(@homedir,".eater")).read)
|
31
|
+
end
|
32
|
+
|
33
|
+
begin
|
34
|
+
@g_header['cookie'] = open(@cookie_path).read
|
35
|
+
rescue => e
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
def _get(u,q={})
|
41
|
+
response = @conn.get do |req|
|
42
|
+
req.url u
|
43
|
+
@g_header.each{|k,v| req.headers[k] = v }
|
44
|
+
end
|
45
|
+
return response
|
46
|
+
end
|
47
|
+
|
48
|
+
def _post(u,form)
|
49
|
+
response = @conn.post do |req|
|
50
|
+
p u
|
51
|
+
p @g_header
|
52
|
+
p form
|
53
|
+
req.url u
|
54
|
+
@g_header.each{|k,v| req.headers[k] = v }
|
55
|
+
req.body = form
|
56
|
+
end
|
57
|
+
return response
|
58
|
+
end
|
59
|
+
|
60
|
+
def relogin
|
61
|
+
res = _post('/api_login',{'email':@g_config['gpueater']['email'],'password':@g_config['gpueater']['password']})
|
62
|
+
@g_header['cookie'] = res.headers['set-cookie']
|
63
|
+
f = open(@cookie_path,"w")
|
64
|
+
f.write(@g_header['cookie'])
|
65
|
+
f.close
|
66
|
+
end
|
67
|
+
|
68
|
+
class ProductsResnpose
|
69
|
+
attr_accessor :images
|
70
|
+
attr_accessor :ssh_keys
|
71
|
+
attr_accessor :products
|
72
|
+
def initialize(j)
|
73
|
+
@images = j['data']['images']
|
74
|
+
@ssh_keys = j['data']['ssh_keys']
|
75
|
+
@products = j['data']['products']
|
76
|
+
end
|
77
|
+
def find_image(n)
|
78
|
+
@images.values.select{|v| v['name'] == n }.pop
|
79
|
+
end
|
80
|
+
def find_ssh_key(n)
|
81
|
+
@ssh_keys.select{|v| v['name'] == n }.pop
|
82
|
+
end
|
83
|
+
def find_product(n)
|
84
|
+
@products.select{|v| v['name'] == n }.pop
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def instance_list
|
89
|
+
j = nil
|
90
|
+
begin
|
91
|
+
j = JSON.load(_get('/console/servers/instance_list').body)
|
92
|
+
rescue
|
93
|
+
relogin
|
94
|
+
return instance_list
|
95
|
+
end
|
96
|
+
return j['data']
|
97
|
+
end
|
98
|
+
|
99
|
+
def image_list
|
100
|
+
j = nil
|
101
|
+
begin
|
102
|
+
j = JSON.load(_get('/console/servers/images').body)
|
103
|
+
rescue
|
104
|
+
relogin
|
105
|
+
return image_list
|
106
|
+
end
|
107
|
+
return j['data']
|
108
|
+
end
|
109
|
+
|
110
|
+
def ssh_key_list
|
111
|
+
j = nil
|
112
|
+
begin
|
113
|
+
j = JSON.load(_get('/console/servers/ssh_key_list').body)
|
114
|
+
rescue
|
115
|
+
relogin
|
116
|
+
return ssh_key_list
|
117
|
+
end
|
118
|
+
return j['data']
|
119
|
+
end
|
120
|
+
|
121
|
+
def ondemand_list
|
122
|
+
j = nil
|
123
|
+
begin
|
124
|
+
j = JSON.load(_get('/console/servers/ondemand_launch_list').body)
|
125
|
+
rescue
|
126
|
+
relogin
|
127
|
+
return ondemand_list
|
128
|
+
end
|
129
|
+
return ProductsResnpose.new(j)
|
130
|
+
end
|
131
|
+
|
132
|
+
def launch_ondemand_instance(form)
|
133
|
+
j = nil
|
134
|
+
unless form['tag']
|
135
|
+
form['tag'] = ""
|
136
|
+
end
|
137
|
+
raise "required product_id" unless form['product_id']
|
138
|
+
raise "required image" unless form['image']
|
139
|
+
raise "required ssh_key_id" unless form['ssh_key_id']
|
140
|
+
|
141
|
+
begin
|
142
|
+
j = JSON.load(_post('/console/servers/launch_ondemand_instance',form).body)
|
143
|
+
rescue
|
144
|
+
relogin
|
145
|
+
return launch_ondemand_instance
|
146
|
+
end
|
147
|
+
return j
|
148
|
+
end
|
149
|
+
|
150
|
+
def terminate_instance(form)
|
151
|
+
j = nil
|
152
|
+
raise "required instance_id" unless form['instance_id']
|
153
|
+
raise "required machine_resource_id" unless form['machine_resource_id']
|
154
|
+
unless form['tag']
|
155
|
+
form['tag'] = ""
|
156
|
+
end
|
157
|
+
|
158
|
+
begin
|
159
|
+
arr = [{'instance_id'=>form['instance_id'],'machine_resource_id'=>form['machine_resource_id']}]
|
160
|
+
j = JSON.load(_post('/console/servers/force_terminate',{'instances'=>arr.to_json}).body)
|
161
|
+
rescue
|
162
|
+
relogin
|
163
|
+
return terminate(form)
|
164
|
+
end
|
165
|
+
return j
|
166
|
+
end
|
167
|
+
|
168
|
+
end
|
169
|
+
|
170
|
+
def self.new
|
171
|
+
return APIv1.new
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
metadata
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gpueater
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pegara, Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-07-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: faraday
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.15.2
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.15.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: net-http-persistent
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.0.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.0.0
|
83
|
+
description: This module is API for GPUEater web console.
|
84
|
+
email:
|
85
|
+
- info@pegara.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- CODE_OF_CONDUCT.md
|
91
|
+
- Gemfile
|
92
|
+
- Gemfile.lock
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- bin/console
|
97
|
+
- bin/setup
|
98
|
+
- gpueater.gemspec
|
99
|
+
- lib/gpueater.rb
|
100
|
+
- lib/gpueater/version.rb
|
101
|
+
homepage: https://www.gpueater.com/
|
102
|
+
licenses:
|
103
|
+
- MIT
|
104
|
+
metadata: {}
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.5.2
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: GPUEater Console API
|
125
|
+
test_files: []
|