socialpandas / sidekiq-superworker

Directed acyclic graphs of Sidekiq jobs
MIT License
438 stars 34 forks source link

Fix issue #7: Can't pass same arguments to each iteration of batch workers #8

Closed hnatt closed 10 years ago

hnatt commented 10 years ago

While not completely undestanding, how the DSL and particularly, passing args to batch workers, work, with this patch I made it possible to pass the arguments received by superworker class on to batch subworkers. Spec test and documentation included.

thoughtchad commented 10 years ago

+1

tombenner commented 10 years ago

Thanks for looking into this. I've ended up implementing a slightly different solution that's a little more generalized in c04200a4.

The README example in your PR was:

MyBatchSuperworkerWithArgs.perform_async([30, 31, 32, 33], 'Hello', 'world')

With the new setup, this would be written like so:

MyBatchSuperworkerWithArgs.perform_async([30, 31, 32, 33], Array.new(4, 'Hello'), Array.new(4, 'world'))

The upside is that this supports more use cases (see the updated README for details).