Skip to content
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

Merged
merged 7 commits into from
Aug 30, 2017

Conversation

prasanna08
Copy link
Contributor

This PR introduces some fixes that we missed during implementing communication interface between Oppia and Oppia-ml

signature = self.payload.get('signature')
message = self.payload.get('message')
vm_id = self.payload.get('vm_id')
payload = json.loads(self.request.body)
Copy link
Contributor Author

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?

Copy link
Member

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...

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this.

@@ -133,11 +135,11 @@ class NextJobHandler(base.BaseHandler):
REQUIRE_PAYLOAD_CSRF_CHECK = False

@acl_decorators.open_access
def post(self):
Copy link
Contributor Author

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.

Copy link
Member

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...

Copy link
Contributor Author

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.

signature = self.payload.get('signature')
message = self.payload.get('message')
vm_id = self.payload.get('vm_id')
payload = json.loads(self.request.body)
Copy link
Member

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...

self.payload, expect_errors=False,
expected_status_int=200)
json_response = self.get_json(
'/ml/nextjobhandler', self.payload, expect_errors=False)
Copy link
Member

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?

@@ -133,11 +135,11 @@ class NextJobHandler(base.BaseHandler):
REQUIRE_PAYLOAD_CSRF_CHECK = False

@acl_decorators.open_access
def post(self):
Copy link
Member

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-io
Copy link

codecov-io commented Aug 29, 2017

Codecov Report

Merging #3824 into develop will increase coverage by <.01%.
The diff coverage is 22.22%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ
...interactions/CodeRepl/CodeReplPredictionService.js 53.43% <22.22%> (+0.35%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bc577c6...74027df. Read the comment docs.

@prasanna08
Copy link
Contributor Author

@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).

@seanlip
Copy link
Member

seanlip commented Aug 29, 2017

OK, sounds good. Happy either way; your choice. Please ask @anmolshkl to review as I will be travelling -- thanks!

self.payload, expect_errors=False,
expected_status_int=200)
json_response = self.post_json(
r'/ml/nextjobhandler', self.payload, expect_errors=False)
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Member

@seanlip seanlip Aug 29, 2017

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

self.payload, expect_errors=False,
expected_status_int=200)
json_response = self.post_json(
'/ml/nextjobhandler', self.payload, expect_errors=False)
Copy link
Member

@seanlip seanlip Aug 29, 2017

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.

Copy link
Contributor Author

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.

@@ -99,6 +99,7 @@ def post(self):
signature = self.payload.get('signature')
message = self.payload.get('message')
vm_id = self.payload.get('vm_id')

Copy link
Member

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).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@prasanna08
Copy link
Contributor Author

prasanna08 commented Aug 29, 2017

@seanlip I've also pushed some fixes in CodeReplPredictionService. It was raising exception because this keyword was not working when calling functions defined in same service. So I just defined a variable for the object (which we were returning directly before) and using name of that variable to call functions defined in same object.

@seanlip @anmolshkl @AllanYangZhou with this last commit entire Oppia => Oppia-ml => prediction service workflow is working.

Copy link
Contributor

@anmolshkl anmolshkl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prasanna08 LGTM!

@seanlip seanlip merged commit 135ac4e into oppia:develop Aug 30, 2017
giritheja added a commit to giritheja/oppia that referenced this pull request Sep 17, 2017
…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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants