From 0209a4b8c2ec8694e100c26f38f8ee312631d81f Mon Sep 17 00:00:00 2001 From: David Kydd Date: Thu, 18 Oct 2018 09:38:41 +1300 Subject: [PATCH] Only display pools in the reuse pool dropdown if they have the appLicenses required by the job on them (depends on the selected renderer) --- azure_batch_maya/scripts/pools.py | 5 ++++- azure_batch_maya/scripts/submission.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/azure_batch_maya/scripts/pools.py b/azure_batch_maya/scripts/pools.py index a883f13..d7b321f 100644 --- a/azure_batch_maya/scripts/pools.py +++ b/azure_batch_maya/scripts/pools.py @@ -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) diff --git a/azure_batch_maya/scripts/submission.py b/azure_batch_maya/scripts/submission.py index a7bfb01..03971ad 100644 --- a/azure_batch_maya/scripts/submission.py +++ b/azure_batch_maya/scripts/submission.py @@ -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):