Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Unable to schedule jobs #115

Closed
jpsilvashy opened this Issue Oct 13, 2011 · 3 comments

Comments

Projects
None yet
2 participants

I've read through the other issues mentioning this same problem but I can't seem to get what's happening here. So basically I'm trying to schedule my jobs with the yaml file in my configs, and so I have a job that looks like this in there:

map_reduce_specimen:
  every: 30s
  class: MapReduceSpecimenWorker
  queue: map_reduce_specimen
  args: 
  description: "This job..."

The class is actually a module in the directory workers/map_reduce_specimen_worker.rb, but it's my understanding that shouldn't be a problem having it be a module.

Secondly, here is my setup task:

namespace :resque do
  task :setup do
    require 'resque'
    require 'resque_scheduler'
    require 'resque/scheduler'      

    Resque.redis = 'localhost:6379'
    Resque.schedule = YAML.load_file('config/resque_schedule.yml')

    # require 'jobs'

    Resque::Scheduler.dynamic = true
  end
end        

but still no luck, when I run the setup task rake resque:scheduler, I get:

2011-10-12 23:59:36 Reloading Schedule
2011-10-12 23:59:36 Loading Schedule
2011-10-12 23:59:36 Schedule empty! Set Resque.schedule
2011-10-12 23:59:36 Schedules Loaded

I really don't know where to go from here, or if it's something I'm doing wrong or missing, any help at all would be really appreciated!


I think the part that is a little confusing is including/requiring your jobs in the rake task, I'd gladly help expand the documentation to better explain this, but I think I don't understand myself.

Why not just include the whole environment in the rake task? Would that solve this?

Contributor

bvandenbos commented Oct 14, 2011

A lot of people don't want to load the entire env to keep their workers light so I don't include the entire env by default.

Can you try putting the Resque::Scheduler.dynamic = true before the Resque.schedule = YAML.load_file('config/resque_schedule.yml')?

(I realize the documentation has it second)

Do you actually need a dynamic schedule (ie: one that will change while the app is running)?

@jpsilvashy jpsilvashy closed this Oct 26, 2011

This fixed it.

Contributor

bvandenbos commented Oct 27, 2011

Ok. That means I need to update the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment