resque

Looking for way to load just selected models instead of all Rails environment in rake task

会有一股神秘感。 提交于 2019-12-11 13:58:20
问题 in classic rake example we can load all rails environment with all models in taks with: desc "Pick a last user name" task :winner => :environment do puts "Last user: #{User.last.name}" end I have very large rails project so it takes a lot of time to load all models and dependencies. Is any way to load rails with just specific model or set of models? I'm about to write custom rails loader but don't want to invent bycicle ;) Maybe some gem or good custom loader example already exist? I think it

Load only part of environment for rake task?

放肆的年华 提交于 2019-12-11 11:29:31
问题 I've seen a bunch of articles relating to loading the entire Rails environment for a task. However, I'm concerned that this is unnecessary because I only use two models for my task (plus the 'resque' and 'resque/scheduler'). How can I only load certain parts of an environment for my task? Also, this question seems to be the same, but it's gotten old and no one seems to have sufficiently answered it... I'll ask now, ahead of time, that someone please give code rather than just an explanation.

How can I use resque-web for rails api-only app?

空扰寡人 提交于 2019-12-11 06:55:38
问题 I believe resque-web requires ActionView to work correctly. I have a rails api-only app. I plan to run the resque workers on a separate machine using a shared redis server. How can I make resque-web work and still maintaining the app as lean as possible? 来源: https://stackoverflow.com/questions/52233406/how-can-i-use-resque-web-for-rails-api-only-app

Importing csv into multiple mysql databases from rails app

允我心安 提交于 2019-12-11 06:46:13
问题 I have a CSV file consisting of 78,000 records.Im using smarter_csv (https://github.com/tilo/smarter_csv) to parse the csv file. I want to import that into a MySQL database from my rails app. I have the following two questions What would be the best approach to quickly importing such a large data-set into MySQL from my rails app ?. Would using resque or sidekiq to create multiple workers be a good idea ? I need to insert this data into a given table which is present in multiple databases. In

How to start resque not using rails

倾然丶 夕夏残阳落幕 提交于 2019-12-11 05:53:31
问题 I am using ruby (not rails) and I have install resque gem. According to the manual, I should start the workers using the following command: resque work But this command doesn't start the workers at all (I have checked that resque file in bin/ and it doesn't accept 'work' at all). Here is the output: Usage: resque [options] COMMAND Options: -r, --redis [HOST:PORT] Redis connection string -N, --namespace [NAMESPACE] Redis namespace -h, --help Show this message Commands: remove WORKER Removes a

Strange behavior with a resque scheduler job

岁酱吖の 提交于 2019-12-11 04:09:49
问题 so some context, I got some advice here: Scheduling events in Ruby on Rails aand have been tying to implement it today. I cant seem to make it work though. this is my scheduler job that is used to move my questions around between a delayed queue and a ready to send out queue (i've since decided to use email instead of SMS) require 'Assignment' require 'QuestionMailer' module SchedulerJob @delayed_queue = :delayed_queue @ready_queue def self.perform() @delayed_queue.each do |a| if(Time.now >=

How can I pass data to websocket-rack from a class in my sinatra app?

你。 提交于 2019-12-11 03:07:08
问题 I've got a working configuration of websocket-rack in a sinatra app that is intended for a physical installation with multiple screens. There is functionality working where messages are getting passed back and forth through the websockets just fine. My problem is this: I have one page with a standard web form (i.e. not a websocket form), and my goal is to collect the params from that form, turn the params into a string variable, then send the contents of that variable (a string) to a

Rails Resque jobs cannot access database, i/o error

為{幸葍}努か 提交于 2019-12-11 02:59:45
问题 I have an error I cannot find any information on. This is a Ruby on Rails stack (Ruby 1.9, Rails 3.2) and using sqlite3 database for development. Resque and Redis are used for background jobs. The rails web application starts up fine and can access and update the database. I can login with sqlite browser and see records and run queries. The issue is any Resque job cannot access database, and gets an I/O exception. I can see the jobs on the resque web browser/queue and retry them but they

View Resque log output in Rails server logs

浪子不回头ぞ 提交于 2019-12-11 01:27:32
问题 I've got a Rails 4 app on a Puma server with Resque/Resque-Scheduler running background jobs. What I'd like to know is how I merge the log output of my two Resque workers into my server log, or, of that is not possible, how I can view the log output of my Resque workers. Currently I have not been able to figure out how to view the log output for the workers, so I have no idea what's happening under the hood. I found this blogpost, which suggests adding the following likes to my resque.rake

Where should I define my resque logger in my rails application

Deadly 提交于 2019-12-10 13:56:50
问题 I have set up Resque in my rails application and it's all working fine. The question I have is where should the logger setup go. Should it be in the initializer or in the rake task? It works when set up in both. The reason I ask is I have seen it used in both in examples across the net. I am thinking that it should probably be in the initializer as it's best practice to put setup into initializers. config/initializers/resque.rb logfile = File.open(File.join(Rails.root, 'log', 'resque.log'),