-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fixes for end to end working between Oppia and Oppia-ml. #3824
Conversation
core/controllers/classifier.py
Outdated
signature = self.payload.get('signature') | ||
message = self.payload.get('message') | ||
vm_id = self.payload.get('vm_id') | ||
payload = json.loads(self.request.body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@seanlip when using requests
module to make request, self.payload
does not get initialized by GAE. Therefore I have to do it manually here. Do you have some idea, why it is like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the initialization of self.payload happens in core.controllers.base (at the bottom of __init__
). Maybe the request dict doesn't pack everything into a payload like we do for the Oppia client/server communication? If not, it probably should...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know that. Let me check how to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed this.
core/controllers/classifier.py
Outdated
@@ -133,11 +135,11 @@ class NextJobHandler(base.BaseHandler): | |||
REQUIRE_PAYLOAD_CSRF_CHECK = False | |||
|
|||
@acl_decorators.open_access | |||
def post(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was meant to be GET
. How did we miss this? The Oppia-ml Extension describes this as a GET method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think if it changes status of models in backend, it should be a POST...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted to POST. I'll change Oppia-ml Extension accordingly.
core/controllers/classifier.py
Outdated
signature = self.payload.get('signature') | ||
message = self.payload.get('message') | ||
vm_id = self.payload.get('vm_id') | ||
payload = json.loads(self.request.body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the initialization of self.payload happens in core.controllers.base (at the bottom of __init__
). Maybe the request dict doesn't pack everything into a payload like we do for the Oppia client/server communication? If not, it probably should...
core/controllers/classifier_test.py
Outdated
self.payload, expect_errors=False, | ||
expected_status_int=200) | ||
json_response = self.get_json( | ||
'/ml/nextjobhandler', self.payload, expect_errors=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why no check on status_int?
core/controllers/classifier.py
Outdated
@@ -133,11 +135,11 @@ class NextJobHandler(base.BaseHandler): | |||
REQUIRE_PAYLOAD_CSRF_CHECK = False | |||
|
|||
@acl_decorators.open_access | |||
def post(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think if it changes status of models in backend, it should be a POST...
Codecov Report
@@ Coverage Diff @@
## develop #3824 +/- ##
===========================================
+ Coverage 46.01% 46.01% +<.01%
===========================================
Files 279 279
Lines 20906 20907 +1
Branches 3278 3278
===========================================
+ Hits 9619 9620 +1
Misses 11287 11287
Continue to review full report at Codecov.
|
@seanlip as per my recent commit, no change is needed on Oppia side. We can discard this PR or merge it (it also adds a test exploration for code classifier end to end testing which may be useful to us in future). |
OK, sounds good. Happy either way; your choice. Please ask @anmolshkl to review as I will be travelling -- thanks! |
core/controllers/classifier_test.py
Outdated
self.payload, expect_errors=False, | ||
expected_status_int=200) | ||
json_response = self.post_json( | ||
r'/ml/nextjobhandler', self.payload, expect_errors=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why raw string literals here and on line 176 but not at other places?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad. It really does not matter whether we use raw strings or not. We can keep it or remove it, your call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prasanna08 let's not block on this. You pick. Just be consistent within these tests and with other tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
core/controllers/classifier_test.py
Outdated
self.payload, expect_errors=False, | ||
expected_status_int=200) | ||
json_response = self.post_json( | ||
'/ml/nextjobhandler', self.payload, expect_errors=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we getting rid of expected_status_int, here and below? Please check the diff to verify that the changes are exactly what you want them to be, and no more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, my bad. When I changed POST to GET I removed them and forgot to add them back. I will add them.
core/controllers/classifier.py
Outdated
@@ -99,6 +99,7 @@ def post(self): | |||
signature = self.payload.get('signature') | |||
message = self.payload.get('message') | |||
vm_id = self.payload.get('vm_id') | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove if this isn't an intentional part of the PR (make sure to check the diff on GitHub).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@seanlip I've also pushed some fixes in CodeReplPredictionService. It was raising exception because @seanlip @anmolshkl @AllanYangZhou with this last commit entire Oppia => Oppia-ml => prediction service workflow is working. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prasanna08 LGTM!
…t-m2 * upstream/develop: (27 commits) Fixes 3687: batch call for exploration and exploration rights object together. (oppia#3815) Fix part oppia#3400 Objective field directive (oppia#3740) Fix oppia#3800 Dropdown menu of the ABOUT in navigation bar (oppia#3855) Fix oppia#3295 Save draft change list to local storage. (oppia#3584) Disable learner dashboard feedback updates send button when no text entered. (oppia#3860) Disable save button while uploading audio to server; add Spanish support to audio languages; add audio loading message to learner view (oppia#3856) Fix oppia#3834: Introduce backend event models to record statistics (oppia#3841) Fix oppia#3852: Fix failing e2e test in develop (oppia#3853) Fix oppia#3826: Move validatorsService from app.js to ValidatorsService.js (oppia#3847) Update the max RAND limit for ID generation to fit within 32 bits. (oppia#3843) Fix oppia#3404: Add default placeholder text for mobile devices (oppia#3845) Fix oppia#2553: Change the "index all explorations" job in the admin dashb… (oppia#3831) Add I18N to give up button; change tooltip text. (oppia#3844) Fix oppia#3721: Update the release_info script to use LCA and the most recent release tag in order to compile the list of changes, rather than relying on git describe. (oppia#3838) show_warning_only_on_button_click (oppia#3833) Deprecate splash page experiment (oppia#3829) Fixes for end to end working between Oppia and Oppia-ml. (oppia#3824) Fix 'Empty path passed in method' error on the collection page. (oppia#3827) Learner dashboard 3.2 (oppia#3759) 📝 Fix oppia#3789 :Space out the profile drop down icons (oppia#3789). (oppia#3817) ...
This PR introduces some fixes that we missed during implementing communication interface between Oppia and Oppia-ml