Created
October 29, 2014 19:20
-
-
Save jeremyf/1f4e82875d4918a5332b to your computer and use it in GitHub Desktop.
This file contains 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
# This is a theoretical means of writing a command line tool for pushing jobs | |
# into Resque. This is what we've explored. It allows us to keep our workers | |
# and other models in the same repository. | |
require 'resque' | |
# In the worker application, the SomeWorker class is defined and has methods for | |
# performing the work. This | |
class SomeWorker | |
def initialize(pid) | |
@pid = pid | |
end | |
end | |
# I think we need this. | |
class MarshaledJob | |
def self.perform(marshaled_job) | |
Marshal.load(Base64.decode64(marshaled_job)).run | |
end | |
end | |
job = SomeWorker.new(ARGV[0]) | |
Resque.enqueue_to queue, MarshaledJob, Base64.encode64(Marshal.dump(job)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment