Project

Profile

Help

Story #2659

Updated by bmbouter over 6 years ago

Assumption:    Pulp workers that are missing should not be shown in the status API. 

 In Pulp3, the Worker model has an 'online' boolean which is meant to allow Pulp to store records about workers even after they have gone offline. Additionally workers should be considered offline if their heartbeat time is older than 30 seconds. We need to filter for both cases because of the following failure scenario: 

 1) a working Pulp system with exactly 1 worker that has pid 1234 
 2) kill -9 1234 

 In this case, the DB record will show 'online' without the 30 second part of the filter. 

 To resolve this we should: 

 1) add a method called <code>online_workers</code> to the "TaskManager":https://github.com/bmbouter/pulp/blob/e5986173d1617fcadb520c84b78691982cce2218/platform/pulpcore/app/models/task.py#L38 which returns a queryset with the two filters applied as described above 
 2) refactor the "get_unreserved_worker":https://github.com/bmbouter/pulp/blob/e5986173d1617fcadb520c84b78691982cce2218/platform/pulpcore/app/models/task.py#L40 method to use <code>online_workers</code> instead. This will cause us to stay DRY w.r.t. this filtering. 
 3) Have the ViewSet of the /status/ API only return workers from the <code>online_workers</code> queryset. 
 4) Update the docstrings so that those updates will flow to the docs

Back