CRAYSAT-1604: Add configurable retries #103
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
sat status
locally with an authenticated session to ensure normal usage was working.sat status
. I verified that it was not possible to add retries in this case.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.sat bootprep
to create images, configurations and session templates on an internal system.Pull Request Checklist