High-Scale Async Task Processing
#
Worker
code
can
be
anything
you
want.
puts
"Payload:
#{params}"
puts
"Simulating
hard
work
for
5
seconds..."
5.times
do
|i|
puts
"Sleep
#{i}..."
sleep
1
end
puts
"Completed
at
#{Time.now}"
#
Create
hello.worker
file
#
define
the
runtime
language
runtime
'ruby'
#
exec
is
the
file
that
will
be
executed:
exec
'hello_worker.rb'
#
Upload
Worker
$
iron_worker
upload
hello
#
Queue
Workers
require
"iron_worker_ng"
client
=
IronWorkerNG::Client.new
#
launch
100
tasks
in
parallel
100.times
do
client.tasks.create("hello",
foo:
"bar")
end
#
Run
task
once
per
hour
at
high
priority
$
iron_worker
schedule
hello
\
—start-‐at
"2013-‐01-‐01T00:00:00-‐04:00"
\
-‐-‐run-‐every
3600
-‐-‐priority
2