Created
August 21, 2015 20:21
-
-
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".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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