Commits on Source (2)
-
David Douard authored
When executing a `swh db init` command, the executed sql files for the package may fail, but the 'swh db' tool would eat the error reported by sqlsh. Make these errors shown as output of the process if such an error occurred. e.g.: $ swh db init test:fail Error during database setup Command '['psql', '--quiet', '--no-psqlrc', '-v', 'ON_ERROR_STOP=1', '-d', 'postgresql://postgres@127.0.0.1:24370/tests', '-f', '/venv/swh-environment/swh-core/swh/core/db/tests/data/test/fail/sql/40-funcs.sql']' returned non-zero exit status 3. Process output: psql:/venv/swh-environment/swh-core/swh/core/db/tests/data/test/fail/sql/40-funcs.sql:6: ERROR: function public.digest(text, unknown) does not exist LINE 5: select encode(public.digest($1, 'sha1'), 'hex') ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. Aborted!
7fd221da -
Antoine Lambert authored
Add a new enable_requests_retry flag to the swh.core.api.RPCClient class, default to False, allowing to retry requests sent by the client when encountering specific errors. Default policy is to retry when connection errors and transient remote exceptions are raised. Subclasses can change that policy by overriding the retry_policy method. Such failed requests will be retry at most five times with a delay of 10 seconds between each.
ce0d4b72
Showing
- swh/core/api/__init__.py 41 additions, 1 deletionswh/core/api/__init__.py
- swh/core/api/tests/test_rpc_client.py 29 additions, 4 deletionsswh/core/api/tests/test_rpc_client.py
- swh/core/cli/db.py 12 additions, 3 deletionsswh/core/cli/db.py
- swh/core/db/tests/data/README 3 additions, 0 deletionsswh/core/db/tests/data/README
- swh/core/db/tests/data/test/fail/__init__.py 0 additions, 0 deletionsswh/core/db/tests/data/test/fail/__init__.py
- swh/core/db/tests/data/test/fail/sql/30-schema.sql 6 additions, 0 deletionsswh/core/db/tests/data/test/fail/sql/30-schema.sql
- swh/core/db/tests/data/test/fail/sql/40-funcs.sql 6 additions, 0 deletionsswh/core/db/tests/data/test/fail/sql/40-funcs.sql
- swh/core/db/tests/test_cli.py 26 additions, 7 deletionsswh/core/db/tests/test_cli.py
swh/core/cli/db.py
100755 → 100644
swh/core/db/tests/data/test/fail/__init__.py
0 → 100644