Git Product home page Git Product logo

simple_scheduler's People

Contributors

bmedenwald avatar brianpattison avatar kennylindley avatar urkle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

simple_scheduler's Issues

Job not executing

I've ran thru the setup and can see the scheduled jobs in my redis instance, but the code in my job doesn't seem to be executing.

gemfile:

...
gem 'redis'
gem 'sidekiq'
gem 'simple_scheduler'
...

simple_scheduler.yml:

queue_ahead: 360
queue_name: "message_queue"
tz: "America/Chicago"

process_queue:
   class: "MessageQueueJob"
   every: "1.minutes"

MessageQueueJob.rb:

class MessageQueueJob < ApplicationJob
   def perform(scheduled_time)
      #doing stuff here that should output the scheduled_time
   end
end

I also stuck the job code into my own rake task, and it executes fine when called that way...

I have tried the various suggestions for running locally, and have even push to heroku to see if it would ever run, but no dice...

Any guidance is appreciated

NoMethodError: undefined method `now' for nil:NilClass

Hi there,

thank you for your work on this nice gem. :)

I am sorry to report that I was not able to get it going.

Here is the output at the terminal after I ran "rake simple_scheduler --trace"

/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/simple_scheduler-0.2.4/lib/simple_scheduler/at.rb:72:in `now'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/simple_scheduler-0.2.4/lib/simple_scheduler/at.rb:76:in `parsed_day'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/simple_scheduler-0.2.4/lib/simple_scheduler/at.rb:92:in `parsed_time'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/simple_scheduler-0.2.4/lib/simple_scheduler/at.rb:28:in `initialize'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/simple_scheduler-0.2.4/lib/simple_scheduler/task.rb:31:in `new'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/simple_scheduler-0.2.4/lib/simple_scheduler/task.rb:31:in `at'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/simple_scheduler-0.2.4/lib/simple_scheduler/task.rb:67:in `future_run_times'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/simple_scheduler-0.2.4/lib/simple_scheduler/scheduler_job.rb:28:in `block in queue_future_jobs'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/simple_scheduler-0.2.4/lib/simple_scheduler/scheduler_job.rb:26:in `each'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/simple_scheduler-0.2.4/lib/simple_scheduler/scheduler_job.rb:26:in `queue_future_jobs'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/simple_scheduler-0.2.4/lib/simple_scheduler/scheduler_job.rb:9:in `perform'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activejob-5.0.0.1/lib/active_job/execution.rb:34:in `block in perform_now'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:126:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:126:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:455:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:455:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:448:in `block (2 levels) in around'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:286:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:286:in `block (2 levels) in halting'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/newrelic_rpm-3.17.0.325/lib/new_relic/agent/transaction.rb:108:in `wrap'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/newrelic_rpm-3.17.0.325/lib/new_relic/agent/instrumentation/active_job.rb:59:in `run_in_transaction'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/newrelic_rpm-3.17.0.325/lib/new_relic/agent/instrumentation/active_job.rb:48:in `perform'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/newrelic_rpm-3.17.0.325/lib/new_relic/agent/instrumentation/active_job.rb:20:in `block (3 levels) in <top (required)>'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:391:in `instance_exec'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:391:in `block in make_lambda'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:285:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:285:in `block in halting'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:447:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:447:in `block in around'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:455:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:455:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:448:in `block (2 levels) in around'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:286:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:286:in `block (2 levels) in halting'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/i18n-0.7.0/lib/i18n.rb:257:in `with_locale'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activejob-5.0.0.1/lib/active_job/translation.rb:7:in `block (2 levels) in <module:Translation>'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:391:in `instance_exec'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:391:in `block in make_lambda'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:285:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:285:in `block in halting'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:447:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:447:in `block in around'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:455:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:455:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:448:in `block (2 levels) in around'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:286:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:286:in `block (2 levels) in halting'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activejob-5.0.0.1/lib/active_job/logging.rb:24:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activejob-5.0.0.1/lib/active_job/logging.rb:24:in `block (4 levels) in <module:Logging>'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/notifications.rb:164:in `block in instrument'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/notifications.rb:164:in `instrument'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activejob-5.0.0.1/lib/active_job/logging.rb:23:in `block (3 levels) in <module:Logging>'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activejob-5.0.0.1/lib/active_job/logging.rb:44:in `block in tag_logger'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:70:in `block in tagged'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:26:in `tagged'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:70:in `tagged'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activejob-5.0.0.1/lib/active_job/logging.rb:44:in `tag_logger'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activejob-5.0.0.1/lib/active_job/logging.rb:20:in `block (2 levels) in <module:Logging>'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:391:in `instance_exec'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:391:in `block in make_lambda'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:285:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:285:in `block in halting'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:447:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:447:in `block in around'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:455:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:455:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_perform_callbacks'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:90:in `run_callbacks'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activejob-5.0.0.1/lib/active_job/execution.rb:33:in `perform_now'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activejob-5.0.0.1/lib/active_job/execution.rb:16:in `perform_now'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/simple_scheduler-0.2.4/lib/tasks/simple_scheduler_tasks.rake:3:in `block in <top (required)>'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:248:in `call'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:248:in `block in execute'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:243:in `each'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:243:in `execute'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:180:in `invoke_with_call_chain'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:173:in `invoke'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:152:in `invoke_task'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:108:in `each'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:108:in `block in top_level'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:117:in `run_with_threads'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:102:in `top_level'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:80:in `block in run'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:178:in `standard_exception_handling'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:77:in `run'
/Users/volker/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/Users/volker/.rbenv/versions/2.2.4/bin/rake:23:in `load'
/Users/volker/.rbenv/versions/2.2.4/bin/rake:23:in `<main>'

My simple_scheduler.yml

# Global configuration options and their defaults. These can also be set on each task.
queue_ahead: 360 # Number of minutes to queue jobs into the future
tz: nil # The application time zone will be used by default

# Runs once every minute
simple_task:
  class: "CheckForAlarmsJob"
  every: "2.minutes"

# https://github.com/simplymadeapps/simple_scheduler

My job:

class CheckForAlarmsJob < ApplicationJob
  queue_as :default

  def perform(scheduled_time)
    # Do something later
    # Rails.logger.info("Job CheckForAlarms running: #{Time.now}")
    puts Time.at(scheduled_time)

  end
end

Any help is appreciated.

Cheers,
Volker

Dealing with Active Job 'NoMethodError' argument

Environment

Rails 5.0.3
Sidekiq Free 5.0.4
Also using simple_scheduler as well.

Context

Currently, I am trying to integrate emailing to my scheduler rails application.
I am having trouble with my SendEmailLaterJob. It seems that the user argument works when initially called in one of my controllers: SendEmailLaterJob.perform_later(@user) however, the argument changes in the second go to a number.

I got everything working; however, once I introduced @user as a parameter in my Job I keep having the same error (scheduling works fine btw)

Error: WARN: NoMethodError: undefined method email' for 1504489380:Integer`.

(ctrl-f "noteworthy:" to find quickly examples of my code breaking in the Logs section below)

SendEmailLaterJob

class SendEmailLaterJob < ApplicationJob
  queue_as :mailers

  def perform(user)
  	FlagupMailer.flagup_test(user).deliver_later
  end
end

Logs

2017-09-04T01:39:56.566Z 39963 TID-ov6orso88 INFO: Booting Sidekiq 5.0.4 with redis options {:url=>"redis://localhost:6379/0", :id=>"Sidekiq-server-PID-39963"}


         m,
         `$b
    .ss,  $$:         .,d$
    `$$P,d$P'    .,md$P"'
     ,$$$$$bmmd$$$P^'
   .d$$$$$$$$$$P'
   $$^' `"^$$$'       ____  _     _      _    _
   $:     ,$$:       / ___|(_) __| | ___| | _(_) __ _
   `b     :$$        \___ \| |/ _` |/ _ \ |/ / |/ _` |
          $$:         ___) | | (_| |  __/   <| | (_| |
          $$         |____/|_|\__,_|\___|_|\_\_|\__, |
        .d$$                                       |_|

2017-09-04T01:39:56.721Z 39963 TID-ov6orso88 INFO: Running in ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]
2017-09-04T01:39:56.721Z 39963 TID-ov6orso88 INFO: See LICENSE and the LGPL-3.0 for licensing details.
2017-09-04T01:39:56.722Z 39963 TID-ov6orso88 INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org
2017-09-04T01:39:56.764Z 39963 TID-ov6orso88 INFO: Starting processing, hit Ctrl-C to stop
2017-09-04T01:40:19.329Z 39963 TID-ov6otwhkc SendEmailLaterJob JID-59b6c628008fcfb1158eb06c INFO: start
Newtext: 18:40:20!!!

[2, 11] in /Users/AbeBook/Dropbox/coding/flagupmail/app/mailers/flagup_mailer.rb
    2: 	default from: "[email protected]"
    3: 
    4: 	def flagup_test(user)
    5: 		
    6: 		@user = user
    7: 		@url = "https://google.com"
    8: 		debugger
=>  9: 		mail to: @user.email, subject: "Welcome to your recurring email!"
   10: 	end
   11: end
(byebug) @user
#<User id: 102, name: "gomezja", email: "[email protected]", .... more info>
(byebug) @user.email
noteworthy: 1 --> "[email protected]"
(byebug) continue
2017-09-04T01:40:49.556Z 39963 TID-ov6otwhkc SendEmailLaterJob JID-59b6c628008fcfb1158eb06c INFO: done: 30.227 sec
2017-09-04T01:43:17.928Z 39963 TID-ov6otweeg SimpleScheduler::FutureJob JID-7c644473fed5953f4e63f7af INFO: start
2017-09-04T01:43:17.936Z 39963 TID-ov6otweeg SimpleScheduler::FutureJob JID-7c644473fed5953f4e63f7af INFO: done: 0.008 sec
2017-09-04T01:43:17.937Z 39963 TID-ov6otlo2o SendEmailLaterJob JID-e51c180fda044d3f9a3d6440 INFO: start
Newtext: 18:43:17!!!

[2, 11] in /Users/AbeBook/Dropbox/coding/flagupmail/app/mailers/flagup_mailer.rb
    2: 	default from: "[email protected]"
    3: 
    4: 	def flagup_test(user)
    5: 		
    6: 		@user = user
    7: 		@url = "https://google.com"
    8: 		debugger
=>  9: 		mail to: @user.email, subject: "Welcome to your recurring email!"
   10: 	end
   11: end
(byebug) @user
noteworthy: 2 --> 1504489380 
(byebug) user
1504489380
(byebug) continue
2017-09-04T01:44:22.977Z 39963 TID-ov6otlo2o SendEmailLaterJob JID-e51c180fda044d3f9a3d6440 INFO: fail: 65.041 sec
2017-09-04T01:44:22.978Z 39963 TID-ov6otlo2o WARN: {"context":"Job raised exception","job":{"class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","wrapped":"SendEmailLaterJob","queue":"default","args":[{"job_class":"SendEmailLaterJob","job_id":"57c1e2a7-4ddd-4058-8a92-2bd66ba2f58c","queue_name":"default","priority":null,"arguments":[1504489380],"locale":"en"}],"retry":true,"jid":"e51c180fda044d3f9a3d6440","created_at":1504489397.9355352,"enqueued_at":1504489397.935581,"error_message":"undefined method `email' for 1504489380:Integer","error_class":"NoMethodError","failed_at":1504489462.9770648,"retry_count":0},"jobstr":"{\"class\":\"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper\",\"wrapped\":\"SendEmailLaterJob\",\"queue\":\"default\",\"args\":[{\"job_class\":\"SendEmailLaterJob\",\"job_id\":\"57c1e2a7-4ddd-4058-8a92-2bd66ba2f58c\",\"queue_name\":\"default\",\"priority\":null,\"arguments\":[1504489380],\"locale\":\"en\"}],\"retry\":true,\"jid\":\"e51c180fda044d3f9a3d6440\",\"created_at\":1504489397.9355352,\"enqueued_at\":1504489397.935581}"}
noteworthy: 3 ---> 2017-09-04T01:44:22.981Z 39963 TID-ov6otlo2o WARN: NoMethodError: undefined method `email' for 1504489380:Integer 
2017-09-04T01:44:22.982Z 39963 TID-ov6otlo2o WARN: /Users/AbeBook/Dropbox/coding/flagupmail/app/mailers/flagup_mailer.rb:9:in `flagup_test'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.3/lib/abstract_controller/base.rb:188:in `process_action'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.3/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:97:in `__run_callbacks__'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:90:in `run_callbacks'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.3/lib/abstract_controller/callbacks.rb:19:in `process_action'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.3/lib/abstract_controller/base.rb:126:in `process'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/actionmailer-5.0.3/lib/action_mailer/rescuable.rb:23:in `block in process'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/actionmailer-5.0.3/lib/action_mailer/rescuable.rb:15:in `handle_exceptions'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/actionmailer-5.0.3/lib/action_mailer/rescuable.rb:22:in `process'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/actionview-5.0.3/lib/action_view/rendering.rb:30:in `process'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/actionmailer-5.0.3/lib/action_mailer/base.rb:595:in `block in process'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/notifications.rb:164:in `block in instrument'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/notifications.rb:164:in `instrument'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/actionmailer-5.0.3/lib/action_mailer/base.rb:594:in `process'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/actionmailer-5.0.3/lib/action_mailer/message_delivery.rb:105:in `block in processed_mailer'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/actionmailer-5.0.3/lib/action_mailer/message_delivery.rb:104:in `tap'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/actionmailer-5.0.3/lib/action_mailer/message_delivery.rb:104:in `processed_mailer'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/actionmailer-5.0.3/lib/action_mailer/message_delivery.rb:27:in `__getobj__'
/Users/AbeBook/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/delegate.rb:80:in `method_missing'
/Users/AbeBook/Dropbox/coding/flagupmail/app/jobs/send_email_later_job.rb:8:in `perform'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activejob-5.0.3/lib/active_job/execution.rb:34:in `block in perform_now'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:126:in `call'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:455:in `call'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:448:in `block (2 levels) in around'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:286:in `block (2 levels) in halting'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/i18n-0.8.6/lib/i18n.rb:257:in `with_locale'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activejob-5.0.3/lib/active_job/translation.rb:7:in `block (2 levels) in <module:Translation>'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:391:in `instance_exec'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:391:in `block in make_lambda'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:285:in `block in halting'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:447:in `block in around'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:455:in `call'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:448:in `block (2 levels) in around'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:286:in `block (2 levels) in halting'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activejob-5.0.3/lib/active_job/logging.rb:24:in `block (4 levels) in <module:Logging>'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/notifications.rb:164:in `block in instrument'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/notifications.rb:164:in `instrument'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activejob-5.0.3/lib/active_job/logging.rb:23:in `block (3 levels) in <module:Logging>'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activejob-5.0.3/lib/active_job/logging.rb:44:in `block in tag_logger'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/tagged_logging.rb:69:in `block in tagged'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/tagged_logging.rb:26:in `tagged'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/tagged_logging.rb:69:in `tagged'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activejob-5.0.3/lib/active_job/logging.rb:44:in `tag_logger'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activejob-5.0.3/lib/active_job/logging.rb:20:in `block (2 levels) in <module:Logging>'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:391:in `instance_exec'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:391:in `block in make_lambda'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:285:in `block in halting'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:447:in `block in around'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:455:in `call'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:750:in `_run_perform_callbacks'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:90:in `run_callbacks'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activejob-5.0.3/lib/active_job/execution.rb:33:in `perform_now'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activejob-5.0.3/lib/active_job/execution.rb:22:in `block in execute'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:126:in `call'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:455:in `call'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:448:in `block (2 levels) in around'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:286:in `block (2 levels) in halting'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activejob-5.0.3/lib/active_job/railtie.rb:26:in `block (4 levels) in <class:Railtie>'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/execution_wrapper.rb:85:in `wrap'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/reloader.rb:68:in `block in wrap'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/execution_wrapper.rb:81:in `wrap'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/reloader.rb:67:in `wrap'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activejob-5.0.3/lib/active_job/railtie.rb:25:in `block (3 levels) in <class:Railtie>'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:391:in `instance_exec'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:391:in `block in make_lambda'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:285:in `block in halting'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:447:in `block in around'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:455:in `call'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:750:in `_run_execute_callbacks'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/callbacks.rb:90:in `run_callbacks'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activejob-5.0.3/lib/active_job/execution.rb:20:in `execute'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activejob-5.0.3/lib/active_job/queue_adapters/sidekiq_adapter.rb:40:in `perform'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:199:in `execute_job'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:170:in `block (2 levels) in process'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/middleware/chain.rb:128:in `block in invoke'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/middleware/chain.rb:133:in `invoke'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:169:in `block in process'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:141:in `block (6 levels) in dispatch'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/job_retry.rb:97:in `local'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:140:in `block (5 levels) in dispatch'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/rails.rb:42:in `block in call'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/execution_wrapper.rb:85:in `wrap'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/reloader.rb:68:in `block in wrap'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/execution_wrapper.rb:85:in `wrap'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.3/lib/active_support/reloader.rb:67:in `wrap'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/rails.rb:41:in `call'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:136:in `block (4 levels) in dispatch'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:215:in `stats'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:131:in `block (3 levels) in dispatch'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/job_logger.rb:7:in `call'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:130:in `block (2 levels) in dispatch'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/job_retry.rb:72:in `global'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:129:in `block in dispatch'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/logging.rb:44:in `with_context'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/logging.rb:38:in `with_job_hash_context'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:128:in `dispatch'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:168:in `process'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:85:in `process_one'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/processor.rb:73:in `run'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/util.rb:16:in `watchdog'
/Users/AbeBook/.rvm/gems/ruby-2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/util.rb:25:in `block in safe_thread'
2017-09-04T01:45:09.589Z 39963 TID-ov6otle24 SendEmailLaterJob JID-e51c180fda044d3f9a3d6440 INFO: start
Newtext: 18:45:09!!!

Initializers

sidekiq.yml
# Configuration file for Sidekiq.
# Options here can still be overridden by cmd line args.
# Place this file at config/sidekiq.yml and Sidekiq will
# pick it up automatically.

:concurrency: 25
:timeout: 8
sidekiq.rb
if Rails.env == "development"
	
	Sidekiq.configure_server do |config|
	  config.redis = { url: 'redis://localhost:6379/0'  }
	end

	Sidekiq.configure_client do |config|
	  config.redis = { url: 'redis://localhost:6379/0'  }
	end
end

Thanks in advanced...
Let me know if you need any other information.

Question: Running multiple queues

So I've had simple_scheduler running fine on the default queue for a little bit now, but I have run into an issue that is requiring me to split up so jobs into separate dynos on Heroku...

I am currently trying to get two workers in my procfile running separate sidekiq queues, which I would assume pick up the jobs created by this gem.

Procfile:

web: bundle exec puma -C config/puma.rb
critical_worker: bundle exec sidekiq -C config/sidekiq.yml -q critical
worker: bundle exec sidekiq -C config/sidekiq.yml -q default

These seem to boot up fine allowing me to have separate dynos on Heroku, but from there things seem to fall apart (at least in my local testing).

I tried setting the queue_name on a specific job in my simpe_scheduler.yml

# Global configuration options. The `queue_ahead` and `tz` options can also be set on each task.
queue_ahead: 360 # 6 hours # Number of minutes to queue jobs into the future
queue_name: "default" # The Sidekiq queue name used by SimpleScheduler::FutureJob
tz: "America/Chicago" # The application time zone will be used by default if not set

# Runs once every 1 minutes
process_queue:
  class: "MessageQueueJob"
  every: "1.minutes"
  queue_name: 'critical' #This did not work...

check_media_status:
  class: "MediaStatusUpdaterJob"
  every: "1.minutes"

so then I tried splitting the initializer into two files:
config/simple_scheduler.yml
&&
config/critical_scheduler.yml #This doesn't seem to work either...
I just set the queue_name to 'critical' in the critical_scheduler.

So I guess my question is:
Is it possible to run multiple queues with this gem allowing me to utilize multiple dynos?

Store schedule in database

This is simply a question:
Is it possible to run the schedule from a database rather than a yml file?

I have a had full of jobs in my yml, but sometimes I'd like to change the schedule (increase/decrease frequency) or even pause it all together. It would be nice to not have to run a deployment to affect these jobs...

Question: Job runs daily rather following the days of the week provided

I have the following setup in config/simple_scheduler.rb. We'd like the job to only be run M-F, and tried to configure it using the code below. Do you have any suggestions as it ran today (i.e. Saturday)?

# Global configuration options. These can also be set on each task.
queue_ahead: 360 # Number of minutes to queue jobs into the future

tz: "America/New_York" # The application time zone will be used by default if not set

# Runs once every day at 4:15 PM. The job will expire after 18 hours, which means the
# job will not run if 18 hours passes (server downtime) before the job is actually run
overnight_task:
  class: "DailyJob"
  every: "1.day"
  at: "[Mon|Tue|Wed|Thu|Fri] 20:00"
  expires_after: "23.hours"

Scheduled Jobs Missing in Sidekiq

Hello,

Recently I decided to use Simple Scheduler with Sidekiq for one of our newest projects. I did the setup, prepared the config files and deployed it to Heroku.

When viewing Sidekiq Web Interface with the latest version of Simple Scheduler (v. 1.0.0), in the Scheduled tab there are 0 jobs scheduled.

Screenshot 2019-06-26 at 13 06 06

Is this by design?

In version v. 0.3.4, the scheduled jobs were visible in Sidekiq Web UI.

Screenshot 2019-06-26 at 13 32 52

Thank you!

NotImplementedError : Won't recognize Sidekiq

I am trying to do a simple test execution of a Sidekiq worker. No matter what I do, I continue to get:

NotImplementedError: Use a queueing backend to enqueue jobs in the future. Read more at http://guides.rubyonrails.org/v4.2.0/active_job_basics.html

It's like simple_scheduler doesn't recognize Sidekiq at all, and is forcing me to use ActiveJob. I even tried setting up a simple job (I normally don't use active job, so I might have forgotten something, but I need this to work with Sidekiq). I have tried running redis-server locally, no help. I have pushed to Heroku and set things up in Scheduler there, and get the same message.

To test locally I'm running foreman run rake simple_scheduler. Passing the config file as a param has no effect. I have combed the docs a dozen times and I can't figure out where I'm screwing up here. Am I missing something obvious? How can I test this on my local machine, outside Heroku, during dev? Many thanks!

Gemfile:

source 'https://rubygems.org'
ruby '2.3.1'
gem 'rails', '4.2.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'jquery-turbolinks'
gem 'jbuilder', '~> 2.0'

gem 'devise'
gem 'foundation-rails'
gem 'foundation-icons-sass-rails'
gem 'pg'
gem 'mysql2', '~> 0.3.18'
gem 'simple_form'
gem "puma"
gem 'slim-rails'
gem 'rails_admin'
gem 'httparty'
gem 'dalli'
gem 'julia_builder'
gem "s3"
gem "paperclip", "~> 5.0.0"
gem 'aws-sdk', '~> 2.3'

group :development do
  gem 'better_errors'
  gem 'quiet_assets'
  gem "less2sass" #LESS > SASS at command line.
  gem "rails-erd"
  gem 'foreman'
  gem 'pry-byebug'
  gem 'rails_real_favicon'
end

group :development, :test do
  # gem 'factory_girl_rails'
  # gem 'faker'
  # gem 'rspec-rails'
end

group :production do
  gem 'rails_12factor'
end

group :test do
  gem 'capybara'
  gem 'database_cleaner'
  gem 'launchy'
  gem 'selenium-webdriver'
  gem "minitest-rails", "~> 2.0"
  gem 'fabrication'
end

#transport protocol
gem "redis"

#pagination
gem 'kaminari'

#Binary serialization
gem "msgpack"

gem "newrelic_rpm"
gem "sidekiq", "4.2.0"

# if you require 'sinatra' you get the DSL extended to Object
gem 'sinatra', :require => nil

#To update resources in Sugar
gem "addressable"

gem 'rubyzip', '>= 1.0.0' # will load new rubyzip version
gem 'zip-zip' # will load compatibility for old rubyzip API.
gem "authority" #for user authorization
gem "gon" #moving data to JS.
gem "keen" #data warehousing for reporting.
gem "momentjs-rails" #javascript date/time
gem 'high_voltage', '~> 3.0.0' #for static pages.
gem "nokogiri" #for XML generation
gem "zip-codes"
gem "timezone"
gem 'puma_worker_killer' #help manage out of control dynos until we can nail down memory issues.
gem 'carrierwave', '~> 1.0' #for our file uploads.
gem "bugsnag"
gem "select2-rails"
gem "geocoder"
gem "simple_scheduler" #how we run all intervaled rakes (nightly, hourly, etc)

Procfile:

web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -C config/sidekiq.yml

my_worker.rb:

class MyWorker
  include Sidekiq::Worker
  sidekiq_options queue: ENV["SIDEKIQ_QUEUE"]

# @param scheduled_time [Integer] The epoch time for when the job was scheduled to be run
  def perform(scheduled_time)
    p "I ran MyWorker at #{Time.at(scheduled_time)}"
  end
end

simple_scheduler.yml:

# Global configuration options. These can also be set on each task.
queue_ahead: 360 # Number of minutes to queue jobs into the future
tz: "America/Chicago" # The application time zone will be used by default if not set

residents_90_day_summary_task:
  class: "MyWorker"
  every: "2.minutes"

Support for Sidekiq > 5.0?

Just tried installing this on a project using Sidekiq 5.0 and ran into a dependency issue because of the ~> 4.2 requirement for sidekiq in the gemspec. Is there anything holding this back from being 5.0 compatible? For now I'll just roll back to Sidekiq 4.2.10. Thanks!

Interval configurations in simple_scheduler.yml was not followed.

Hi I'm following the instruction on the Read Me and I'm using Sidekiq and Heroku.

I have this configuration on my config/scheduler.yml

tz: "Asia/Singapore"

notification_worker_job:
  class: 'SendNotificationWorker'
  every: '2.minutes'

and on my Heroku Scheduler:
screenshot 2017-05-29 18 09 29

I'm expecting to run the job ** every 2 minutes** because I set it on the scheduler.yml file
but the worker only runs every 10 minutes which is set on Heroku Scheduler.

My question is why is it not following the every 2 minutes set on scheduler.yml file.

Schedule a task which repeats every 12 hours at 5:30am & pm?

Is is possible, which 1 config file entry, to schedule a task which repeats every 12 hours at specific times (like 5:30am and 5:30pm)? I just entered this:

reset_cache:
  class: "RefreshCacheWorker"
  every: "12.hours"
  at: "05:30"
  tz: "America/New_York"```

But what I got was that task scheduled twice at 5:30am tomorrow:

[ActiveJob] [SimpleScheduler::SchedulerJob] [0ea4ed14-aa7c-4bde-bc1a-b07a2577b75f] Enqueued SimpleScheduler::FutureJob (Job ID: 9b5c4f0c-1a78-49c1-8ad5-7aabad669720) to Sidekiq(default) at 2017-03-30 09:30:00 UTC with arguments: {:class=>"RefreshCacheWorker", :every=>"12.hours", :at=>"05:30", :tz=>"America/New_York", :queue_ahead=>360, :name=>"reset_cache"}, 1490866200
[ActiveJob] [SimpleScheduler::SchedulerJob] [0ea4ed14-aa7c-4bde-bc1a-b07a2577b75f] Enqueued SimpleScheduler::FutureJob (Job ID: cee4d457-fa81-47e8-ad5b-105afe21eaef) to Sidekiq(default) at 2017-03-30 09:30:00 UTC with arguments: {:class=>"RefreshCacheWorker", :every=>"12.hours", :at=>"05:30", :tz=>"America/New_York", :queue_ahead=>360, :name=>"reset_cache"}, 1490866200


I know I could easily do what I want with two separate config entries (daily at 5:30am and daily @ 5:30pm) but I just thought I'd ask in case there was a way to do it in one config entry.

Thanks.

ArgumentError: min out of range

Have you seen this error before?

ArgumentError: min out of range
- 92 non-project frames
1
File "/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.2/lib/active_support/core_ext/time/calculations.rb" line 111 in utc
2
File "/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.2/lib/active_support/core_ext/time/calculations.rb" line 111 in change
3
File "/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.0.2/lib/active_support/time_with_zone.rb" line 462 in method_missing
4
File "/app/vendor/bundle/ruby/2.4.0/gems/simple_scheduler-0.2.5/lib/simple_scheduler/at.rb" line 98 in parsed_time
5
File "/app/vendor/bundle/ruby/2.4.0/gems/simple_scheduler-0.2.5/lib/simple_scheduler/at.rb" line 28 in initialize
6
File "/app/vendor/bundle/ruby/2.4.0/gems/simple_scheduler-0.2.5/lib/simple_scheduler/task.rb" line 31 in new
7
File "/app/vendor/bundle/ruby/2.4.0/gems/simple_scheduler-0.2.5/lib/simple_scheduler/task.rb" line 31 in at

I started getting it just after adding and deploying the last job below:

queue_ahead: 360 # Number of minutes to queue jobs into the future
tz: "America/New_York" # The application time zone will be used by default if not set

update_prices_otcbb:
  class: "UpdatePricesOtcbbWorker"
  every: "1.day"
  at: "18:10"
  expires_after: "2.hours"
  tz: "America/New_York"

post_update_prices_otcbb:
  class: "PostUpdatePricesOtcbbWorker"
  every: "1.day"
  at: "18:50"
  expires_after: "2.hours"
  tz: "America/New_York"

company_profiles_otcbb:
  class: "CompanyProfileOtcbbWorker"
  every: "1.hour"
  at: "*:45"

company_profiles_canada:
  class: "CompanyProfileCanadaWorker"
  every: "1.hour"
  at: "*:15"

The first three jobs had been there for a few hours and working fine.

I tried debugging it by changing *:15 to other times bit that didn't fix it. Then I got to the point where I just commented out the last job but I still got the exception. Then I commented out both of the last 2 jobs but the exception was still being thrown.

At this point I started to suspect that something weird was going on because of the time of day. I happened to push the new job for the first time just after 11pm Eastern time. (My server is UTC but timezone in the config is set to America/New_York) When I started thinking this it was just a couple of minutes before midnight. Low and behold, after midnight things are working fine with all four jobs' configs uncommented.

I'll keep an eye on how things go tomorrow night to see if it was actually something to do with the time of day.

Weekly Jobs one day before

All my weekly jobs defined on a specific day of the week are queued to 24 hours before.
E.g.:

queue_ahead: 10
tz: "America/New_York"

weekly_reports:
  class: "WeeklyReportEmailJob"
  every: "1.week"
  at: "Mon 19:00"

On sidekiq the arguments are correct, but the scheduled day is Sunday (17 April, in 5 days) instead of Monday (18 April):
image
Timestamp hovering "5 days" is 2017-04-17T23:00:00Z which means that the hours is ok (23h UTC = 19h EDT), but the day is not.

Daily Jobs are being scheduled correctly.
Anyone experience the same? They were working correctly last week (or on the week before).

Some jobs being enqueued twice (Fixed in v1.1.1)

Hi again guys,

First, I've been happily using the gem for over 2 years now. It continues to be a great help to me. So thanks again...

I upgraded from 1.0.0 to 1.1.0 on July 31st. The next day one of my jobs (ProDigestsWorker) started running twice instead of the once daily it's been running for years. I only noticed because it sends emails to my users and a couple of them started complaining that they were getting the nightly email twice, about 3 minutes apart.

Today I watched the scheduled jobs as the time for the emails to be sent approached. The list looked fine -- I only saw that job scheduled once within the upcoming hours. So the job started -- it queries all the users who should get the email and then enqueues other jobs to send each individual email.

So I watched that process work as it should but to my surprise, when I looked at the default queue, I see ProDigestsWorker enqueued again. Do you have any guesses as to why this may be happening?

My first thought was that ProDigestsWorker was failing and being retried, but it's set to: sidekiq_options queue: 'default', retry: false And it doesn't show up in my exception tracker.

Now I'm thinking that maybe there's just a timing quirk with when Heroku Scheduler is running rake simple_scheduler -- ProDigestsWorker runs at 7:05 and Heroku Scheduler is supposed to run at :03, :13, etc. ProDigestsWorker runs for about 2 minutes and I'm wondering if somehow the rake task is re-scheduling it while it's running.

Any thoughts would be appreciated. I know this may be impossible for you to debug but I thought I'd ask in case one of the 1.1.0 changes may be causing this.

Thanks again.

Sidekiq: Custom Queues?

Is it possible to indicate the Sidekiq queue? We are using several custom queue names, and I'm seeing that it uses default when creating the SK jobs.

How necessary is the Rails requirement?

This looks like a neat well-written scheduler that would be great to use in a non-Rails app. For example, I have a use case for it now in a custom rack app. Reading through the code, I don't see all that many Rails dependencies, just a few scattered ActiveSupport methods that could fairly easily be replaced with plain ruby counterparts. How big of a lift do you think it would be to divorce this gem from Rails, and do you have any desire for such a refactor and maintenance? I'd totally respect "no" for an answer, OSS work can be exhausting, but doesn't hurt to ask. ๐Ÿ™‚

Edit: Just to clarify, I'm not proposing removing Rails-specific support, just making the gem work without Rails as an option.

Features need for 1.0

@simplymadeapps I noticed that the version is currently set at 0.2.7.

If my team may ask, what features would be needed (in your opinion) for the gem to be ready for production? We're happy to help if applicable!

Using shoryuken instead of sidekiq

Hi @brianpattison! Thank you for creating this library - it looks great. I'd love to use it but I'm using shoryuken instead of sidekiq.

I was wondering if this can be used with shoryuken instead of sidekiq? Are the specific tweaks or settings that might make it possible?

Thanks!

Question: Don't send scheduled_time

So I have a few workers that I use sidekiq-unique-jobs on.
In these jobs, they are fairly long-running, and I used the unique jobs gem to keep a second instance from starting if a previous instance is already going.

This works great until I schedule them because the unique jobs gem is using the params to check uniqueness and the since the timestamp is different on each run then it's considered unique.

I noticed that the scheduled_time is optional based on the Writing your Jobs section, but when I just tried removing that param from the perform method, I started getting an argument error:
ArgumentError: wrong number of arguments (given 1, expected 0)

So my question here is, how do I not send the scheduled_time?

How to test in a development environment?

I have spent the last 2 months learning rails so please excuse if this question is misplaced.

I want to test if my application can send an email every 2 minutes (just for testing, not going to be in the final product). I have gotten Sidekiq working, but I am struggling to figure out to send concurrent emails.

From my understanding, the simple_scheduler only works in a deployed environment with Heroku right (not trying to talk this down, I plan on using this once I ready for deploying)?

Thanks

  • Abraham

Monthly job

Hi!
I can't seem to find the monthly "at" options. I want to run a Job each first day of the month, not "in one month". Can I do this with the current version of simple_scheduler?

Sidekiq Web UI

We want to add a tab to the Sidekiq web UI to view a list of jobs scheduled using Simple Scheduler in a way that's easier to read than the existing scheduled jobs tab. There should also be a way to reset the scheduled jobs in the case of changes being made to the configuration file.

How does queue_ahead work?

Hi guys,

First, let me say that I'm really looking forward to switching all my jobs over to your scheduler! This should solve a few headaches for me.

I just added & configured the gem for a couple of my jobs. queue_ahead is set to 360 in the config file. And I have two daily tasks which are set to run at 18:10 and 18:50 (18:10 is just over an hour from now).

Given how I interpreted queue_ahead to work, I expected to see two jobs scheduled in my Sidekiq dashboard: today at 18:10 and today at 18:50. But I see 4 jobs scheduled: today and tomorrow at 18:10 and at 18:50. Should I expect to see tomorrow's jobs scheduled already given that their start times are more than 24 hours away?

screenshot 2017-03-16 16 59 05

Thanks

Getting "ArgumentError: wrong number of arguments (given 0, expected 1..2)"...

After I modified some of my jobs to accept one more (optional) parameter in the perform method I started getting:

ArgumentError: wrong number of arguments (given 0, expected 1..2)
1
File "/app/app/workers/update_prices_otcbb_worker.rb" line 6 in perform

So my perform definition looks like: def perform(scheduled_time, my_param=nil)

I'm not expecting simple_scheduler to pass my_param, rather, my intention for adding that param is that I may need to manually run that worker, passing it the date which needs to be processed. So, in effect, I just want simple_scheduler to ignore it and keep working as it was when perform was only expecting scheduled_time to be passed.

I think I've found the bug. It's in the usage of arity in FutureJob#queue_task. That has:

    if @task.job_class.instance_method(:perform).arity > 0
        @task.job_class.send(perform_method, @scheduled_time.to_i)
      else
        @task.job_class.send(perform_method)
      end

However, arity returns a negative number for methods that have a variable number of arguments - https://ruby-doc.org/core-2.2.0/Method.html#method-i-arity

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.