Clean up work_type processing and fix execution vs control capacity (#10930)

* Clean up added work_type processing for mesh_code branch

* track both execution and control capacity

* Remove unused execution_capacity property

* Count all forms of capacity to make test pass

* Force jobs to be on execution nodes, updates on control nodes

* Introduce capacity_type property to abstract some details out

* Update test to cover all job types at same time

* Register OpenShift nodes as control types

* Remove unqualified consumed_capacity from task manager and make unit tests work

* Remove unqualified consumed_capacity from task manager and make unit tests work

* Update unit test to execution vs control TM logic changes

* Fix bug, else handling for work_type method
This commit is contained in:
Alan Rominger
2021-08-26 07:24:14 -04:00
committed by GitHub
parent fb0e55fd1b
commit daf4310176
16 changed files with 159 additions and 88 deletions

View File

@@ -574,6 +574,20 @@ def get_model_for_type(type_name):
return apps.get_model(use_app, model_str)
def get_capacity_type(uj):
'''Used for UnifiedJob.capacity_type property, static method will work for partial objects'''
model_name = uj._meta.concrete_model._meta.model_name
if model_name in ('job', 'inventoryupdate', 'adhoccommand', 'jobtemplate', 'inventorysource'):
return 'execution'
elif model_name == 'workflowjob':
return None
elif model_name.startswith('unified'):
raise RuntimeError(f'Capacity type is undefined for {model_name} model')
elif model_name in ('projectupdate', 'systemjob', 'project', 'systemjobtemplate'):
return 'control'
raise RuntimeError(f'Capacity type does not apply to {model_name} model')
def prefetch_page_capabilities(model, page, prefetch_list, user):
"""
Given a `page` list of objects, a nested dictionary of user_capabilities