grid_runner 0.0.5 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Procfile +2 -0
- data/bin/grid_runner +17 -3
- data/grid_runner-0.0.5.gem +0 -0
- data/grid_runner-0.0.6.gem +0 -0
- data/lib/grid_runner/applications.rb +8 -4
- data/lib/grid_runner/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: 3d7a8c5a7bf8bba8325ab47198f7eef5fe9ea0e2
|
4
|
+
data.tar.gz: a890cd6f7cc8f58f93bb0afcf5a96f1cd5eb7437
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d7cd64be7233def5625a4f0f0eb7990819a4be542baf3cf29ca4b75da64979a44ecf15f715265f8ff6bcb91465b97aa555319b899e4601090bbea8b78c9197c
|
7
|
+
data.tar.gz: 45a5739270bf6d2e08c7a10f96030fdfeef189434b41f50de29b3c0b9bd0a95a1d0805925ef6238a13f2794498cac2b746a39dc12f78f6c081b58d3d64513808
|
data/Gemfile.lock
CHANGED
data/Procfile
CHANGED
@@ -6,4 +6,6 @@ ftp-watcher: sbt -Dftp.active=true "project ftp-watcher" "~ run 9004"
|
|
6
6
|
kahuna: sbt "project kahuna" "~ run 9005"
|
7
7
|
cropper: sbt "project cropper" "~ run 9006"
|
8
8
|
metadata-editor: sbt "project metadata-editor" "~ run 9007"
|
9
|
+
imgops: cd imgops; ./dev-start.sh
|
10
|
+
usage: sbt "project usage" "~ run 9009"
|
9
11
|
collections: sbt "project collections" "~ run 9010"
|
data/bin/grid_runner
CHANGED
@@ -13,7 +13,7 @@ arguments :strict
|
|
13
13
|
|
14
14
|
def apps_from_args(args)
|
15
15
|
return App.all if args.first == "all"
|
16
|
-
return App.find(args)
|
16
|
+
return App.find(args)
|
17
17
|
end
|
18
18
|
|
19
19
|
desc 'runs a given app listed in the Procfile (or all)'
|
@@ -54,14 +54,28 @@ end
|
|
54
54
|
|
55
55
|
desc 'prints the status of apps listed in Procfile'
|
56
56
|
arg_name "app names separated by a SPACE or 'all'"
|
57
|
-
command :list do |c|
|
57
|
+
command [:list, :status] do |c|
|
58
58
|
c.action do |global_options,options,args|
|
59
|
-
App.all
|
59
|
+
apps = apps_from_args(args) || App.all
|
60
|
+
apps.each_with_index do |app, ix|
|
60
61
|
app.display(ix)
|
61
62
|
end
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
66
|
+
|
67
|
+
desc 'watches logs for given apps and prints changes'
|
68
|
+
arg_name "app names separated by a SPACE or 'all'"
|
69
|
+
command :log do |c|
|
70
|
+
c.action do |global_options,options,args|
|
71
|
+
apps = apps_from_args(args) || App.all
|
72
|
+
puts
|
73
|
+
puts Rainbow("Logging:").blue.underline #{apps.map(&:name).join(", ")}"
|
74
|
+
puts Rainbow("#{apps.map(&:name).join(', ')}").green
|
75
|
+
app_logs = apps.flat_map(&:log).flat_map(&:path).join(" ")
|
76
|
+
IO.popen("tail -f #{app_logs}") { |io| while (line = io.gets) do puts line end } end
|
77
|
+
end
|
78
|
+
|
65
79
|
desc 'kills selected app'
|
66
80
|
arg_name 'provide an app name'
|
67
81
|
command :kill do |c|
|
Binary file
|
Binary file
|
@@ -19,6 +19,7 @@ class App
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.find(args)
|
22
|
+
return unless args.first
|
22
23
|
App.all.select { |app| args.include?( app.name ) }
|
23
24
|
end
|
24
25
|
|
@@ -27,12 +28,13 @@ class App
|
|
27
28
|
cmd = line.split(":")[1]
|
28
29
|
ps_out = ps_out(name)
|
29
30
|
status = ps_out[:status]
|
30
|
-
pid = ps_out[:pid]
|
31
|
+
pid = ps_out[:pid].strip if ps_out[:pid]
|
31
32
|
|
32
33
|
App.new(name, cmd, status, pid)
|
33
34
|
end
|
34
35
|
|
35
36
|
def display(color_index = rand(0..COLORS.length))
|
37
|
+
puts
|
36
38
|
puts Rainbow("#{name} ").send(COLORS[color_index % COLORS.length]).underline
|
37
39
|
puts "status: #{status}"
|
38
40
|
puts "pid: #{pid}" if status == :running
|
@@ -42,6 +44,8 @@ class App
|
|
42
44
|
|
43
45
|
def kill!
|
44
46
|
if status == :running
|
47
|
+
# imgops wasnt working with HUP but did with 3 ('sigquit')
|
48
|
+
Process.kill(3, pid.to_i)
|
45
49
|
Process.kill("HUP", pid.to_i)
|
46
50
|
puts Rainbow("killing #{name}").red
|
47
51
|
end
|
@@ -69,9 +73,9 @@ class App
|
|
69
73
|
|
70
74
|
private
|
71
75
|
|
72
|
-
def self.app_process_from_grep(stdout)
|
76
|
+
def self.app_process_from_grep(stdout, name = nil)
|
73
77
|
stdout.split(/\n/).find do |l|
|
74
|
-
|
78
|
+
l.match(name) &&
|
75
79
|
!l.match("grep") &&
|
76
80
|
!l.match("grid_runner")
|
77
81
|
end
|
@@ -81,7 +85,7 @@ class App
|
|
81
85
|
stdout, stderr, cmd_status = Open3.capture3("ps aux | grep #{name}")
|
82
86
|
if cmd_status.success?
|
83
87
|
# find processes that are either sbt or ES, and filter out the grep command itself
|
84
|
-
if p = app_process_from_grep(stdout)
|
88
|
+
if p = app_process_from_grep(stdout, name)
|
85
89
|
proc_status = :running
|
86
90
|
pid = p.match(/\d{1,8}\s/)[0]
|
87
91
|
else
|
data/lib/grid_runner/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grid_runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NickyPStraightStylinOnEm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -81,6 +81,8 @@ files:
|
|
81
81
|
- bin/grid_runner
|
82
82
|
- grid_runner-0.0.1.gem
|
83
83
|
- grid_runner-0.0.3.gem
|
84
|
+
- grid_runner-0.0.5.gem
|
85
|
+
- grid_runner-0.0.6.gem
|
84
86
|
- grid_runner.gemspec
|
85
87
|
- grid_runner.rdoc
|
86
88
|
- lib/grid_runner.rb
|