Skip to content
This repository has been archived by the owner on Aug 8, 2019. It is now read-only.

Commit

Permalink
Merge branch 'coalesce_array'
Browse files Browse the repository at this point in the history
  • Loading branch information
sodabrew committed Jan 23, 2015
2 parents 7bd1e4b + f66c468 commit 2d0251c
Show file tree
Hide file tree
Showing 14 changed files with 396 additions and 188 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ Key | Description
num_workers | Maximum number of messages to process at a time, default `1`
exec_prefix | This is prepended to the script path before calling `exec()`, default `bash -lc`
env_vars | Hash of environment variables and values set before calling `exec()`, default empty
coalesce | Boolean, whether to coalesce messages with identical paramters, default `false`
coalesce_paramN | Boolean, if coalesce is true, whether to coalesce on a particular parameter
coalesce_params | Array of param numbers. Coalesce messages if they have identical parameters, default []
blocking_params | Array of param numbers. Run one message with identical parameters at a time, default []
schedule | Array of hashes of cron-like scheduled jobs
schedule[]: **cron** | A cron-like five element recurring schedule, see crontab(5)
schedule[]: paramN | Optional param1-param4 will be passed to each scheduled job
Expand Down
8 changes: 4 additions & 4 deletions code/adminoper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def status
end

def update!
if File.exists?(@down_file)
if File.exist?(@down_file)
@admin_status = 'DOWN'
elsif File.exists?(@pause_file)
elsif File.exist?(@pause_file)
@admin_status = 'PAUSE'
else
@admin_status = 'UP'
Expand Down Expand Up @@ -55,15 +55,15 @@ def set_oper_status(stat)
private

def create_file(file)
unless File.exists?(file)
unless File.exist?(file)
File.new(file, File::CREAT, 0644) rescue nil
else
true
end
end

def delete_file(file)
if File.exists?(file)
if File.exist?(file)
count = File.unlink(file) rescue 0
count > 0
else
Expand Down
6 changes: 3 additions & 3 deletions code/cleaner_script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def rm_logs_older_than(qname, regex, hours)
end

def mv_logs(qname)
if File.exists?("#{qname}/queue.log")
if File.exist?("#{qname}/queue.log")
a=Time.now
b = sprintf("%s%.2d%.2d.%.2d:%.2d" ,a.year, a.month, a.day, a.hour, a.min)
puts "status: moving #{qname}/queue.log"
Expand All @@ -76,7 +76,7 @@ def mv_logs(qname)
def remove_old(qname, days)
clean_queues = ["/done", "/relayed", "/prep", "/queue"]
clean_queues.each do |cq|
if File.exists?(qname + cq)
if File.exist?(qname + cq)

# go by directories and remove any day dir > days + 1
# then go into the hour dirs and remove by time
Expand Down Expand Up @@ -145,7 +145,7 @@ def trim_relay(qpath, num)
queues = listq(basedir)
else
queues = [basedir + "/queue/" + ENV['RQ_PARAM1']]
if not File.exists?queues[0]
if not File.exist?queues[0]
fail_hard("the specified queue #{queues} does not exist")
end
end
Expand Down
10 changes: 5 additions & 5 deletions code/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def get_queueclient(name)
# No RQ should be connecting to another box's relay
# However, users need the web ui to interact, so we think
# this is safe and good for debugging/visiblity
if File.exists?("./config/rq_router_rules.rb")
if File.exist?("./config/rq_router_rules.rb")
if not ['relay', 'cleaner'].include?(name)
name = 'rq_router'
end
Expand Down Expand Up @@ -347,7 +347,7 @@ def flash(type, msg)
get '/q/:name/config.json' do
path = "./queue/#{params['name']}/config.json"

if not File.exists? path
if not File.exist? path
throw :halt, [404, "404 - Queue config for '#{params['name']}' not found"]
end

Expand Down Expand Up @@ -565,7 +565,7 @@ def flash(type, msg)

# send_file does this check, but we provide a much more contextually relevant error
# TODO: finer grained checking (que, msg_id exists, etc.)
if not File.exists? path
if not File.exist? path
throw :halt, [404, "404 - Message ID log '#{params['log_name']}' not found"]
end

Expand All @@ -590,7 +590,7 @@ def flash(type, msg)

# send_file does this check, but we provide a much more contextually relevant error
# TODO: finer grained checking (que, msg_id exists, etc.)
if not File.exists? path
if not File.exist? path
throw :halt, [404, "404 - Message ID attachment '#{params['attach_name']}' not found"]
end

Expand All @@ -615,7 +615,7 @@ def flash(type, msg)

# send_file does this check, but we provide a much more contextually relevant error
# TODO: finer grained checking (que, msg_id exists, etc.)
if not File.exists? path
if not File.exist? path
throw :halt, [404, "404 - Message ID attachment '#{params['attach_name']}' not found"]
end

Expand Down
2 changes: 1 addition & 1 deletion code/overrides.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize(name, read_file = true)
end

def get_json(path)
if File.exists? path
if File.exist? path
begin
@data = JSON.parse(File.read(path))
rescue
Expand Down
Loading

0 comments on commit 2d0251c

Please sign in to comment.