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

CRAYSAT-1604: Add configurable retries #103

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ekamin-hpe
Copy link
Contributor

Summary and Scope

This commit adds two new options, --api-retries and --api-backoff that control the number of retries and interval between retries. These options can be specified via the config file or on the command line.

To implement these options, the urllib3.util.Retry class is used, which is passed to the requests.Session using an HTTPAdapter class. Retries will only be done for status codes in the 500 range or for network errors, errors like "400 Bad Request" or "403 Forbidden" will not result in any retries.

To ensure that retries are logged, handle log messages from the urllib3 module.

This commit also documents the new command-line and config file options in the main sat(8) man page.

Add a change log entry in a new "Unreleased" section.

Testing

Test Description:

  • I ran sat status locally with an authenticated session to ensure normal usage was working.
  • I temporarily moved my authentication token aside, resulting in 401 Unauthorized errors from the system when running sat status. I verified that it was not possible to add retries in this case.
  • I modified my configuration file to specify an incorrect URL for the system's API gateway, resulting in network-level errors when running sat status. I verified that I was able to change both the number of retries and backoff factor both by using command-line options as well as configuration file options.
  • I ran sat bootprep to create images, configurations and session templates on an internal system.

Pull Request Checklist

  • Version number(s) incremented, if applicable
  • Copyrights updated
  • License file intact
  • Target branch correct
  • CHANGELOG.md updated
  • Testing is appropriate and complete, if applicable
  • HPC Product Announcement prepared, if applicable

This commit adds two new options, `--api-retries` and `--api-backoff`
that control the number of retries and interval between retries. These
options can be specified via the config file or on the command line.

To implement these options, the urllib3.util.Retry class is used, which
is passed to the requests.Session using an HTTPAdapter class. Retries
will only be done for status codes in the 500 range or for network
errors, errors like "400 Bad Request" or "403 Forbidden" will not
result in any retries.

To ensure that retries are logged, handle log messages from the
`urllib3` module.

This commit also documents the new command-line and config file options
in the main sat(8) man page.

Add a change log entry in a new "Unreleased" section.

Test Description:
* I ran `sat status` locally with an authenticated session to ensure
  normal usage was working.
* I temporarily moved my authentication token aside, resulting in
  401 Unauthorized errors from the system when running `sat status`.
  I verified that it was not possible to add retries in this case.
* I modified my configuration file to specify an incorrect URL for
  the system's API gateway, resulting in network-level errors when
  running `sat status`. I verified that I was able to change both
  the number of retries and backoff factor both by using command-line
  options as well as configuration file options.
* I ran `sat bootprep` to create images, configurations and session
  templates on an internal system.
@ekamin-hpe
Copy link
Contributor Author

Note to @jack-stanek-hpe and @haasken-hpe - I think the basics are working but I would like to test this in a bit more detail before merging. It seems as though vshasta may be a viable place to test this more thoroughly.

@ekamin-hpe ekamin-hpe marked this pull request as draft February 1, 2023 21:55
@ekamin-hpe
Copy link
Contributor Author

I'm finding a few issues in testing that I'm still trying to understand. Going to move this back to "draft" mode while I work it out.

@haasken-hpe haasken-hpe changed the base branch from integration to main August 7, 2023 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant