-
Notifications
You must be signed in to change notification settings - Fork 96
Place upper limit on tas user validation, remove selected identity notion #639
Conversation
55fbfdf
to
3a8f9a1
Compare
a1c851d
to
cd6aef3
Compare
bf68037
to
802f35d
Compare
802f35d
to
3a581a8
Compare
Thanks @cdosborn! I'd like to dig through this a bit more. |
705c968
to
5f291b9
Compare
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.
@cdosborn Can you help me understand this one?
ea53272#diff-3f7bc33e5a66a692d2e802229596243dL184
Otherwise looks good. 👍
jetstream/tas_api.py
Outdated
@@ -16,7 +16,8 @@ def tacc_api_post(url, post_data, username=None, password=None): | |||
# logger.debug("REQ BODY: %s" % post_data) | |||
resp = requests.post( | |||
url, post_data, | |||
auth=(username, password)) | |||
auth=(username, password), | |||
timeout=5) |
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'm worried that one day we will have to modify this in production in a hurry. Can we make this a setting with a default of 5 seconds?
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.
Yeah i'll add that
core/models/user.py
Outdated
@@ -181,7 +181,7 @@ def email_hash(self): | |||
# Save Hooks Here: | |||
|
|||
|
|||
def get_or_create_user_profile(sender, instance, created, **kwargs): |
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.
Huh. What's going on here?
Just going to push this into the next release |
@julianpistorius i'm tacking on some tests in a short bit |
938ee0b
to
56058f2
Compare
@julianpistorius This is being blocked by cyverse/clank#277, once that is 👍 the travis build should greenlight. |
56058f2
to
73ae1bf
Compare
The tas api averages about 500ms, but occasionally goes to 3,5,10 sec. This upperbound is to limit how long api/v1/profile will take in the worst case.
Creating new accounts and validation of the user occurred in a side effect of the selcted_identity field of a serializer. These calls need to be made, but should be more explicit. A selected_idenity is a relic from a time before. An important side effect here is that PATCHs no longer create accounts or check if the user is valid, greatly reducing the time to update a user's profile. In addition, create_new_accounts shouldn't check whether it should actually do its job, by calling user.is_valid first.
This is implementing what was mentioned in a TODO comment
dc64bc9
to
943d9b4
Compare
Description
This changeset places an upper limit on the tas api calls (5sec, in practice the average is about 0.6s), removes all references to selected identities, and makes the user validation and account creation explicit in api/v1/profile (originally the purview of select identity logic)
User validation and account creation happen as a side effect of the serialization of a user's "selected identity" in the api/v1/profile endpoint. Atmosphere used to have the notion of a selected identity for each user. A user's actions would occur against the cloud pointed to by their selected identity. In the frontend, the user would first select a cloud, before they could perform actions against it. All references to a selected identity are vestigial. In jetstream we discovered that changing a user's profile would sometimes take 10-15s, this occurred because the serialization of the selected_identity was checking if the user was valid by querying out to the TAS API. After checking that the user was valid, the service would make sure that the user had identities on all providers where they were permitted.
Depends on cyverse/clank#277
Checklist before merging Pull Requests