-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not receiving recommendations #7
Comments
Can you verify that your current_user has liked or disliked at least one thing? If current_user hasn't rated anything, they'll get no recommendations. Likewise, if there are no other users in the system (or nobody has rated anything yet), nobody will have recommendations. |
Yes, there are two users on the system. Both of which have likes (current_user.liked) and dislikes (current_user.dislikes). I am running on heroku, and I am curious about the command
How can I verify that heroku is spinning up recommendable? |
Heroku uses Redis To Go. Unless you set up your Redis instance as per their instructions, there's essentially no Redis connection: http://blog.redistogo.com/2010/07/26/resque-with-redis-to-go/ |
I've setup RedisToGo and have it configured. I didn't know how to check the status of recommendable to see if there is anything in the queue it is trying to consume. |
Could you gist your recommendable initializer? |
https://gist.github.com/1821282 The REDIS_TOGO Env variable is setup on heroku using:
with the URL being what I get from the redistogo details. |
What is the result of $ heroku console Recommendable.redis.inspect
$ heroku console Resque.inspect |
|
Check the queue size: $ heroku console
>> Resque.size(:recommendable) |
Looks like they are queued, but not being consumed. |
Hot. My guess is it may have something to do with Heroku's naming of their rake tasks. The link I pasted above had this code block: require 'resque/tasks'
task "resque:setup" => :environment do
ENV['QUEUE'] = '*'
end
desc "Alias for resque:work (To run workers on Heroku)"
task "jobs:work" => "resque:work" It looks like you have to do that alias. This block should go in |
Edited
|
So out of curiousity I attempted to run
which is in the same tutorial, but higher up. When executing to check on my queue, I am now down to 5. However, that command is obviously not returning and isn't a long term solution. Let me see if it completes and returns. |
Is your Procfile configured correctly to automatically call this command upon boot? The following line should be in there: worker: QUEUE=recommendable [bundle exec] rake resque:work (bundle exec may or may not be needed depending on your configuration) |
I'm on the bamboo stack, not the cedar stack. Looks like I probably need to roll over. So I will go ahead and update. Let you know what happens after. |
I have rolled everything over to the Cedar stack. Still having the same issue. It looks like the queue is getting filled, but nothing is grabbing them. I have attempted to modify my procfile from both:
and
EDIT: Heroku definitely sees the procfile and worker... Console says the following:
|
what about |
Upon running |
Emptied the queue? Like, your queue is just fuggin' gone (I'm so sorry), or the jobs got processed? |
Before executing
Jobs, look processed... But it still doesn't look like I have recommendations. |
Assuming your model is User, and the current_user has an ID of one, can you tell me what the following returns: $ heroku console
>> Recommendable.redis.zcard "User:1:similarities" |
|
Recommendable.redis.zrangebyscore("User:1:similarities", -1, 1).map do |user|
Recommendable.redis.zscore "User:1:similarities", user
end Also, what version of Recommendable are you using? |
version 0.1.4 |
Looks like the similarity values are, indeed, not being calculated correctly. I'll look into this. |
Word. Thanks. |
However, the recommendations themselves are still generating locally for me, so it's strange that you're getting an empty array. |
Wow. Well, the similarity bug is extremely obvious now that I see it. Still unsure of your empty recommendations array, though. Let me patch this up and we'll see if that, for some reason, fixes that for you. |
Update to 0.1.5 and let me know if your problem persists. Please, please, please read the CHANGELOG, though. There's a migration you'll need to run. Also, keep in mind that Recommendable isn't going to work well with the Nano (smallest) Redis To Go instance. You'll need, at the least, the 20 MB Mini instance. Nano is not persistent. |
Did Recommendable work with Nano before version 0.1.5? |
|
I don't suppose you can run those COUNT(*) selects manually from a DB console on heroku? |
You sure can On Mon, Mar 19, 2012 at 2:59 PM, David Celis <
|
|
that looks good... |
Sorry for the delay in responding, got called into another project. Permanent redis plan, and recommendations are generating fine locally. |
@Kelend, are you using PostgreSQL locally as well, or just on Heroku? |
@davidcelis locally is sqlite, mysql works fine too, I've been having issues getting postgreSQL set up on my local environment |
Interesting. I'm going to go ahead and set up a new app using PostgreSQL as the database and see what happens. It could very well be some sort of incompatibility between the queries I've written and postgres; this would explain the Heroku problems. I'll let you know how that goes. |
Sorry for not responding sooner. First time I have been able to work back on this project. After setting up redis and a redis front end, I see the same error as @Kelend
Obviously mine is on restaurants. Any fix for this? This is running locally on sqlite3 |
note: When I issue the command, |
No fix for this yet because I have no idea why the error comes up. It happens for me only through Resque now, and anything in the console works. I'm stumped. I've verified that my resque worker is loading the environment correctly, so it shouldn't be getting uninitialized constants. |
Its working locally for me with the mysql2 adapter, broke using sqlite3 & pg with the same uninitialized constant error |
@davidcelis Are you using mysql locally? If so, if you change to sqlite what happens? |
Oh shit. I was also switching between PSQL and SQLite. I'll try MySQL later tonight. |
Solved the uninitialized constant for me by modifying acts_as_recommendable.rb I can get this to process update_recommendations on sqlite3, mysql, and postgres(on heroku) I'm still having an issue with getting it to process in the background through Resque, but I think thats a seperate issue (my jobs aren't getting persisted into Redis) |
@Kelend: ❤️ Would you mind opening a separate issue for that if you think it's related to Recommendable? You've seemed to solve this, and your current issue doesn't sound related to the UninitializedConstant. Pushing up a fix to this horrible, horrible error now. |
Are you going to bundle this into 0.1.7 and push? Want to check out this awesomeness. |
It's a shitty enough bug that I could and probably should. I was hoping to switch the app over to using Sidekiq instead of Resque, however, so if you'd give me a bit of time to do that first, you can instead point your Gemfile to the git repo instead of then. The change to using Sidekiq has been several weeks coming, as Resque is barely maintained anymore. |
@bhardin Done. Make sure to check the changelog and edit your initializer as needed. Resque is gone, and Sidekiq is here to stay. |
So, it is now only using Sidekiq and Resque no longer? The initalizer needs to change. Correct? I saw from your previous message that it was going to take a while to change over to Sidekiq. Is this no longer the case? Can you give an example of what the initializer needs to look now? |
I was able to handle the initializer scripts for the app to kick off. I am now having a challenge running: It looks like it is trying to startup a local redis server instead of using the server I specified.
|
The new templated initializer can be found here: https://github.com/davidcelis/recommendable/blob/master/lib/generators/recommendable/templates/initializer.rb There is a commented out block to configure the Redis connection that Sidekiq will use. It assumes localhost:6379 unless specified, or unless REDISTOGO_URL is specified for Heroku. |
unfortunately, I just had to revert the commit with Sidekiq included, at least for now. I failed to realize that the license was GPL and I would rather not have to license Recommendable under the GPL due to a GPL dependency. Sorry for this brief confusion, but it's back to Resque. |
No problem. Totally understand the licensing dealo. Will revert back to resque. |
Hi there, Sorry to bother but I can't figure out how to make .recommendations work in my local environment. It keeps returning []. I've forked the project and added the foreign keys in acts_as_recommendable.rb just like blackgold9 said but it still won't work ! Did I forget something ? |
@romaind Are you using the most up-to-date version of Recommendable? Or pointing at the github repo? |
I'm pointing at the github repo in my Gemfile |
@romaind Please open up a new issue on here and describe the problem. Any code/errors you're getting will be helpful. Thanks! |
Whenever I call, current_user.recommendations, I always receive a blank list.
The text was updated successfully, but these errors were encountered: