120 update openapi python client, fix vulnerabilities, update PTB to version 5#139
120 update openapi python client, fix vulnerabilities, update PTB to version 5#139
Conversation
| env: | ||
| SAAS_HOST: ${{ secrets.INTEGRATION_TEAM_SAAS_STAGING_HOST }} | ||
| SAAS_ACCOUNT_ID: ${{ secrets.INTEGRATION_TEAM_SAAS_STAGING_ACCOUNT_ID }} | ||
| SAAS_PAT: ${{ secrets.INTEGRATION_TEAM_SAAS_STAGING_PAT }} | ||
| PROJECT_SHORT_TAG: SAPIPY |
| @@ -4,21 +4,24 @@ on: | |||
| workflow_call: | |||
There was a problem hiding this comment.
The workflows are mainly generated by PTB, but updated in a few places, which are commented.
Manual updated were required mainly for
- Add secrets for accessing SaaS instances
- Re- integrate the slow tests, which were marked with
pytest.mark.slowbefore
| env: | ||
| SAAS_HOST: ${{ secrets.INTEGRATION_TEAM_SAAS_STAGING_HOST }} | ||
| SAAS_ACCOUNT_ID: ${{ secrets.INTEGRATION_TEAM_SAAS_STAGING_ACCOUNT_ID }} | ||
| SAAS_PAT: ${{ secrets.INTEGRATION_TEAM_SAAS_STAGING_PAT }} | ||
| PROJECT_SHORT_TAG: SAPIPY |
| @@ -1,16 +1,13 @@ | |||
| from __future__ import annotations | |||
|
|
|||
There was a problem hiding this comment.
Main changes in this file are for handling results of type ApiError, which are new in version 0.26
of openapi-python-client.
Our updated implementation now raises an exception of type OpenApiError.
exasol/saas/client/api_access.py
Outdated
| wait_fixed, | ||
| ) | ||
|
|
||
| import exasol.saas.client.openapi.models as openapi_models |
There was a problem hiding this comment.
The linter coming with PTB version 5 does no longer accept
from exasol.saas.client import openapi
openapi.models.CreateDatabaseInitialCluster(...)There was a problem hiding this comment.
I think, we saw something similar in another project; the linter requires explicit exports if you want to import things. The explicit export can be happen by definition or by __all__
| try: | ||
| return still_exists() | ||
| except (TryAgain, RetryError) as ex: | ||
| raise DatabaseDeleteTimeout from ex |
There was a problem hiding this comment.
I guess the main reason for this change is that you can chain the original exception
There was a problem hiding this comment.
Yes, correct. Actually, I am not 100% happy with the overall result.
I wanted to distinguish the following scenarios
- The operation terminated successfully
- An unexpected error happend: Should be detected and signaled ASAP without retry
- If specific conditions are met: retry!
- In rare use cases: ignore potential errors, in particular when deleting a database instance
Additionally I wanted to wrap unexpected errors and exceptions as well as too
many retries in an exception of a common type.
All this felt hard to me and often interfered with
- tenacity API
- the partially unknown behavior of the SaaS API
- the wrapping code generated by open-api-client
I often encountered the question
- Can a particular operation raise an exception?
- In general probably: yes
- Will it return a HTTP response?
- How to map the response attributes to the scenarios described above, then?
- Is the result of an API call of type ApiError?
- Needs to be mapped to the scenarios described above, too.
There was a problem hiding this comment.
hm, the file name is a bit weird. I know it is possible with pytest, but all other places use test_*
There was a problem hiding this comment.
Yes, pytest supports prefix test_ as well as suffix _test.py.
Bucketfs-python is inconsistent, as well, for example.
I don't have a clear opinion here.
- If working on an implementation, then it makes sense to separate production code from tests using the prefix.
- If opening a specific test, then the common prefix
test_feels redundant, as the test files are in directorytest/anyway. - In notebook-connector, I tried prefixes
itest_andutest_which I found helpful.
I renamed the files in SAPIPY now.
There was a problem hiding this comment.
hm, the file name is a bit weird. I know it is possible with pytest, but all other places use test_*
There was a problem hiding this comment.
I renamed the files in SAPIPY now.
|
exasol/saas/client/api_access.py
Outdated
| if still_exists(): | ||
| raise DatabaseDeleteTimeout | ||
| try: | ||
| return still_exists() |
There was a problem hiding this comment.
| return still_exists() | |
| still_exists() |


This PR closes the following issues
openapi-python-clientapi_access.pyto processApiErrorsnoxconfig.pyneeded to be updatedCloses #120
Closes #141
Closes #140