Project

Profile

Help

Story #5120

Updated by dkliban@redhat.com over 5 years ago

The ReservedResource object is currently ephemeral. As a result, the Task API does not include the reserved resources. A filter for tasks on 'reserved_resources' would require the following changes: 

 - Add a TaskReservedResource model Remove the 'release_resources' method[0] from the Task model. 
 - Remove '_release_resources' task[1] and stop dispatching it 
 - Update the query in the 'with_reservations' method[2] to exclude reservations associated with tasks that has have already completed.  
 - Update the same fields 'get_unreserved_worker' method[3] with similar queryset filters as ReservedResource above 
 - Create an instance of TaskReservedResource when creating ReservedResource 
 - Add a 'reserved_resources' field to the TaskSerializer that will get data from the TasReservedResource table 
 - Extend the TaskFilter with a 'reserved_resources' filter  
  

 An additional benefit to this is that Pulp will no longer have to dispatch 2 tasks for every single task with a reservation.  

 [0] https://github.com/pulp/pulpcore/blob/master/pulpcore/app/models/task.py#L344 
 [1] https://github.com/pulp/pulpcore/blob/master/pulpcore/tasking/tasks.py#L119 
 [2] https://github.com/pulp/pulpcore/blob/master/pulpcore/app/models/task.py#L144 
 [3] https://github.com/pulp/pulpcore/blob/master/pulpcore/app/models/task.py#L63

Back