boinc_drone 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +197 -12
- data/bin/boinc_drone +30 -0
- data/lib/boinc_drone.rb +45 -42
- data/lib/boinc_drone/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a0b3edaf818d6f8d699f8888459b25c0de5391d
|
4
|
+
data.tar.gz: faeb1bfcd721bbed93b934810ebaac9ab84cf27a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0293eb2091a7ef52f2738bc72412cea48e4760ca19d8f04beec6ed21ad5a1d620814efd6d82c67da0b9291c0a2db9d21ebc0d75d550b31371b62ead5a2afe181
|
7
|
+
data.tar.gz: 5a7dece293ac08ffc673d02f9b8d4ba42fefff19a3fb274d77bd2a3f0056b6b1dd6930b334f66b7e627d4aa23e9685caca9929186d9669453b069ef3dd34731d
|
data/README.md
CHANGED
@@ -1,29 +1,214 @@
|
|
1
|
-
#
|
1
|
+
# boinc_drone
|
2
|
+
This script allows the easily deployment of a [Boinc](https://boinc.berkeley.edu) process in a farm where each drone reports back to a main application in JSON.
|
2
3
|
|
3
|
-
|
4
|
+
## Requirements
|
5
|
+
This script leverages the `boinccmd` command and will require that you have the [commandline tool](http://boinc.berkeley.edu/wiki/Boinccmd_tool) installed, configured, and running.
|
4
6
|
|
5
7
|
## Installation
|
8
|
+
Run this from your terminal:
|
6
9
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
+
```bash
|
11
|
+
$ gem install "boinc_drone"
|
12
|
+
```
|
10
13
|
|
11
14
|
And then execute:
|
12
15
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
$ gem install boinc_drone
|
16
|
+
```bash
|
17
|
+
$ boinc_drone -a API_KEY -u WEBHOOK_URL -w WORKER_ID # worker_id is optional, it's included for the app this was made for
|
18
|
+
```
|
18
19
|
|
19
20
|
## Usage
|
21
|
+
Every 60 seconds this script will read the commandline output of the `boinccmd --get_state` and convert it to some nice JSON and `POST` it to the supplied `WEBHOOK_URL` with `API_KEY` set as an `X-API-KEY` header. If the `POST` fails for any reason it will fail silently and just keep looping.
|
20
22
|
|
21
|
-
|
23
|
+
The request body's JSON:
|
24
|
+
```json
|
25
|
+
{
|
26
|
+
"meta":{
|
27
|
+
"worker_id": WORKER_ID
|
28
|
+
},
|
29
|
+
"projects":[
|
30
|
+
{
|
31
|
+
"name":"LHC@home 1.0",
|
32
|
+
"master_url":"http://lhcathome.cern.ch/lhcathome/",
|
33
|
+
"user_name":"Matthew",
|
34
|
+
"team_name":"",
|
35
|
+
"resource_share":"100.000000",
|
36
|
+
"user_total_credit":"1767.307159",
|
37
|
+
"user_expavg_credit":"148.063753",
|
38
|
+
"host_total_credit":"1767.307159",
|
39
|
+
"host_expavg_credit":"148.063766",
|
40
|
+
"nrpc_failures":"0",
|
41
|
+
"master_fetch_failures":"0",
|
42
|
+
"master_fetch_pending":"no",
|
43
|
+
"scheduler_rpc_pending":"no",
|
44
|
+
"trickle_upload_pending":"no",
|
45
|
+
"attached_via_account_manager":"yes",
|
46
|
+
"ended":"no",
|
47
|
+
"suspended_via_gui":"no",
|
48
|
+
"don't_request_more_work":"no",
|
49
|
+
"disk_usage":"0.000000",
|
50
|
+
"last_rpc":"1405565949.830400",
|
51
|
+
"project_files_downloaded":"0.000000"
|
52
|
+
}
|
53
|
+
],
|
54
|
+
"applications":[
|
55
|
+
{
|
56
|
+
"name":"sixtrack",
|
57
|
+
"project":"LHC@home 1.0"
|
58
|
+
}
|
59
|
+
],
|
60
|
+
"application_versions":[
|
61
|
+
{
|
62
|
+
"application":"sixtrack",
|
63
|
+
"version":"451.07",
|
64
|
+
"project":"LHC@home 1.0"
|
65
|
+
},
|
66
|
+
{
|
67
|
+
"application":"sixtrack",
|
68
|
+
"version":"451.07",
|
69
|
+
"project":"LHC@home 1.0"
|
70
|
+
}
|
71
|
+
],
|
72
|
+
"workunits":[
|
73
|
+
{
|
74
|
+
"name":"sd_HL_7.5_490_1.6_4D_err__1__s__62.31_60.32__0_2__6__35_1_sixvf_boinc7",
|
75
|
+
"fp_estimate":"1.800000e+14",
|
76
|
+
"fp_bound":"1.800000e+17",
|
77
|
+
"memory_bound":"95.37 MB",
|
78
|
+
"disk_bound":"190.73 MB"
|
79
|
+
},
|
80
|
+
{
|
81
|
+
"name":"sd_HL_7.5_490_1.6_4D_err__2__s__62.31_60.32__0_2__6__40_1_sixvf_boinc110",
|
82
|
+
"fp_estimate":"1.800000e+14",
|
83
|
+
"fp_bound":"1.800000e+17",
|
84
|
+
"memory_bound":"95.37 MB",
|
85
|
+
"disk_bound":"190.73 MB"
|
86
|
+
},
|
87
|
+
{
|
88
|
+
"name":"sd_HL_7.5_690_1.6_4D_err__1__s__62.31_60.32__10_12__6__50_1_sixvf_boinc95",
|
89
|
+
"fp_estimate":"1.800000e+14",
|
90
|
+
"fp_bound":"1.800000e+17",
|
91
|
+
"memory_bound":"95.37 MB",
|
92
|
+
"disk_bound":"190.73 MB"
|
93
|
+
},
|
94
|
+
{
|
95
|
+
"name":"sd_HL_7.5_340_1.8_4D_err__5__s__62.31_60.32__8_10__6__15_1_sixvf_boinc479",
|
96
|
+
"fp_estimate":"1.800000e+14",
|
97
|
+
"fp_bound":"1.800000e+17",
|
98
|
+
"memory_bound":"95.37 MB",
|
99
|
+
"disk_bound":"190.73 MB"
|
100
|
+
}
|
101
|
+
],
|
102
|
+
"tasks":[
|
103
|
+
{
|
104
|
+
"name":"sd_HL_7.5_490_1.6_4D_err__1__s__62.31_60.32__0_2__6__35_1_sixvf_boinc7_1",
|
105
|
+
"wu_name":"sd_HL_7.5_490_1.6_4D_err__1__s__62.31_60.32__0_2__6__35_1_sixvf_boinc7",
|
106
|
+
"project_url":"http://lhcathome.cern.ch/lhcathome/",
|
107
|
+
"report_deadline":"Wed Jul 23 03:21:09 2014",
|
108
|
+
"ready_to_report":"no",
|
109
|
+
"got_server_ack":"no",
|
110
|
+
"final_cpu_time":"0.000000",
|
111
|
+
"state":"downloaded",
|
112
|
+
"scheduler_state":"scheduled",
|
113
|
+
"exit_status":"0",
|
114
|
+
"signal":"0",
|
115
|
+
"suspended_via_gui":"no",
|
116
|
+
"active_task_state":"EXECUTING",
|
117
|
+
"app_version_num":"45107",
|
118
|
+
"checkpoint_cpu_time":"32849.200000",
|
119
|
+
"current_cpu_time":"32864.980000",
|
120
|
+
"fraction_done":"0.888423",
|
121
|
+
"swap_size":"82915328.000000",
|
122
|
+
"working_set_size":"58507264.000000",
|
123
|
+
"estimated_cpu_time_remaining":"3262.893271"
|
124
|
+
},
|
125
|
+
{
|
126
|
+
"name":"sd_HL_7.5_490_1.6_4D_err__2__s__62.31_60.32__0_2__6__40_1_sixvf_boinc110_0",
|
127
|
+
"wu_name":"sd_HL_7.5_490_1.6_4D_err__2__s__62.31_60.32__0_2__6__40_1_sixvf_boinc110",
|
128
|
+
"project_url":"http://lhcathome.cern.ch/lhcathome/",
|
129
|
+
"report_deadline":"Wed Jul 23 03:21:09 2014",
|
130
|
+
"ready_to_report":"no",
|
131
|
+
"got_server_ack":"no",
|
132
|
+
"final_cpu_time":"0.000000",
|
133
|
+
"state":"downloaded",
|
134
|
+
"scheduler_state":"uninitialized",
|
135
|
+
"exit_status":"0",
|
136
|
+
"signal":"0",
|
137
|
+
"suspended_via_gui":"no",
|
138
|
+
"active_task_state":"UNINITIALIZED",
|
139
|
+
"app_version_num":"0",
|
140
|
+
"checkpoint_cpu_time":"0.000000",
|
141
|
+
"current_cpu_time":"0.000000",
|
142
|
+
"fraction_done":"0.000000",
|
143
|
+
"swap_size":"0.000000",
|
144
|
+
"working_set_size":"0.000000",
|
145
|
+
"estimated_cpu_time_remaining":"11111.865751"
|
146
|
+
},
|
147
|
+
{
|
148
|
+
"name":"sd_HL_7.5_690_1.6_4D_err__1__s__62.31_60.32__10_12__6__50_1_sixvf_boinc95_1",
|
149
|
+
"wu_name":"sd_HL_7.5_690_1.6_4D_err__1__s__62.31_60.32__10_12__6__50_1_sixvf_boinc95",
|
150
|
+
"project_url":"http://lhcathome.cern.ch/lhcathome/",
|
151
|
+
"report_deadline":"Wed Jul 23 04:30:48 2014",
|
152
|
+
"ready_to_report":"no",
|
153
|
+
"got_server_ack":"no",
|
154
|
+
"final_cpu_time":"0.000000",
|
155
|
+
"state":"downloaded",
|
156
|
+
"scheduler_state":"uninitialized",
|
157
|
+
"exit_status":"0",
|
158
|
+
"signal":"0",
|
159
|
+
"suspended_via_gui":"no",
|
160
|
+
"active_task_state":"UNINITIALIZED",
|
161
|
+
"app_version_num":"0",
|
162
|
+
"checkpoint_cpu_time":"0.000000",
|
163
|
+
"current_cpu_time":"0.000000",
|
164
|
+
"fraction_done":"0.000000",
|
165
|
+
"swap_size":"0.000000",
|
166
|
+
"working_set_size":"0.000000",
|
167
|
+
"estimated_cpu_time_remaining":"11111.865751"
|
168
|
+
},
|
169
|
+
{
|
170
|
+
"name":"sd_HL_7.5_340_1.8_4D_err__5__s__62.31_60.32__8_10__6__15_1_sixvf_boinc479_0",
|
171
|
+
"wu_name":"sd_HL_7.5_340_1.8_4D_err__5__s__62.31_60.32__8_10__6__15_1_sixvf_boinc479",
|
172
|
+
"project_url":"http://lhcathome.cern.ch/lhcathome/",
|
173
|
+
"report_deadline":"Wed Jul 23 06:30:58 2014",
|
174
|
+
"ready_to_report":"no",
|
175
|
+
"got_server_ack":"no",
|
176
|
+
"final_cpu_time":"0.000000",
|
177
|
+
"state":"downloaded",
|
178
|
+
"scheduler_state":"uninitialized",
|
179
|
+
"exit_status":"0",
|
180
|
+
"signal":"0",
|
181
|
+
"suspended_via_gui":"no",
|
182
|
+
"active_task_state":"UNINITIALIZED",
|
183
|
+
"app_version_num":"0",
|
184
|
+
"checkpoint_cpu_time":"0.000000",
|
185
|
+
"current_cpu_time":"0.000000",
|
186
|
+
"fraction_done":"0.000000",
|
187
|
+
"swap_size":"0.000000",
|
188
|
+
"working_set_size":"0.000000",
|
189
|
+
"estimated_cpu_time_remaining":"11111.865751"
|
190
|
+
}
|
191
|
+
],
|
192
|
+
"time_stats":{
|
193
|
+
"now":"1405569063.884657",
|
194
|
+
"on_frac":"1.000000",
|
195
|
+
"connected_frac":"-1.000000",
|
196
|
+
"cpu_and_network_available_frac":"0.999854",
|
197
|
+
"active_frac":"0.999854",
|
198
|
+
"gpu_active_frac":"0.999854",
|
199
|
+
"client_start_time":"1405183215.367770",
|
200
|
+
"previous_uptime":"385848.516887"
|
201
|
+
}
|
202
|
+
}
|
203
|
+
```
|
22
204
|
|
23
205
|
## Contributing
|
24
206
|
|
25
|
-
1. Fork it ( https://github.com/
|
207
|
+
1. Fork it ( https://github.com/msull92/boinc_drone/fork )
|
26
208
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
209
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
210
|
4. Push to the branch (`git push origin my-new-feature`)
|
29
211
|
5. Create a new Pull Request
|
212
|
+
|
213
|
+
## License
|
214
|
+
Do whatever you want with it, just don't hurt anyone or expect me to be responsible for your use of it.
|
data/bin/boinc_drone
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
|
4
|
+
$LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
|
5
|
+
|
6
|
+
require "boinc_drone"
|
7
|
+
require "optparse"
|
8
|
+
|
9
|
+
params = {}
|
10
|
+
opt = OptionParser.new do |opt|
|
11
|
+
opt.on('-k', '--key KEY', 'API key') do |key|
|
12
|
+
params[:api_key] = key
|
13
|
+
end
|
14
|
+
|
15
|
+
opt.on('-u', '--url URL', 'Webhook URL') do |url|
|
16
|
+
things[:webhook_url] = url
|
17
|
+
end
|
18
|
+
|
19
|
+
opt.on('-w', '--worker ID', 'Woker ID') do |id|
|
20
|
+
things[:worker_id] = id
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
opt.parse
|
25
|
+
|
26
|
+
loop do
|
27
|
+
@report = BoincDrone::Report.new(params)
|
28
|
+
@report.post
|
29
|
+
sleep(60)
|
30
|
+
end
|
data/lib/boinc_drone.rb
CHANGED
@@ -3,54 +3,57 @@ require "httparty"
|
|
3
3
|
require "json"
|
4
4
|
|
5
5
|
module BoincDrone
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
class Report
|
7
|
+
attr_accessor :api_key, :report, :webhook_url, :worker_id
|
8
|
+
|
9
|
+
def initialize(api_key: "ABC123", webhook_url: "http://localhost:3000", worker_id: "123456")
|
10
|
+
@api_key = api_key
|
11
|
+
@webhook_url = webhook_url
|
12
|
+
@worker_id = worker_id
|
13
|
+
|
14
|
+
@report = {
|
15
|
+
meta: {
|
16
|
+
worker_id: @worker_id
|
17
|
+
}
|
18
|
+
}
|
11
19
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
20
|
+
input = `boinccmd --get_state`
|
21
|
+
input.each_line do |line|
|
22
|
+
if line.match(/======== (.+) ========/i)
|
23
|
+
match = line.match(/======== (.+) ========/i)
|
24
|
+
@scope = match.captures.first.gsub(" ", "_").downcase.to_sym
|
25
|
+
instance_variable_set("@#{@scope.to_s}", [])
|
18
26
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
27
|
+
if @scope == :time_stats
|
28
|
+
@time_stats = {}
|
29
|
+
@current = @time_stats
|
30
|
+
end
|
31
|
+
end
|
24
32
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
+
if line.match(/\d+\) -----------$/i)
|
34
|
+
instance_variable_get("@#{@scope.to_s}") << {}
|
35
|
+
@current = instance_variable_get("@#{@scope.to_s}").send(:last)
|
36
|
+
elsif line.match(/(\S+): (.*)/i)
|
37
|
+
match = line.match(/\s+(.+): (.*)/i)
|
38
|
+
@current[match.captures.first.gsub(" ", "_").downcase.to_sym] = match.captures[1]
|
39
|
+
else
|
40
|
+
@report[@scope.to_sym] = instance_variable_get("@#{@scope.to_s}")
|
41
|
+
end
|
42
|
+
end
|
33
43
|
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def post_report
|
37
|
-
begin
|
38
|
-
result = HTTParty.post(ENV["WEBHOOK_URL"],
|
39
|
-
body: {
|
40
|
-
report: @report
|
41
|
-
},
|
42
|
-
headers: {
|
43
|
-
"X-API-KEY" => ENV["API_KEY"]
|
44
|
-
}
|
45
|
-
).body
|
46
44
|
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
def post
|
46
|
+
begin
|
47
|
+
HTTParty.post(@webhook_url,
|
48
|
+
body: {
|
49
|
+
report: @report
|
50
|
+
},
|
51
|
+
headers: {
|
52
|
+
"X-API-KEY" => @api_key
|
53
|
+
}
|
54
|
+
)
|
55
|
+
rescue => e
|
50
56
|
end
|
51
|
-
rescue => e
|
52
|
-
sleep(60)
|
53
|
-
post_report
|
54
57
|
end
|
55
58
|
end
|
56
59
|
end
|
data/lib/boinc_drone/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boinc_drone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Sullivan
|
@@ -56,7 +56,8 @@ description: This script allows the easily deployment of a boinc process farm wh
|
|
56
56
|
each drone reports back to a main application.
|
57
57
|
email:
|
58
58
|
- msull92@gmail.com
|
59
|
-
executables:
|
59
|
+
executables:
|
60
|
+
- boinc_drone
|
60
61
|
extensions: []
|
61
62
|
extra_rdoc_files: []
|
62
63
|
files:
|
@@ -65,6 +66,7 @@ files:
|
|
65
66
|
- LICENSE.txt
|
66
67
|
- README.md
|
67
68
|
- Rakefile
|
69
|
+
- bin/boinc_drone
|
68
70
|
- boinc_drone.gemspec
|
69
71
|
- lib/boinc_drone.rb
|
70
72
|
- lib/boinc_drone/version.rb
|