-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix: Can't use curl to download a single manifest in one invocation (#5918) #6099
base: develop
Are you sure you want to change the base?
Conversation
8b62dbc
to
830a1e4
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6099 +/- ##
===========================================
- Coverage 85.38% 85.36% -0.02%
===========================================
Files 155 155
Lines 20735 20773 +38
===========================================
+ Hits 17704 17733 +29
- Misses 3031 3040 +9 ☔ View full report in Codecov by Sentry. |
da860a5
to
b81d052
Compare
9fb4dbb
to
391cedb
Compare
Successful use of curl to download a manifest in one invocation: (Unabridged version: 6099_manifest_invocation_unabridged.txt)
|
lambdas/service/app.py
Outdated
@@ -1273,14 +1273,16 @@ def get_summary(): | |||
authentication=request.authentication) | |||
|
|||
|
|||
def manifest_route(*, fetch: bool, initiate: bool): | |||
def manifest_route(*, fetch: bool, method: str): | |||
initiate = method in ['PUT', 'POST'] |
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.
initiate = method in ['PUT', 'POST'] | |
initiate = method in {'PUT', 'POST'} |
lambdas/service/app.py
Outdated
def fetch_file_manifest_with_token(token: str): | ||
return _file_manifest(fetch=True, token_or_key=token) | ||
|
||
|
||
def _file_manifest(fetch: bool, token_or_key: Optional[str] = None): | ||
request = app.current_request | ||
require(request.method != 'POST' or request.raw_body.decode() == '', |
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.
This is the same as
require(request.method != 'POST' or request.raw_body.decode() == '', | |
require(request.method != 'POST' or request.raw_body == b'', |
Right?
Added #6003 as a blocker due to overlapping changes to the IT |
600eb8b
to
81a4905
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.
Looks good but needs rebase
81a4905
to
ff39020
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.
7ef53d5
to
465414d
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.
Please push the commits individually.
src/azul/chalice.py
Outdated
@@ -617,3 +618,25 @@ def lambda_context(self) -> LambdaContext: | |||
@property | |||
def current_request(self) -> AzulRequest: | |||
return self.app.current_request | |||
|
|||
def server_side_sleep(self, max_seconds: int | float) -> float: |
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.
def server_side_sleep(self, max_seconds: int | float) -> float: | |
def server_side_sleep(self, max_seconds: float) -> float: |
Time in Python is always a float. Supporting int
may seem like a convenience but just leads to sloppy use of this function.
|
||
:return: The actual amount of time slept in seconds | ||
""" | ||
remaining_time = self.lambda_context.get_remaining_time_in_millis() / 1000 |
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.
Add validation of type and range of the argument.
retry_after = body.get('Retry-After') | ||
if retry_after is not None: | ||
time_slept = self.server_side_sleep(retry_after) | ||
body['Retry-After'] = round(retry_after - time_slept) |
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.
body['Retry-After'] = round(retry_after - time_slept) | |
body['Retry-After'] = ceil(retry_after - time_slept) |
if wait is None: | ||
azul_url.args['wait'] = '0' |
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.
This indicates that Azul now yields a URL with wait
set to the default. I'd prefer not to do that.
de14d18
to
db304df
Compare
ec5f5cc
to
cb02ca7
Compare
@@ -263,7 +266,7 @@ def download_file(self, | |||
pass | |||
elif wait == '1': | |||
time_slept = self.server_side_sleep(float(retry_after)) | |||
retry_after = round(retry_after - time_slept) | |||
retry_after = ceil(retry_after - time_slept) |
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.
The change from round
to ceil
is currently in a commit labeled "Add a default value for the /repository/files wait parameter". Please explain why going from round
to ceil
is related to adding a default or isolate that change in its own commit.
as a property of a JSON object in the body of the request. This can be | ||
useful in case the value of the `filters` query parameter causes the URL | ||
to exceed the maximum length of 8192 characters, resulting in a 413 | ||
Request Entity Too Large response. | ||
as a property of a JSON object in the body of the request. This is | ||
referred to as *parameter hoisting* and can be useful in case the value | ||
of the `filters` query parameter causes the URL to exceed the maximum | ||
length of 8192 characters, resulting in a 413 Request Entity Too Large | ||
response. | ||
|
||
The request `%s %s?filters={…}`, for example, is equivalent to `%s %s` | ||
with the body `{"filters": "{…}"}` in which any double quotes or | ||
backslash characters inside `…` are escaped with another backslash. That | ||
escaping is the requisite procedure for embedding one JSON structure | ||
inside another. | ||
with a `Content-Type` header of `application/json` and the body | ||
`{"filters": "{…}"}` in which any double quotes or backslash characters | ||
inside `…` are escaped with another backslash. That escaping is the | ||
requisite procedure for embedding one JSON structure inside another. |
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.
Correct me if I am wrong but it seems like these two hunks are unrelated documentation improvement that I requested at some point, but that have nothing to do with "Add[ing] support for POST requests to the manifest endpoint", as is the title of the commit the hunks are part of.
Fixes regression from fb58b01. The problem manifested as an error with the `app` property in an AppController subclass, and this wasn't noticed until now due to the `app` property not being accessed in a controller that had this problem, namely ManifestController.
…vocation (#5918) Add support for POST requests to the manifest endpoint
…vocation (#5918) Add a wait parameter option to the manifest endpoint
cb02ca7
to
f1a03b6
Compare
Connected issues: #5918
Checklist
Author
develop
issues/<GitHub handle of author>/<issue#>-<slug>
1 when the issue title describes a problem, the corresponding PR
title is
Fix:
followed by the issue titleAuthor (partiality)
p
tag to titles of partial commitspartial
or completely resolves all connected issuespartial
labelAuthor (chains)
base
or this PR is not chained to another PRchained
or is not chained to another PRAuthor (reindex, API changes)
r
tag to commit title or the changes introduced by this PR will not require reindexing of any deploymentreindex:dev
or the changes introduced by it will not require reindexing ofdev
reindex:anvildev
or the changes introduced by it will not require reindexing ofanvildev
reindex:anvilprod
or the changes introduced by it will not require reindexing ofanvilprod
reindex:prod
or the changes introduced by it will not require reindexing ofprod
reindex:partial
and its description documents the specific reindexing procedure fordev
,anvildev
,anvilprod
andprod
or requires a full reindex or carries none of the labelsreindex:dev
,reindex:anvildev
,reindex:anvilprod
andreindex:prod
API
or this PR does not modify a REST APIa
(A
) tag to commit title for backwards (in)compatible changes or this PR does not modify a REST APIapp.py
or this PR does not modify a REST APIAuthor (upgrading deployments)
make image_manifests.json
and committed the resulting changes or this PR does not modifyazul_docker_images
, or any other variables referenced in the definition of that variableu
tag to commit title or this PR does not require upgrading deploymentsupgrade
or does not require upgrading deploymentsdeploy:shared
or does not modifyimage_manifests.json
, and does not require deploying theshared
component for any other reasondeploy:gitlab
or does not require deploying thegitlab
componentdeploy:runner
or does not require deploying therunner
imageAuthor (hotfixes)
F
tag to main commit title or this PR does not include permanent fix for a temporary hotfixanvilprod
andprod
) have temporary hotfixes for any of the issues connected to this PRAuthor (before every review)
develop
, squashed old fixupsmake requirements_update
or this PR does not modifyrequirements*.txt
,common.mk
,Makefile
andDockerfile
R
tag to commit title or this PR does not modifyrequirements*.txt
reqs
or does not modifyrequirements*.txt
make integration_test
passes in personal deployment or this PR does not modify functionality that could affect the IT outcomePeer reviewer (after approval)
System administrator (after approval)
demo
orno demo
no demo
no sandbox
N reviews
label is accurateOperator (before pushing merge the commit)
reindex:…
labels andr
commit title tagno demo
develop
_select dev.shared && CI_COMMIT_REF_NAME=develop make -C terraform/shared apply_keep_unused
or this PR is not labeleddeploy:shared
_select dev.gitlab && CI_COMMIT_REF_NAME=develop make -C terraform/gitlab apply
or this PR is not labeleddeploy:gitlab
_select anvildev.shared && CI_COMMIT_REF_NAME=develop make -C terraform/shared apply_keep_unused
or this PR is not labeleddeploy:shared
_select anvildev.gitlab && CI_COMMIT_REF_NAME=develop make -C terraform/gitlab apply
or this PR is not labeleddeploy:gitlab
deploy:gitlab
deploy:gitlab
System administrator
dev.gitlab
are complete or this PR is not labeleddeploy:gitlab
anvildev.gitlab
are complete or this PR is not labeleddeploy:gitlab
Operator (before pushing merge the commit)
_select dev.gitlab && make -C terraform/gitlab/runner
or this PR is not labeleddeploy:runner
_select anvildev.gitlab && make -C terraform/gitlab/runner
or this PR is not labeleddeploy:runner
sandbox
label or PR is labeledno sandbox
dev
or PR is labeledno sandbox
anvildev
or PR is labeledno sandbox
sandbox
deployment or PR is labeledno sandbox
anvilbox
deployment or PR is labeledno sandbox
sandbox
deployment or PR is labeledno sandbox
anvilbox
deployment or PR is labeledno sandbox
sandbox
or this PR does not remove catalogs or otherwise causes unreferenced indices indev
anvilbox
or this PR does not remove catalogs or otherwise causes unreferenced indices inanvildev
sandbox
or this PR is not labeledreindex:dev
anvilbox
or this PR is not labeledreindex:anvildev
sandbox
or this PR is not labeledreindex:dev
anvilbox
or this PR is not labeledreindex:anvildev
p
if the PR is also labeledpartial
Operator (chain shortening)
develop
or this PR is not labeledbase
chained
label from the blocked PR or this PR is not labeledbase
base
base
label from this PR or this PR is not labeledbase
Operator (after pushing the merge commit)
dev
anvildev
dev
dev
anvildev
anvildev
_select dev.shared && make -C terraform/shared apply
or this PR is not labeleddeploy:shared
_select anvildev.shared && make -C terraform/shared apply
or this PR is not labeleddeploy:shared
dev
anvildev
Operator (reindex)
dev
or this PR is neither labeledreindex:partial
norreindex:dev
anvildev
or this PR is neither labeledreindex:partial
norreindex:anvildev
dev
or this PR is neither labeledreindex:partial
norreindex:dev
anvildev
or this PR is neither labeledreindex:partial
norreindex:anvildev
dev
or this PR is neither labeledreindex:partial
norreindex:dev
anvildev
or this PR is neither labeledreindex:partial
norreindex:anvildev
dev
or this PR does not require reindexingdev
anvildev
or this PR does not require reindexinganvildev
dev
or this PR does not require reindexingdev
anvildev
or this PR does not require reindexinganvildev
dev
or this PR does not require reindexingdev
anvildev
or this PR does not require reindexinganvildev
Operator
deploy:shared
,deploy:gitlab
,deploy:runner
,reindex:partial
,reindex:anvilprod
andreindex:prod
labels to the next promotion PRs or this PR carries none of these labelsdeploy:shared
,deploy:gitlab
,deploy:runner
,reindex:partial
,reindex:anvilprod
andreindex:prod
labels, from the description of this PR to that of the next promotion PRs or this PR carries none of these labelsShorthand for review comments
L
line is too longW
line wrapping is wrongQ
bad quotesF
other formatting problem