Permalink
Browse files

thread state

  • Loading branch information...
1 parent 3269e68 commit 3c5e075ed9e857f271dc42bbfe81c96fcd82aaf6 @jondot committed Sep 11, 2012
Showing with 47 additions and 12 deletions.
  1. +22 −10 README.md
  2. +2 −1 lib/frenzy_bunnies/health/providers/jvm.rb
  3. +23 −1 lib/frenzy_bunnies/web/public/index.html
View
@@ -69,10 +69,10 @@ should be visible by the moment you write this code:
```ruby
f = FrenzyBunnies::Context.new
-f.run FeedWorker,FeedDownloader
+f.run FeedWorker, FeedDownloader
```
-Which will run your workers immediately.
+In the listing above, `f.run` accepts your worker _classes_, and will run your workers immediately.
## Web Dashboard
@@ -94,7 +94,7 @@ context definitions
### Worker Configuration
-say `from_queue 'queue_name'` and pass any of these options:
+In your worker class, say `from_queue 'queue_name'` and pass any of these options:
```ruby
:prefetch # default 10. number of messages to prefetch each time
@@ -103,6 +103,16 @@ say `from_queue 'queue_name'` and pass any of these options:
:threads # default none. number of threads in the threadpool. leave empty to let the threadpool manage it.
```
+Example:
+
+
+```ruby
+class FeedWorker
+ include FrenzyBunnies::Worker
+ from_queue 'new.feeds', :prefetch => 20, :threads => 13, :durable => true
+
+...
+```
### General Configuration
@@ -132,14 +142,16 @@ semantics, the following is the AMQP wireup used within this library:
* Durable per configuration
* The exchange is created and named by default `frenzy_bunnies`
-* Each worker is bound to an AMQP queue named `my_queue`_`environment` with the environment postfix appended automatically.
+* Each worker is bound to an AMQP queue named `my_queue_environment` with the environment postfix appended automatically.
* The routing key on the exchange is of the same name and bound to the queue.
-## Contributing
+# Contributing
+
+Fork, implement, add tests, pull request, get my everlasting thanks and a respectable place here :).
+
+
+# Copyright
+
+Copyright (c) 2012 [Dotan Nahum](http://gplus.to/dotan) [@jondot](http://twitter.com/jondot). See MIT-LICENSE for further details.
-1. Fork it
-2. Create your feature branch (`git checkout -b my-new-feature`)
-3. Commit your changes (`git commit -am 'Added some feature'`)
-4. Push to the branch (`git push origin my-new-feature`)
-5. Create new Pull Request
@@ -28,7 +28,8 @@ def report
if info && info.thread_name =~ @opts[:threadfilter]
{
:name => info.thread_name,
- :stack_trace => info.stack_trace.to_a.inject([]){|a,s| a<<s.to_s }
+ :stack_trace => info.stack_trace.to_a.inject([]){|a,s| a<<s.to_s },
+ :state => info.thread_state.to_s
}
else
nil
@@ -75,6 +75,25 @@
white-space: nowrap;
overflow: hidden;
}
+ .thread-name .state{
+ font-size:0.5em;
+ }
+ .state.NEW{
+ background-color: #ddd
+ }
+ .state.RUNNABLE{
+ background-color:#468847;
+ }
+ .state.BLOCKED{
+ background-color:#000;
+ }
+ .state.WAITING{
+ }
+ .state.TIMED_WAITING{
+ }
+ .state.TERMINATED{
+ background-color: red;
+ }
</style>
<script id="tmpl-job" type="text/template">
<div class="job-detail">
@@ -126,7 +145,10 @@ <h3 class="prop-value"><%= stats.passed %></h3>
<article id="threads">
<% _.each(threads, function(thread) { %>
<div class="thread">
- <div class="thread-name span4" title="<%= thread.name %>"><%= thread.name %></div>
+ <div class="thread-name span4" title="<%= thread.name %>">
+ <%= thread.name %><br/>
+ <span class="label state <%=thread.state%>"><%= thread.state %></span>
+ </div>
<div class="thread-stack span8">
<% _.each(thread.stack_trace, function(fragment, i) { %>
<% fragment_el = ellipsis(fragment, 80); %>

0 comments on commit 3c5e075

Please sign in to comment.