[Pulp-dev] [Breaking] Deadlock prevention in stages api has changed
Matthias Dellweg
dellweg at atix.de
Mon Dec 16 09:21:58 UTC 2019
With [0] merged to master, the tooling around content futures in the
stages api has changed. This comes with a change in the api, which we
believe is easier to use: The does_batch parameter is removed from
DeclarativeContent, as well as the get_or_create_future method. Instead
an async callback named resolution was added, that can be awaited, once
the content was put into the queue. The moment this coroutine is
started, that particular content will no longer wait for batches to
fill up.
If you used:
# Create d_content and d_artifact for a `foo_a`
foo_a = DeclarativeContent(..., does_batch=False)
foo_a_future = foo_a.get_or_create_future() # This is awaitable
# Send it in the pipeline
await self.put(foo_a)
...
foo_a_content = await foo_a_future # awaits foo_a readiness
You should now do:
# Create d_content and d_artifact for a `foo_a`
foo_a = DeclarativeContent(...)
# Send it in the pipeline
await self.put(foo_a)
...
foo_a_content = await foo_a.resolution() # awaits foo_a readiness
This does _not_ apply to the 3.0 branch.
Big thank you to bmbouter and gmbnomis for helping with ideas and
review.
Matthias
[0] https://github.com/pulp/pulpcore/pull/365
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/pulp-dev/attachments/20191216/06be26c5/attachment.sig>
More information about the Pulp-dev
mailing list