Commit graph

22 commits

Author SHA1 Message Date
Karolina Surma
010ceb6ba5 Avoid the multiprocessing forkserver method
The default method has changed in Python 3.14:
https://docs.python.org/dev/whatsnew/3.14.html#whatsnew314-multiprocessing-start-method
2025-06-16 12:06:34 +02:00
Christian Kellner
809c9e7828 pipeline,api: write metadata directly
Instead of transmitting stage metadata over a socket and then
writing it via `Object.meta.write`, use the latter and bind
mount the corresponding file into the stage so it can directly
be written to from the stage. Change `api.metadata` to do so,
which means that this change is transparent for the stages.
2022-12-09 12:03:40 +01:00
Simon de Vlieger
ea6085fae6 osbuild: run isort on all files 2022-09-12 13:32:51 +02:00
Christian Kellner
f05078f66e global: fix PEP-8 formatting
This patch was generated by running `autopep8 --diff` on the
source tree and then applying the diff.
2022-08-05 09:41:05 +02:00
Christian Kellner
254c1cd9fb api: remove host side arguments facility
Now that arguments are transmitted via a mapped, i.e. bind-mounted,
file instead of using the jsoncomm RPC mechanism, all the methods
related to the latter can be removed from API.
2021-07-08 15:01:33 +01:00
Christian Kellner
82d33a35ae api: remove unused 'monitor' parameter
The monitor parameter, which previously was used for stream logs
to via the output handling of API, is now no longer needed. Thus,
it can be removed.
2021-07-08 15:01:33 +01:00
Christian Kellner
71f7bf8930 test/api: assert return code for api.exception
Check that the exit code for `api.exception`, called via the
`api.exception_handler` helper, is the correct one.
2020-10-09 10:47:44 +02:00
Christian Kellner
aaa51e22a6 api: properly serialize the exception's traceback
Use `traceback.print_tb()` to serialize the exceptions' backtrace.
The previously used expression `str(e.__traceback__)` will just
give `<traceback object at 0x…>`, which is not very helpful.
Add a test to check that the method name that raises the exception,
also called `exception`, is in the traceback.
2020-10-09 10:47:44 +02:00
Christian Kellner
7a112c27cb test/api: fix white-space error
No double space between class methods, so say the scriptures.
2020-10-09 10:47:44 +02:00
Christian Kellner
f8de164413 api: properly encode exception type
When using `str(type(exception))` this ends up to be something like
`<class 'ValueError'>` for a `ValueError` exception. Get the vanilla
name of the exception type via `type(exception).__name__`.
Add a test to ensure that we encode this properly.
2020-10-09 10:47:44 +02:00
Christian Kellner
f5d00dd043 api: use more generic error member for exceptions
Rename the `API.exception` member to `API.error`, to make it more
generic, so it can also be used for other sort of errors in the
future. Also add a layer of additional structure with `type` and
`data` members so different types of errors apart. Currently only
`exception` is used.
Adapt the tests in test/mod/test_api.py to check for the new
structure and its content.
2020-10-09 10:47:44 +02:00
Christian Kellner
17fbe41b03 test/api: check api.exception exits the process
The `api.exception` method, which is internally also used by
`api.exception_handler` helper, calls `sys.exit` and this no
statement after a call to either method should be reached.
Add an assertion to make sure of that.
2020-10-09 10:47:44 +02:00
Chloe Kaubisch
5dc5ddcf29 api: add exception endpoint
Create a new api endpoint called exception, that communicates
exception backtraces separately back to osbuild, as opposed to
dumping them into the normal log. Additionally, add a corresponding
test to check that a call to api.exception correctly sets
API.exception.
2020-10-02 17:49:45 +02:00
Christian Kellner
fc0c75f40e test/api: race-free api.metadata access
Access metadata.api only after `api` has exited the context and
thus the event loop has stopped and all incoming messages, like
the one setting the metadata, have been processed.
See commit 803433fb62 for a lecture
about the internals and all the details involved.
2020-08-31 15:06:36 +02:00
Christian Kellner
fc5e0070c5 test/api: check for 'get-arguments'/api.arguments
Simple check for the new server side method, `get-arguments`, and
client side counterpart, `api.arguments`, that compares that using
the later we get the supplied input (arguments) to API.
2020-08-25 18:51:55 +02:00
Christian Kellner
30ad32b174 test/api: checks for metadata passing
Add a simple check to make sure that metadata passing via the api
client and api endpoint is working.
2020-08-13 10:50:34 +02:00
Christian Kellner
28cea491bd test: move api buildroot test to test_buildroot.py
Create a new test suite for BuildRoot related test and move the
the combined api and buildroot check there.
2020-08-12 16:52:27 +02:00
Christian Kellner
8388a64ffa api: remove 'addr' param from message dispatcher
Now that jsoncomm is using a connection oriented protocol, the
`addr` parameter is not needed[*] and can thus be removed from
the `BaseAPI._message` message dispatcher. Adapt all usages
of it, including the tests.

[*] sendmsg ignores the destination parameter for connection
oriented sockets.
2020-07-29 02:16:20 +01:00
Christian Kellner
6f8b850ef2 test/api: add build root integration check
Add a new test that checks the integration of API end points with
the `BuildRoot`.
2020-07-27 12:50:38 +01:00
Christian Kellner
c236039e0d test/api: use high level message dispatcher
Use the new `BaseAPI._message` high level message dispatcher that
is more convenient to use.
2020-07-27 12:50:38 +01:00
Christian Kellner
bc81e68727 api: each API defines its 'endpoint' name
Add a new abstract class property to `BaseAPI` called `endpoint`,
meant to be implemented by deriving classes in order to identify
the end point name for the API provider.
Implement the new property in all existing API providers.
2020-07-27 12:50:38 +01:00
Christian Kellner
b86b6a4bf8 test/api: add checks for the api infrastructure
Add a check for `api.BaseAPI` by implementing a test API and test
that receiving messages and dispatching them works as planned.
2020-07-27 12:50:38 +01:00