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

Increase iib_api_timeout, iib_retry_delay and iib_retry_jitter defaul… #416

Merged
merged 1 commit into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ The custom configuration options for the Celery workers are listed below:
[broker_url](https://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-broker_url)
configuration documentation.
* `iib_api_timeout` - the timeout in seconds for HTTP requests to the REST API. This defaults to
`30` seconds.
`60` seconds.
* `iib_api_url` - the URL to the IIB REST API (e.g. `https://iib.domain.local/api/v1/`).
* `iib_aws_s3_bucket_name` - the name of the AWS S3 bucket used to store artifact files like logs
and related_bundles if specified. `iib_request_logs_dir` and `iib_request_related_bundles_dir`
Expand Down Expand Up @@ -349,8 +349,8 @@ The custom configuration options for the Celery workers are listed below:
`30s` (30 seconds).
* `iib_total_attempts` - the total number of attempts to make at trying a function relating to the
container registry before erroring out. This defaults to `5`. It's also used as the max number of attempts to buildah when receiving HTTP 50X errors.
* `iib_retry_delay` - the delay in seconds between retry attempts. It's just used for buildah when receiving HTTP 50X errors. This defaults to `4`.
* `iib_retry_jitter` - the extra seconds to be added on delay between retry attempts. It's just used for buildah when receiving HTTP 50X errors. This defaults to `2`.
* `iib_retry_delay` - the delay in seconds between retry attempts. It's just used for buildah when receiving HTTP 50X errors. This defaults to `5`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we change this setting as well? It mentions buildah retries will be affected with this only

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The buildah retries happen too soon not allowing any network glitch to resolve. Hence I changed this too. Please let me know if I should revert it

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope. I don't mind this change, we can definitely keep it. :)
I wasn't aware that buildah retries also needed to be optimized.

* `iib_retry_jitter` - the extra seconds to be added on delay between retry attempts. It's just used for buildah when receiving HTTP 50X errors. This defaults to `5`.

If you wish to configure AWS S3 bucket for storing artifact files, the following **environment variables**
must be set along with `iib_aws_s3_bucket_name` config variable:
Expand Down
2 changes: 1 addition & 1 deletion iib/workers/api_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_requests_session(auth=False):
mutual_authentication=requests_kerberos.OPTIONAL
)
retry = Retry(
total=3, read=3, connect=3, backoff_factor=1, status_forcelist=(500, 502, 503, 504)
total=3, read=3, connect=3, backoff_factor=3, status_forcelist=(408, 500, 502, 503, 504)
)
adapter = requests.adapters.HTTPAdapter(max_retries=retry)
session.mount('http://', adapter)
Expand Down
6 changes: 3 additions & 3 deletions iib/workers/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Config(object):
# Avoid infinite Celery retries when the broker is offline.
broker_connection_max_retries: int = 10
iib_aws_s3_bucket_name = None
iib_api_timeout = 30
iib_api_timeout = 60
iib_docker_config_template = os.path.join(
os.path.expanduser('~'), '.docker', 'config.json.template'
)
Expand Down Expand Up @@ -43,8 +43,8 @@ class Config(object):
iib_dogpile_arguments = {'url': ['127.0.0.1']}
iib_skopeo_timeout = '300s'
iib_total_attempts: int = 5
iib_retry_delay: int = 4
iib_retry_jitter: int = 2
iib_retry_delay: int = 5
iib_retry_jitter: int = 5
include = [
'iib.workers.tasks.build',
'iib.workers.tasks.build_merge_index_image',
Expand Down
6 changes: 3 additions & 3 deletions tests/test_workers/test_api_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_get_request(mock_session):

api_utils.get_request(3)

mock_session.get.assert_called_once_with('http://iib-api:8080/api/v1/builds/3', timeout=30)
mock_session.get.assert_called_once_with('http://iib-api:8080/api/v1/builds/3', timeout=60)


@mock.patch('iib.workers.api_utils.requests_session')
Expand Down Expand Up @@ -52,7 +52,7 @@ def test_set_omps_operator_version(mock_session):
mock_session.patch.assert_called_once_with(
'http://iib-api:8080/api/v1/builds/3',
json={'omps_operator_version': '{"operator": "1.0.0"}'},
timeout=30,
timeout=60,
)


Expand All @@ -66,7 +66,7 @@ def test_update_request(mock_session):
mock_session.patch.assert_called_once_with(
'http://iib-api:8080/api/v1/builds/3',
json={'index_image': 'index-image:latest'},
timeout=30,
timeout=60,
)


Expand Down