barbeque_client 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +14 -2
- data/Gemfile +1 -1
- data/README.md +2 -2
- data/{barbeque.gemspec → barbeque_client.gemspec} +0 -0
- data/lib/barbeque_client/runner.rb +39 -4
- data/lib/barbeque_client/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c21ee3226f87115866285b97b0fb1c5a73531a3
|
4
|
+
data.tar.gz: ed2455539ef02b004efbb67c83f8f189da3483af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbb35487c1688529afc76152c163dadd175e5112ce581f9875de509edf0356c81bf6c3b2f4544f22a4a95fc031763a49f3383707929dc67d875e18bcfa559be8
|
7
|
+
data.tar.gz: c0f93a5b37c4a3ab1ed2d3e58d4218db3afdc6c5841c04d07f728ecd62c67e67d2a86349c42dbd8c952bb4ef9c28304b9d4f164d9f3778de6b8ec3dc344e068d
|
data/.travis.yml
CHANGED
@@ -1,4 +1,16 @@
|
|
1
1
|
language: ruby
|
2
|
+
cache: bundler
|
3
|
+
branches:
|
4
|
+
only:
|
5
|
+
- master
|
2
6
|
rvm:
|
3
|
-
-
|
4
|
-
|
7
|
+
- ruby-head
|
8
|
+
- 2.4.0
|
9
|
+
- 2.3.1
|
10
|
+
- 2.2.5
|
11
|
+
- 2.1.10
|
12
|
+
script:
|
13
|
+
- bundle exec rake
|
14
|
+
matrix:
|
15
|
+
allow_failures:
|
16
|
+
- rvm: ruby-head
|
data/Gemfile
CHANGED
data/README.md
CHANGED
File without changes
|
@@ -7,28 +7,63 @@ module BarbequeClient
|
|
7
7
|
class Runner < Sinatra::Base
|
8
8
|
set :port, ENV['PORT'] || 3003
|
9
9
|
|
10
|
+
class << self
|
11
|
+
# global variable
|
12
|
+
def messages
|
13
|
+
@messages ||= {}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
10
17
|
post '/v1/job_executions' do
|
11
18
|
params = JSON.parse(request.body.read)
|
12
|
-
|
19
|
+
message_id = SecureRandom.uuid
|
20
|
+
pid = spawn(
|
13
21
|
'bundle', 'exec', 'rake', 'barbeque:execute',
|
22
|
+
"BARBEQUE_MESSAGE_ID=#{message_id}",
|
14
23
|
"BARBEQUE_JOB=#{params['job']}", "BARBEQUE_MESSAGE=#{params['message']}",
|
15
24
|
"BARBEQUE_RETRY_COUNT=0",
|
25
|
+
in: :close
|
16
26
|
)
|
27
|
+
Runner.messages[message_id] = Process.detach(pid)
|
17
28
|
|
18
29
|
content_type :json
|
19
|
-
{ status: 'pending', message_id:
|
30
|
+
{ status: 'pending', message_id: message_id }.to_json
|
20
31
|
end
|
21
32
|
|
22
33
|
post '/v2/job_executions' do
|
23
34
|
params = JSON.parse(request.body.read)
|
24
|
-
|
35
|
+
message_id = SecureRandom.uuid
|
36
|
+
pid = spawn(
|
25
37
|
'bundle', 'exec', 'rake', 'barbeque:execute',
|
38
|
+
"BARBEQUE_MESSAGE_ID=#{message_id}",
|
26
39
|
"BARBEQUE_JOB=#{params['job']}", "BARBEQUE_MESSAGE=#{params['message'].to_json}",
|
27
40
|
"BARBEQUE_RETRY_COUNT=0",
|
41
|
+
in: :close
|
28
42
|
)
|
43
|
+
Runner.messages[message_id] = Process.detach(pid)
|
29
44
|
|
30
45
|
content_type :json
|
31
|
-
{ status: 'pending', message_id:
|
46
|
+
{ status: 'pending', message_id: message_id }.to_json
|
47
|
+
end
|
48
|
+
|
49
|
+
get '/v1/job_executions/:message_id' do
|
50
|
+
message_id = params['message_id']
|
51
|
+
wait_thr = Runner.messages[message_id]
|
52
|
+
|
53
|
+
status = if wait_thr.nil?
|
54
|
+
'pending'
|
55
|
+
elsif wait_thr.alive?
|
56
|
+
'working'
|
57
|
+
else
|
58
|
+
if wait_thr.value.exitstatus == 0
|
59
|
+
'success'
|
60
|
+
else
|
61
|
+
'failed'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
content_type :json
|
66
|
+
{ status: status, message_id: message_id }.to_json
|
32
67
|
end
|
33
68
|
|
34
69
|
post '/v1/job_executions/:message_id/retries' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barbeque_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: garage_client
|
@@ -122,7 +122,7 @@ files:
|
|
122
122
|
- LICENSE.txt
|
123
123
|
- README.md
|
124
124
|
- Rakefile
|
125
|
-
-
|
125
|
+
- barbeque_client.gemspec
|
126
126
|
- bin/console
|
127
127
|
- bin/setup
|
128
128
|
- lib/active_job/queue_adapters/barbeque_adapter.rb
|
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
156
|
version: '0'
|
157
157
|
requirements: []
|
158
158
|
rubyforge_project:
|
159
|
-
rubygems_version: 2.
|
159
|
+
rubygems_version: 2.6.8
|
160
160
|
signing_key:
|
161
161
|
specification_version: 4
|
162
162
|
summary: Barbeque client for Ruby
|