Mjames/sol 174 - #7313
Conversation
025ff00 to
8cbaf76
Compare
076b304 to
a4fa542
Compare
319a920 to
f43ef46
Compare
|
Jenkins test this please |
There was a problem hiding this comment.
I don't think expected is an argument here, seems like return value is bool result of search operation.
ec67d22 to
8e24857
Compare
|
@dino-cikatic; @dsego - Some updates have been made. @e-kolpakov - This should be good to go and includes moving the indexing code out of common and into cms... now that it is triggered by a signal instead of being called directly from within the modulestore code. Update: Looks like a couple of errors got introduced with rebase - but worth having you guys look at it in the meantime |
|
@martynjames overall looks good, but some tests are broken |
a6a516b to
bf4056a
Compare
|
@dino-cikatic, @e-kolpakov - Addressed the problems resulting from rebase, and feedback items. Hoping to see if I can get a thumbs up from either of you to move onto 2nd review phase. If there are any other items you desire me to change/update, please let me know. |
There was a problem hiding this comment.
@martynjames I see what you're doing here, but it took me about 15 minutes before I realized why it is needed and why it still recursively calls index_item for items that are not actually indexed. Might be worth commenting at least.
There was a problem hiding this comment.
added at initialization of indexed_items
1b17a1e to
17ef34d
Compare
|
jenkins test this please |
|
@clintonb & @ormsbee - We've gone through a pretty thorough first-pass review, so I think I'm ready for your input on here (pending passing tests - last time through I had one failure that appears to be happening for others too). This represents the changes for responding to the course_published signal:
|
There was a problem hiding this comment.
Why are we instantiating an indexer object here? It looks like we never actually store associated state with this object (e.g. these are really just class methods)?
There was a problem hiding this comment.
@ormsbee there's a related PR that adds content libraries indexing. It was submitted earlier than this one, but there is an irremovable defect with tests: search indexers used to live in common/lib, which should not depend on any django features - but search indexers implicitly depends on SEARCH_ENGINE setting. So, since this PR significantly changes and improves indexing and fixes that test issue, it was decided #7448 is suspended until this PR is merged.
So, having indexers a classmethods or instance methods was my suggestion to simplify rebasing #7448 on top of this. @martynjames likely chosen instance methods because I used instance methods in #7448 (but he definitely knows better). If it makes any difference, I used instance methods in #7448 because I personally find classes with instance methods induce less coupling between "provider" and "client" code. Static and class methods explicitly mentions implementing class, while instance methods can be called on any class implementing certain inteface, thus allowing swapping implementations easier than with static/class methods.
There was a problem hiding this comment.
I changed them to instance methods because I was under the impression that that is what you required - they were already class methods (given that a static method is really just a class method that does not have a reference to the class object). If no one objects, I'll change them back - class methods would be my preference.
|
jenkins test this please |
There was a problem hiding this comment.
@martynjames what's the reason for converting course_key to unicode here, than reconstructing it from string in the task itself. I'm asking this because I'm about adding another task and signla to index library, and it seems a bit weird to replicate this.
There was a problem hiding this comment.
Good question, and I have a good answer - this is the point at which the remoting to the celery process happens. Unfortunately, if you are running inline everything works just fine, but on a real call (async celery process) the arguments here need to be serialized to JSON and course_key is not serializable; but a string is!
There was a problem hiding this comment.
@martynjames thank you for clarification - actually I suspected something like this, but decided it would be better to ask if that's true.
There was a problem hiding this comment.
@martynjames actually, there might be another problem. I've just uploaded my #7641 to sandbox and it fails here:
Sent course_published signal to <function listen_for_course_publish at 0x4951c08> with kwargs {'course_key': CourseLocator(u'Arbi', u'101', u'2015', None, None)}. Response was: datetime.datetime(2015, 4, 9, 16, 13, 55, 457562, tzinfo=<UTC>) is not JSON serializable
In two words, datetime objects are not json-serializable as well (not sure if it applies to all python versions though). So it might need to be converted to unicode and parsed back.
There was a problem hiding this comment.
Thank you - I will address immediately
|
@clintonb - didn't know if you had anything else to add here? |
|
@martynjames I've been out of the loop a bit too long with vacation and Q4 planning. Please move forward without me. |
|
Thanks @clintonb! |
0af2255 to
b65a36e
Compare
|
@ormsbee - hoping to see if you are ready for thumbs up on this one... |
|
@ormsbee - I made the changes that we discussed yesterday. Test run has passed - thanks! |
|
👍 -- please just squash the commits |
87435d4 to
92215e4
Compare
|
@ormsbee, @BenjiLee, @mattdrayer - Had to make a small tweak to one file - import problem shows up when workers startup with the error - If you guys can quickly review the last change I would appreciate it Example error in celery process startup: |
|
If referring to ae172b4, that change should be fine as thats the only place |
|
Yes, thanks @BenjiLee - can I assume that's a +1? |
|
👍 |
…or full course reindex. Indexing code no longer needs to be in common, because it is triggered by signal instead of being called.g
ae172b4 to
e37a98d
Compare
|
👍 |
|
@martynjames Could you do a course rerun to verify that |
|
@BenjiLee - Luckily I had a sandbox ready.... re-run appeared to work just fine - in particular, the videos appeared to still be present within the rerun course |
|
LGTM 👍 |
SOL-174 - Indexing within celery task
@dino-cikatic - can you do a first-pass review for these changes
@dsego - It would be nice if you can review too - but seeing as you performed some of the code, you can't be the official reviewer