whenever icon indicating copy to clipboard operation
whenever copied to clipboard

5.2.2 Jobs Not Running with job_type :runner

Open RIttera13 opened this issue 5 years ago • 3 comments

I had an issue after upgrading to 5.2.2 when jobs where not running. Jobs were added to crontab correctly and looked correct. I compared it to the crontab that worked before and it was the same. The issue was that the method to run the job was no longer working. I used a new job_type to use new commands and resolve the issue. The problem is that && bundle exec bin/rails needed to drop the "bin" and just read && bundle exec rails. I'm not sure if anyone else has had or can recreate the issue.

Just to confirm, the only changes made to my environment when this occurred was upgrading from Rails 5.0.1 to Rails 5.2.2.

Doesn't Work: Default - job_type :runner, "cd :path && bin/rails runner -e :environment ':task' :output"

Creates this cronjob - /bin/bash -l -c 'cd /var/deploy/MyApp/web_head/releases/20190201171815 && bundle exec bin/rails runner -e staging '\'MyJob.perform_now'\'''

Working Version: My Custom job_type - job_type :new_runner, "cd :path && bundle exec rails runner -e :environment ':task' :output"

Creates this cronjob - /bin/bash -l -c 'cd /var/deploy/MyApp/web_head/releases/20190201194724 && bundle exec rails runner -e staging '\''MyJob.perform_now'\'''

My environment is Ubuntu 16.04 self hosted but managed through Cloud66.

  • ruby 2.4.2p198
  • Rails 5.2.2

And thank you to the creators/maintainers of this awesome gem. Also, the ability to create a custom job_type made this issue very minor, so thank you for that as well.

RIttera13 avatar Feb 01 '19 20:02 RIttera13

I've got a similar issue that tasks are not executed, so I've added a logger and noticed this issue:

bundler: failed to load command: bin/rails (bin/rails) LoadError: cannot load such file -- bootsnap/setup /home/deploy/applications/platforma/releases/20190419062535/config/boot.rb:6:in require' /home/deploy/applications/platforma/releases/20190419062535/config/boot.rb:6:in <top (required)>' bin/rails:3:in require_relative' bin/rails:3:in <top (required)>'

because I've removed this gem from prod env. Check you logs set :output, "/home/deploy/applications/platforma/current/log/crontab.log"

maybe you have another issue.

igorkasyanchuk avatar Apr 19 '19 06:04 igorkasyanchuk

@RIttera13 did you ever find a solution for this? I'm seeing a similar issue with Rails 6.1 and ruby 3.0.0

ishields avatar Jan 11 '21 13:01 ishields

I had the same issue. My workaround was to create a rake task that simply calls my class method and create a cron job that runs the rake task. I got the added benefit of gaining a rake task I can manually run.

KevinTriplett avatar Aug 05 '22 17:08 KevinTriplett