Task #3184

Updated by over 2 years ago

The creation of Publications happens in plugins, so some parts of this description apply to plugins only. The pulpcore changes should be limited to adding the field and preventing use of complete=False publications. The plugins should either update their code to prevent the transaction problem presented below, or use the Publication context manager to be written in

The current implementation of the publishing task starts an outer transaction. This is undesirable because:
* Long running transactions can accumulate DB locks which can result in contention.
* Could exceed DB limitations on rollback segement.
* Prevents progress reports from being committed.

The following line needs to be removed:

with transaction.atomic():

Without the outer transaction, the publication will be committed _half-baked_. There needs to be a way to prevent the publication from being used before it is completely constructed. Here is a recap of a list design discussion:

* Add an attribute called 'complete' to Publication which defaults to False.
* Update the viewset so that it excludes Publications that have complete=False
* Update the filterset for Publications to also exclude Publications that have complete=False