Only display pools in the reuse pool dropdown if they have the appLicenses required by the job on them (depends on the selected renderer)

This commit is contained in:
David Kydd 2018-10-18 09:38:41 +13:00
Родитель bf867b8bf1
Коммит 0209a4b8c2
2 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -52,7 +52,7 @@ class AzureBatchPools(object):
self.batch = self._session.batch
self.environment = env
def list_pools(self, lazy=False):
def list_pools(self, lazy=False, requiredAppLicenses=None):
"""Retrieves the currently running pools. Is called on loading and
refreshing the pools tab, also when populating the job submission
pool selection drop down menu.
@ -63,6 +63,9 @@ class AzureBatchPools(object):
self.pools = []
for pool in all_pools:
if pool.virtual_machine_configuration:
if requiredAppLicenses:
if not set(requiredAppLicenses).issubset(pool.application_licenses):
continue
self.pools.append(pool)
self.pools.sort(key=lambda x: x.creation_time, reverse=True)
self.count = len(self.pools)

Просмотреть файл

@ -230,7 +230,9 @@ class AzureBatchSubmission(object):
"""Retrieve the currently available pools to populate
the job submission pool selection drop down.
"""
pools = self.pool_manager.list_pools(lazy=True)
self.env_manager._get_plugin_licenses()
required_app_licenses = self.env_manager.get_application_licenses()
pools = self.pool_manager.list_pools(lazy=True, requiredAppLicenses=required_app_licenses)
return pools
def submit(self, watch_job=False, download_dir=None):