Skip to content

Commit

Permalink
Update katello-jobs to include dynflow executor
Browse files Browse the repository at this point in the history
  • Loading branch information
iNecas committed Jan 23, 2014
1 parent 5699dfa commit 2779976
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 11 deletions.
37 changes: 28 additions & 9 deletions deploy/common/katello-jobs.init
Original file line number Diff line number Diff line change
Expand Up @@ -76,34 +76,43 @@ status_of_one() {
}

kstatus() {
local SECONDVAL
local RC
RETVAL=0
SECONDVAL=256
if [ 0$KATELLO_JOB_WORKERS -eq 1 ]; then
echo -n "delayed_job is "
status_of_one $KATELLO_PID_DIR/delayed_job.pid
RETVAL=$?
SECONDVAL=$?
RC=$?
RETVAL=$( print_higher $RC $RETVAL )
SECONDVAL=$( print_lower $RC $SECONDVAL )
echo -n "delayed_job_monitor is "
status_of_one $KATELLO_PID_DIR/delayed_job_monitor.pid
RC=$?
RETVAL=$( print_higher $RC $RETVAL )
SECONDVAL=$( print_lower $RC $RETVAL )
SECONDVAL=$( print_lower $RC $SECONDVAL )
else
RETVAL=0
SECONDVAL=0
for i in $( seq 0 $(($KATELLO_JOB_WORKERS - 1)) ); do
echo -n "delayed_job $i is "
status_of_one $KATELLO_PID_DIR/delayed_job.$i.pid
RC=$?
RETVAL=$( print_higher $RC $RETVAL )
SECONDVAL=$( print_lower $RC $RETVAL )
SECONDVAL=$( print_lower $RC $SECONDVAL )
echo -n "delayed_job_monitor $i is "
status_of_one $KATELLO_PID_DIR/delayed_job.${i}_monitor.pid
RC=$?
RETVAL=$( print_higher $RC $RETVAL )
SECONDVAL=$( print_lower $RC $RETVAL )
SECONDVAL=$( print_lower $RC $SECONDVAL )
done
fi
echo -n "dynflow_executor is "
status_of_one $KATELLO_PID_DIR/dynflow_executor.pid
RC=$?
RETVAL=$( print_higher $RC $RETVAL )
SECONDVAL=$( print_lower $RC $SECONDVAL )
echo -n "dynflow_executor_monitor is "
status_of_one $KATELLO_PID_DIR/dynflow_executor_monitor.pid
RC=$?
RETVAL=$( print_higher $RC $RETVAL )
SECONDVAL=$( print_lower $RC $SECONDVAL )
if [ 0$SECONDVAL -eq 0 -a 0$RETVAL -gt 0 ]; then
# some is running, some not
return 10
Expand Down Expand Up @@ -170,6 +179,16 @@ stop() {
KATELLO_LOGGING='$KATELLO_LOGGING' \
KATELLO_LOGGING_SQL='$KATELLO_LOGGING_SQL' \
$JOB_SCRIPT $KATELLO_JOB_PARAMS -m -n $KATELLO_JOB_WORKERS stop &>>/var/log/foreman/jobs-startup.log"
if [ -f $KATELLO_PID_DIR/dynflow_executor_monitor.pid ]; then
echo -n $"Stopping dynflow_executor_monitor: "
killproc -p $KATELLO_PID_DIR/dynflow_executor_monitor.pid
echo
fi
if [ -f $KATELLO_PID_DIR/dynflow_executor.pid ]; then
echo -n $"Stopping dynflow_executor: "
killproc -p $KATELLO_PID_DIR/dynflow_executor.pid
echo
fi
if [ 0$KATELLO_JOB_WORKERS -eq 1 ]; then
if [ -f $KATELLO_PID_DIR/delayed_job_monitor.pid ]; then
echo -n $"Stopping delayed_job_monitor: "
Expand Down
6 changes: 5 additions & 1 deletion deploy/script/katello-jobs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env ruby

require "/usr/share/foreman/config/environment"
foreman_root = "/usr/share/foreman"
require File.expand_path('./config/application', foreman_root)
ForemanTasks::Dynflow::Daemon.new.run_background(ARGV.last, :foreman_root => foreman_root)

require File.expand_path('./config/environment', foreman_root)
require 'delayed/command'
Delayed::Command.new(ARGV).daemonize
7 changes: 6 additions & 1 deletion script/delayed_job
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env ruby

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
foreman_root = Dir.pwd

require File.expand_path('./config/application', foreman_root)
ForemanTasks::Dynflow::Daemon.new.run_background(ARGV.last, :foreman_root => foreman_root)

require File.expand_path('./config/environment', foreman_root)
require 'delayed/command'
Delayed::Command.new(ARGV).daemonize

0 comments on commit 2779976

Please sign in to comment.