Skip to content

Instantly share code, notes, and snippets.

@treeder

treeder/batch.rb Secret

Last active December 7, 2015 23:33
Show Gist options
  • Save treeder/780f46512e96e0675782 to your computer and use it in GitHub Desktop.
Save treeder/780f46512e96e0675782 to your computer and use it in GitHub Desktop.
rest = Rest::Client.new
images = JSON.parse(rest.get("https://unsplash.it/list").body)
client = IronWorker::Client.new()
images.each_with_index do |im,i|
puts "Queuing task for image #{i}"
payload = IronWorker.payload
payload = payload.merge({
image_url: "https://unsplash.it/200/300?image=#{im['id']}",
operations: [
{
op: 'sketch',
format: 'jpg',
destination: "image_#{im['id']}"
}
]
})
task = client.tasks.create('USERNAME/image_processor', payload)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment