Project

Profile

Help

Issue #7497

Updated by bmbouter almost 4 years ago

## Use case 

 Say you dispatch N repo sync's every 6 hours, where N is large > 500 repos. Then say the server's Pulp is syncing from are temporarily slow, so they tasks are backing up enough that another "set" of sync's are dispatched. The user would like to cancel enough sync's so that for each repository there is only one, but they cannot know which ones to cancel because the reserved_resource_records field is not yet set. 

 ## The issue Proposal 

 The records are being created in Have the resource_manager [here](https://github.com/pulp/pulpcore/commit/0c51cba1bbf7f644848fc03e9c378f24b9fbb8db#diff-db429debc88750d7e60acf4211f41b91R303-R306) but they should [`TaskSerializer.reserved_resources_records`](https://github.com/pulp/pulpcore/blob/6cce0895d3b19c395de680b7d568a3dfa87c9833/pulpcore/app/serializers/task.py#L103) record the reservations that "will be created in the `enqueue_with_reservation` function when the task record itself is created" prior to them being created. 

 ## Implementation Question 

 1. Move [this code](https://github.com/pulp/pulpcore/commit/0c51cba1bbf7f644848fc03e9c378f24b9fbb8db#diff-db429debc88750d7e60acf4211f41b91R303-R306) to For the `enqueue_with_reservation` function [here](https://github.com/pulp/pulpcore/blob/4f36795ba11f3b5cb3d06a4a9824d7d444fa5eba/pulpcore/tasking/tasks.py#L223-L230). data this serializer will display, should these be strings or actual ForeignKeys? 
 2. Ensure that the `Task`, `ReservedResourceRecord`, and `TaskReservedResourceRecord` are all created as one transaction.

Back