resque-telework 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -5,6 +5,8 @@ Resque Telework
5
5
 
6
6
  Telework depends on Resque 1.20+ and Redis 2.2+
7
7
 
8
+ A native daemon in Haskell is also available at [github.com/gip/resque-telework-daemon-hs](https://github.com/gip/resque-telework-daemon-hs) to have acceptable resource (CPU/memory) utilization.
9
+
8
10
  Telework 0.3 has a new auto feature that is in beta and currently under testing - please report bugs to [gip.github@gmail.com](gip.github@gmail.com)
9
11
 
10
12
  Description
@@ -32,6 +34,11 @@ Version 0.3.0
32
34
  * Auto mode for workers
33
35
  * Updated window layout
34
36
 
37
+ Native Daemon
38
+ -------------
39
+
40
+ The reference daemon is implemented in Ruby. This is however very inefficient since the full Rails environment needs to be loaded, which can take up to 160MB of memory. Running in Ruby without Rails still takes a significant amount of memory. [github.com/gip/resque-telework-daemon-hs](https://github.com/gip/resque-telework-daemon-hs) is a lightweight daemon written in Haskell. It compiles to native code gives largely improved performance both in term of CPU load and memory usage (less than 5MB).
41
+
35
42
 
36
43
  Overview of the WebUI
37
44
  ---------------------
@@ -3,7 +3,7 @@ module Resque
3
3
  module Telework
4
4
  Name = NAME = 'resque-telework'
5
5
  Nickname = NICKNAME = 'telework'
6
- Version = VERSION = '0.3.1'
6
+ Version = VERSION = '0.3.2'
7
7
  RedisInterfaceVersion = REDIS_INTERFACE_VERSION = '2'
8
8
  end
9
9
  end
@@ -135,6 +135,13 @@ module Resque
135
135
  my_show 'stopit'
136
136
  end
137
137
 
138
+ app.post "/#{appn.downcase}_del_host/:host" do
139
+ host= params[:host]
140
+ redis.hosts_rem( host )
141
+ redis.aliases_rem( host )
142
+ redirect "/resque/#{appn.downcase}"
143
+ end
144
+
138
145
  app.post "/#{appn.downcase}_mod_host/:host" do
139
146
  host= params[:host]
140
147
  ahost= params[:alias]
@@ -204,12 +211,12 @@ module Resque
204
211
  @qmanual= params[:qmanual]
205
212
  @count= params[:c]
206
213
  #@rev= params[:r].split(' ')
207
- @env= params[:e]
214
+ @envv= params[:e]
208
215
  @q= @qmanual.blank? ? @queue : @qmanual
209
216
  id= redis.unique_id.to_s
210
217
  t= task_default
211
218
  redis.tasks_add( @host , id, t.merge( { 'task_id' => id, 'worker_count' => @count,
212
- 'rails_env' => @env, 'queue' => @q,
219
+ 'rails_env' => @envv, 'queue' => @q,
213
220
  'worker_id' => [], 'worker_status' => 'Stopped'} ) )
214
221
  redirect "/resque/#{appn.downcase}"
215
222
  end
@@ -9,3 +9,9 @@
9
9
  </table>
10
10
  <input type="submit" value= "Save" />
11
11
  </form>
12
+ <br/>
13
+ <h1>Delete Host <%= @host %></h1>
14
+ This will delete all the entries for the host - use with caution!
15
+ <form style="margin:0px;float:center;" id="delm" name="delm" method="post" action="/resque/telework_del_host/<%= @host %>" >
16
+ <br/><input type="submit" value="Delete" />
17
+ <form>
@@ -169,9 +169,11 @@ $(document).ready(function() {
169
169
  <a href=<%= "/resque/telework/host/#{host}" %> title="<%= "#{host}\n#{redis.comments(host)}" %>" >
170
170
  <% if ahost!=host %><%= ahost %><% else %>
171
171
  <%= host %><% end %></a>
172
- <% if 'Alive'==status && info['cpu_load_1mins'] %>
173
- <br/><%= "(%.2f%% cpu)" % (100*info['cpu_load_1mins']) %></center>
174
- <% end %>
172
+ <% if 'Alive'==status && info['cpu_load_1mins'] %><br/><%= "(%.2f%% cpu)" % (100*info['cpu_load_1mins']) %><% end %>
173
+ <% if 'Alive'==status && info['load_avg_1mins'] %><br/><%= "(%.2f load)" % (info['load_avg_1mins'].to_f) %><% end %>
174
+ <% if 'Alive'==status && info['mem_total'] && info['mem_free'] %>
175
+ <br/><%= "(%.2f%% mem)" % (100*(1-info['mem_free'].to_f/info['mem_total'].to_f)) %><% end %>
176
+ </center>
175
177
  </td>
176
178
  <% if 'Alive'==status %>
177
179
  <td> <center><%= "Alive (v#{info['version']})" %><br/><br/>
@@ -278,7 +280,7 @@ $(document).ready(function() {
278
280
  <% for info in redis.statuses(@status_messages) %>
279
281
  <% c= info['severity']=='Error' ? "bgcolor=\"#ff0000\"" : "" %>
280
282
  <tr>
281
- <td <%= c %>><%= info['host'] %></td>
283
+ <td <%= c %>><%= redis.aliases(info['host']) %></td>
282
284
  <td <%= c %>><%= info['severity'] %></td>
283
285
  <td <%= c %>><%= redis.fmt_date(info['date']) %></td>
284
286
  <td <%= c %>><%= info['message'] %></td>
@@ -31,6 +31,14 @@ namespace :telework do
31
31
  $stderr.reopen(lf)
32
32
  end
33
33
  Process.setsid # I'm grown up now
34
+
35
+ # New Redis connection after fork
36
+ ns = Resque.redis.namespace
37
+ redis_host = Resque.redis.client.host
38
+ redis_port = Resque.redis.client.port
39
+ Resque.redis = Redis.new(:host => redis_host, :port => redis_port)
40
+ Resque.redis.namespace = ns
41
+
34
42
  daemon.start # Start the daemon
35
43
  File.delete(lpid) # Delete the pid file
36
44
  end
metadata CHANGED
@@ -1,60 +1,52 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: resque-telework
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 3
8
- - 1
9
- version: 0.3.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.2
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Gilles Pirio
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2013-02-28 00:00:00 -08:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2013-07-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: resque
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 1
29
- - 20
30
- - 0
16
+ requirement: &70292753162640 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
31
21
  version: 1.20.0
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: sys-cpu
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- requirements:
24
+ version_requirements: *70292753162640
25
+ - !ruby/object:Gem::Dependency
26
+ name: sys-cpu
27
+ requirement: &70292753161680 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
39
30
  - - ~>
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
- - 7
44
- - 0
31
+ - !ruby/object:Gem::Version
45
32
  version: 0.7.0
46
33
  type: :runtime
47
- version_requirements: *id002
48
- description: " Telework is a Resque plugin aimed at controlling Resque workers from the web UI. It makes it easy to manage workers on a \n complex systems that may include several hosts, different queue(s) and an evolving source code that is deployed several times a day. \n Beyond starting and stopping workers on remote hosts, the plugin makes it easy to switch between code revisions, gives a partial view of \n each worker's log (stdout and stderr) and maintains a status of each workers.\n"
34
+ prerelease: false
35
+ version_requirements: *70292753161680
36
+ description: ! " Telework is a Resque plugin aimed at controlling Resque workers
37
+ from the web UI. It makes it easy to manage workers on a \n complex systems that
38
+ may include several hosts, different queue(s) and an evolving source code that is
39
+ deployed several times a day. \n Beyond starting and stopping workers on remote
40
+ hosts, the plugin makes it easy to switch between code revisions, gives a partial
41
+ view of \n each worker's log (stdout and stderr) and maintains a status of each
42
+ workers.\n"
49
43
  email: gip.github@gmail.com
50
44
  executables: []
51
-
52
45
  extensions: []
53
-
54
- extra_rdoc_files:
46
+ extra_rdoc_files:
55
47
  - README.md
56
48
  - MIT-LICENSE
57
- files:
49
+ files:
58
50
  - Gemfile
59
51
  - MIT-LICENSE
60
52
  - README.md
@@ -74,35 +66,30 @@ files:
74
66
  - lib/resque-telework/server/views/worker.erb
75
67
  - lib/tasks/telework.rake
76
68
  - resque-telework.gemspec
77
- has_rdoc: true
78
69
  homepage: https://github.com/gip/resque-telework
79
70
  licenses: []
80
-
81
71
  post_install_message:
82
72
  rdoc_options: []
83
-
84
- require_paths:
73
+ require_paths:
85
74
  - lib
86
- required_ruby_version: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- segments:
91
- - 0
92
- version: "0"
93
- required_rubygems_version: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- segments:
98
- - 0
99
- version: "0"
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
100
87
  requirements: []
101
-
102
88
  rubyforge_project:
103
- rubygems_version: 1.3.6
89
+ rubygems_version: 1.8.16
104
90
  signing_key:
105
91
  specification_version: 3
106
- summary: "resque-telework: A Resque plugin aimed at controlling Resque workers from the web UI"
92
+ summary: ! 'resque-telework: A Resque plugin aimed at controlling Resque workers from
93
+ the web UI'
107
94
  test_files: []
108
-
95
+ has_rdoc: