Skip to content

Commit

Permalink
Small improvement to 'ibc'.
Browse files Browse the repository at this point in the history
  • Loading branch information
prioux committed Jun 3, 2024
1 parent a8cc5bc commit 8faeac8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions BrainPortal/app/models/cbrain_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class CbrainTask < ApplicationRecord
value = CbrainTask::PROCESSING_STATUS # code-running states in standard path
when :failed
value = CbrainTask::FAILED_STATUS
when :ruby
value = CbrainTask::RUBY_STATUS
else
value = s
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,18 @@ def process_user_letter(letter) #:nodoc:
uptime &&= ConsoleCtx.send(:pretty_elapsed, uptime, :num_components => 2)
uptime &&= "up for #{uptime}"
uptime ||= "DOWN"
acttasks = bou.cbrain_tasks.active.count
acttasks = nil if acttasks == 0
acttasks &&= " \e[36m(#{acttasks} active tasks)\e[0m" # CYAN
rubtasks = bou.cbrain_tasks.status(:ruby).count
rubtasks = nil if rubtasks == 0
rubtasks &&= " \e[35m(#{rubtasks} in Ruby stages)\e[0m" # MAGENTA
color_on = color_off = nil
color_on = "\e[31m" if uptime == 'DOWN' # RED for down bourreaux
color_on ||= "\e[33m" if numworkers != expworkers # YELLOW for missing workers
color_on ||= "\e[32m" # GREEN when everything ok
color_off = "\e[0m" if color_on
printf "#{color_on}%#{max_size}s rev %-9.9s %s, %d/%d workers#{color_off}\n", bou.name, gitrev, uptime, numworkers, expworkers
printf "#{color_on}%#{max_size}s rev %-9.9s %s, %d/%d workers#{color_off}#{acttasks}#{rubtasks}\n", bou.name, gitrev, uptime, numworkers, expworkers
end
end
return true
Expand Down

0 comments on commit 8faeac8

Please sign in to comment.