Skip to content

Instantly share code, notes, and snippets.

@iamjwc
Created August 21, 2015 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamjwc/891be61bbfaffbe8cf30 to your computer and use it in GitHub Desktop.
Save iamjwc/891be61bbfaffbe8cf30 to your computer and use it in GitHub Desktop.
File takes a CSV of "okey,root_okey,source_okey" and enqueues work for the "SetRootAndSourceProjectIdsProcessor".
def enqueue_for_migrant_work(okey, root, source)
queue_name = "migrant_worker_$$$ENVIRONMENTNAME$$$"
payload = {
'processor' => 'SetRootAndSourceProjectIdsProcessor',
'okey' => okey,
'root' => root,
'source' => source,
}
Resque.push(queue_name, {
'class' => 'Migrant::Worker',
'args' => [{
'timeout' => 500,
'request_created_at' => Time.now.to_f,
'payload' => payload
}]
})
end
ARGF.each do |line|
okey, root, source = line.split(",")
if root.blank?
root = nil
end
if source.blank?
source = nil
end
enqueue_for_migrant_work(okey, root, source)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment