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

storageService: add new query timeout #1170

Merged
merged 1 commit into from
Jul 5, 2018
Merged

Conversation

sevein
Copy link
Member

@sevein sevein commented Jun 28, 2018

This is in addition to the existing client timeout that already exists in the
storageService module. This new timeout is used in requests that we know they
should be processed immediately.

This is connected to #1133.

@sevein sevein added this to the 1.8.0 milestone Jun 28, 2018
@sevein sevein self-assigned this Jun 28, 2018
@sevein sevein added the Status: in progress Issue that is currently being worked on. Waffle label. label Jun 28, 2018
@sevein
Copy link
Member Author

sevein commented Jun 28, 2018

I think I need to review the client module again because I'm not entirely sure that the new timeout setting is used in all places where we could be taking advantage of it.

@qubot qubot force-pushed the dev/issue-1133-ss-quick-timeout branch 2 times, most recently from ccb3ff7 to 8f4a666 Compare June 29, 2018 17:52
Copy link
Contributor

@jrwdunham jrwdunham left a comment

Choose a reason for hiding this comment

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

I have some comments, questions and ideas about the function naming and where the quick timeout could be used.

I think maybe the quick timeout session could be used in session = storage_service._storage_api_session() of failedTransferCleanup.py (and failedSIPCleanup.py) because those PATCH requests just update a Package instance in the db.

@@ -249,7 +253,7 @@ def copy_files(source_location, destination_location, files):

url = _storage_service_url() + 'location/' + destination_location['uuid'] + '/async/'
try:
response = _storage_api_session().post(url, json=move_files)
Copy link
Contributor

Choose a reason for hiding this comment

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

Unable to put the comment at line 209, but shouldn't _storage_api_session in wait_for_async be _storage_api_quick_session? That should be a quick response too, no?

@@ -441,7 +446,7 @@ def request_file_deletion(uuid, user_id, user_email, reason_for_deletion):
'user_id': user_id,
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, unable to comment at actual line, but is there a reason not to use _storage_api_quick_session in get_file_info above?

Copy link
Contributor

Choose a reason for hiding this comment

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

As Rich Hickey says, "perception should be free".

Copy link
Contributor

@jrwdunham jrwdunham Jun 29, 2018

Choose a reason for hiding this comment

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

Aw man, get_file_metadata can take a long time because it queries all of the files of a package into memory and json-serializes them. That endpoint needs some pagination desperately. Created artefactual/archivematica-storage-service#389

Copy link
Contributor

@jrwdunham jrwdunham Jun 29, 2018

Choose a reason for hiding this comment

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

My general comment is that _storage_api_session should be the exceptional case and all instances of it should be accompanied by a comment indicating why it is necessary. I think the above comment could be one such code comment.

To take the next nitpicky step given the above, I think the two func names should instead be _storage_api_session and _storage_api_slow_session.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, maybe all instances where the slow session is used do not need to be commented. For some it may be obvious.

@qubot qubot force-pushed the dev/issue-1133-ss-quick-timeout branch from 8f4a666 to 7aa7a1f Compare July 4, 2018 17:36
@sevein sevein added Status: review The issue has been merged and is ready for review. Waffle label. and removed Status: in progress Issue that is currently being worked on. Waffle label. labels Jul 4, 2018
@sevein
Copy link
Member Author

sevein commented Jul 4, 2018

@jrwdunham ok done! _storage_api_slow_session is used in:

  • storageService.create_file
  • storageService.get_file_info
  • storageService.extract_file
  • storageService.request_reingest
  • storageService.post_store_aip_callback
  • storageService.get_file_metadata
  • storageService.remove_files_from_transfer
  • storageService.index_backlogged_transfer_contents
  • storageService.reindex_file

_storage_api_session (the new "quick") is used in:

  • failedSIPCleanup.py
  • failedTransferCleanup.py
  • storageService.create_pipeline
  • storageService.get_pipeline
  • storageService.get_location
  • storageService.browse_location
  • storageService.wait_for_async
  • storageService.copy_files (async)
  • storageService.create_file (non-update branch, async)
  • storageService.request_file_deletion

This is in addition to the existing client timeout that already exists in the
storageService module. This new timeout is used in requests that we know they
should be processed immediately.

Implementation detail: `_storage_api_session` is now used in requests that are
supposed to be processed quickly (including async). A new private function
called `_storage_api_slow_session` is used in those requests that still take
too long which is undesirable but we haven't had the time to fix yet.

This is connected to #1133.
@qubot qubot force-pushed the dev/issue-1133-ss-quick-timeout branch from 7aa7a1f to d5976ad Compare July 5, 2018 18:37
@qubot qubot merged commit d5976ad into qa/1.x Jul 5, 2018
@qubot qubot removed the Status: review The issue has been merged and is ready for review. Waffle label. label Jul 5, 2018
@qubot qubot deleted the dev/issue-1133-ss-quick-timeout branch July 5, 2018 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants