No longer need to have dummy "Unsupported" entry in container image definition, missing entries will behave the same.
Add initial set of maya2018update4 container images Use the marketplace image definition in poolImageProvider globally.
This commit is contained in:
Родитель
2a39273b63
Коммит
9583adb4bc
|
@ -16,33 +16,16 @@ from azurebatchmayaapi import MayaCallbacks as callback
|
|||
import azurebatchutils as utils
|
||||
from ui_environment import EnvironmentUI
|
||||
from ui_environment import PoolImageMode
|
||||
from poolImageProvider import MARKETPLACE_IMAGES
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
BATCH_POOL_IMAGES = {
|
||||
'Windows 2016':
|
||||
{
|
||||
'node_sku_id': 'batch.node.windows amd64',
|
||||
'publisher': 'batch',
|
||||
'offer': 'rendering-windows2016',
|
||||
'sku': 'rendering',
|
||||
'version': '1.2.1'
|
||||
},
|
||||
'Centos 73':
|
||||
{
|
||||
'node_sku_id': 'batch.node.centos 7',
|
||||
'publisher': 'batch',
|
||||
'offer': 'rendering-centos73',
|
||||
'sku': 'rendering',
|
||||
'version': '1.1.2'
|
||||
},
|
||||
}
|
||||
LICENSES = [
|
||||
{'label': 'Maya', 'id': 'maya', 'plugin': None },
|
||||
{'label': 'Arnold', 'id': 'arnold', 'plugin': 'mtoa' },
|
||||
{'label': 'V-Ray', 'id': 'vray', 'plugin': 'vrayformaya' }
|
||||
]
|
||||
#
|
||||
|
||||
|
||||
class AzureBatchEnvironment(object):
|
||||
"""Handler for rendering environment configuration functionality."""
|
||||
|
@ -65,7 +48,7 @@ class AzureBatchEnvironment(object):
|
|||
self.licenses = OrderedDict()
|
||||
self._get_plugin_licenses()
|
||||
self.skus = self._load_skus()
|
||||
self.ui = EnvironmentUI(self, frame, BATCH_POOL_IMAGES.keys(), self.skus, self.licenses)
|
||||
self.ui = EnvironmentUI(self, frame, MARKETPLACE_IMAGES.keys(), self.skus, self.licenses)
|
||||
self.refresh()
|
||||
|
||||
def _load_skus(self):
|
||||
|
@ -163,11 +146,11 @@ class AzureBatchEnvironment(object):
|
|||
|
||||
def get_batch_image(self):
|
||||
selected_image = self.ui.get_os_image()
|
||||
return dict(BATCH_POOL_IMAGES[selected_image])
|
||||
return dict(MARKETPLACE_IMAGES[selected_image])
|
||||
|
||||
def get_custom_image_resource_id(self):
|
||||
selected_image = self.ui.get_os_image()
|
||||
return dict(BATCH_POOL_IMAGES[selected_image])
|
||||
return dict(MARKETPLACE_IMAGES[selected_image])
|
||||
|
||||
def set_custom_image_resource_id(self, custom_image_resource_id):
|
||||
self._session.store_custom_image_resource_id(custom_image_resource_id)
|
||||
|
@ -176,7 +159,7 @@ class AzureBatchEnvironment(object):
|
|||
"""Retrieve the image label from the data in a pool image
|
||||
reference object.
|
||||
"""
|
||||
pool_image = [k for k,v in BATCH_POOL_IMAGES.items() if v['offer'] == image_ref.offer]
|
||||
pool_image = [k for k,v in MARKETPLACE_IMAGES.items() if v['offer'] == image_ref.offer]
|
||||
if pool_image:
|
||||
return pool_image[0]
|
||||
else:
|
||||
|
|
|
@ -22,10 +22,10 @@ class PoolImageFilter(object):
|
|||
#TODO add support for "Any" in dropdown
|
||||
def __init__(self, poolImageProvider):
|
||||
|
||||
self.batchManagedImagesWithContainers = poolImageProvider.getBatchManagedImagesWithContainers()
|
||||
self.containerImages = poolImageProvider.getContainerImages()
|
||||
|
||||
def getSelectedImage(self, selectedOS, selectedMaya, selectedVRay = None, selectedArnold = None):
|
||||
results = self.batchManagedImagesWithContainers
|
||||
results = self.containerImages
|
||||
|
||||
results = filterImagesByOS(results, selectedOS)
|
||||
|
||||
|
@ -42,24 +42,24 @@ class PoolImageFilter(object):
|
|||
|
||||
def getOSDisplayList(self):
|
||||
|
||||
results = set(i["OS"] for i in self.batchManagedImagesWithContainers.viewvalues())
|
||||
results = set(i.get("OS") for i in self.containerImages.viewvalues())
|
||||
|
||||
return results
|
||||
|
||||
def getMayaDisplayList(self, selectedOS = None):
|
||||
results = self.batchManagedImagesWithContainers
|
||||
results = self.containerImages
|
||||
|
||||
if selectedOS:
|
||||
results = filterImagesByOS(results, selectedOS)
|
||||
|
||||
resultset = set([i['Maya'] for i in results.viewvalues()])
|
||||
resultset.discard('Unsupported')
|
||||
resultset = set([i.get('Maya') for i in results.viewvalues()])
|
||||
resultset.discard(None)
|
||||
return resultset
|
||||
|
||||
|
||||
def getVrayDisplayList(self, selectedOS = None, selectedMaya = None, selectedArnold = None):
|
||||
|
||||
results = self.batchManagedImagesWithContainers
|
||||
results = self.containerImages
|
||||
|
||||
if selectedOS:
|
||||
results = filterImagesByOS(results, selectedOS)
|
||||
|
@ -70,14 +70,14 @@ class PoolImageFilter(object):
|
|||
if selectedArnold:
|
||||
results = filterImagesByArnold(results, selectedArnold)
|
||||
|
||||
resultset = set([i["VRay"] for i in results.viewvalues()])
|
||||
resultset.discard('Unsupported')
|
||||
resultset = set([i.get("VRay") for i in results.viewvalues()])
|
||||
resultset.discard(None)
|
||||
return resultset
|
||||
|
||||
|
||||
def getArnoldDisplayList(self, selectedOS = None, selectedMaya = None, selectedVRay = None):
|
||||
|
||||
results = self.batchManagedImagesWithContainers
|
||||
results = self.containerImages
|
||||
|
||||
if selectedOS:
|
||||
results = filterImagesByOS(results, selectedOS)
|
||||
|
@ -88,23 +88,23 @@ class PoolImageFilter(object):
|
|||
if selectedVRay:
|
||||
results = filterImagesByVRay(results, selectedVRay)
|
||||
|
||||
resultset = set([i["Arnold"] for i in results.viewvalues()])
|
||||
resultset.discard('Unsupported')
|
||||
resultset = set([i.get("Arnold") for i in results.viewvalues()])
|
||||
resultset.discard(None)
|
||||
return resultset
|
||||
|
||||
#private methods
|
||||
def filterImagesByOS(images, selection):
|
||||
imagesFiltered = [i for i in images.viewitems() if i[1]["OS"] == selection]
|
||||
imagesFiltered = [i for i in images.viewitems() if i[1].get("OS") == selection]
|
||||
return dict(imagesFiltered)
|
||||
|
||||
def filterImagesByMaya(images, selection):
|
||||
imagesFiltered = [i for i in images.viewitems() if i[1]["Maya"] == selection]
|
||||
imagesFiltered = [i for i in images.viewitems() if i[1].get("Maya") == selection]
|
||||
return dict(imagesFiltered)
|
||||
|
||||
def filterImagesByArnold(images, selection):
|
||||
imagesFiltered = [i for i in images.viewitems() if i[1]["Arnold"] == selection]
|
||||
imagesFiltered = [i for i in images.viewitems() if i[1].get("Arnold") == selection]
|
||||
return dict(imagesFiltered)
|
||||
|
||||
def filterImagesByVRay(images, selection):
|
||||
imagesFiltered = [i for i in images.viewitems() if i[1]["VRay"] == selection]
|
||||
imagesFiltered = [i for i in images.viewitems() if i[1].get("VRay") == selection]
|
||||
return dict(imagesFiltered)
|
||||
|
|
|
@ -7,7 +7,7 @@ import json
|
|||
import sys
|
||||
import traceback
|
||||
|
||||
BATCH_MANAGED_IMAGES = {
|
||||
MARKETPLACE_IMAGES = {
|
||||
'Windows 2016':
|
||||
{
|
||||
'node_sku_id': 'batch.node.windows amd64',
|
||||
|
@ -26,13 +26,11 @@ BATCH_MANAGED_IMAGES = {
|
|||
},
|
||||
}
|
||||
|
||||
BATCH_MANAGED_IMAGES_WITH_CONTAINERS_JSON = {
|
||||
CONTAINER_IMAGES = {
|
||||
'azurebatchrendering/centos_maya2018update3:latest':
|
||||
{
|
||||
'OS': 'CentOS 75',
|
||||
'Maya': '2018-Update3',
|
||||
'VRay': 'Unsupported',
|
||||
'Arnold': 'Unsupported',
|
||||
'node_sku_id': 'batch.node.centos 7',
|
||||
'ImageReference' :
|
||||
{
|
||||
|
@ -46,7 +44,6 @@ BATCH_MANAGED_IMAGES_WITH_CONTAINERS_JSON = {
|
|||
{
|
||||
'OS': 'CentOS 75',
|
||||
'Maya': '2018-Update3',
|
||||
'VRay': 'Unsupported',
|
||||
'Arnold': '2.1.0.3',
|
||||
'node_sku_id': 'batch.node.centos 7',
|
||||
'ImageReference' :
|
||||
|
@ -62,7 +59,47 @@ BATCH_MANAGED_IMAGES_WITH_CONTAINERS_JSON = {
|
|||
'OS': 'CentOS 75',
|
||||
'Maya': '2018-Update3',
|
||||
'VRay': '3.60.04',
|
||||
'Arnold': 'Unsupported',
|
||||
'node_sku_id': 'batch.node.centos 7',
|
||||
'ImageReference' :
|
||||
{
|
||||
'publisher' : 'microsoft-azure-batch',
|
||||
'offer' : 'centos-container',
|
||||
'sku' : '7-5',
|
||||
'version' : 'latest'
|
||||
},
|
||||
},
|
||||
'azurebatchrendering/centos_maya2018update4:latest':
|
||||
{
|
||||
'OS': 'CentOS 75',
|
||||
'Maya': '2018-Update4',
|
||||
'node_sku_id': 'batch.node.centos 7',
|
||||
'ImageReference' :
|
||||
{
|
||||
'publisher' : 'microsoft-azure-batch',
|
||||
'offer' : 'centos-container',
|
||||
'sku' : '7-5',
|
||||
'version' : 'latest'
|
||||
},
|
||||
},
|
||||
'azurebatchrendering/centos_maya2018update4_arnold3101:latest':
|
||||
{
|
||||
'OS': 'CentOS 75',
|
||||
'Maya': '2018-Update4',
|
||||
'Arnold': '3.1.0.1',
|
||||
'node_sku_id': 'batch.node.centos 7',
|
||||
'ImageReference' :
|
||||
{
|
||||
'publisher' : 'microsoft-azure-batch',
|
||||
'offer' : 'centos-container',
|
||||
'sku' : '7-5',
|
||||
'version' : 'latest'
|
||||
},
|
||||
},
|
||||
'azurebatchrendering/centos_maya2018update4_vray36004:latest':
|
||||
{
|
||||
'OS': 'CentOS 75',
|
||||
'Maya': '2018-Update4',
|
||||
'VRay': '3.60.04',
|
||||
'node_sku_id': 'batch.node.centos 7',
|
||||
'ImageReference' :
|
||||
{
|
||||
|
@ -77,8 +114,8 @@ BATCH_MANAGED_IMAGES_WITH_CONTAINERS_JSON = {
|
|||
class PoolImageProvider(object):
|
||||
|
||||
#TODO provide read only storage client and load entries from table storage
|
||||
def __init__(self, batch_managed_images_with_containers_json = BATCH_MANAGED_IMAGES_WITH_CONTAINERS_JSON):
|
||||
self.batchManagedImagesWithContainers = batch_managed_images_with_containers_json
|
||||
def __init__(self, container_images = CONTAINER_IMAGES):
|
||||
self.container_images = container_images
|
||||
|
||||
def getBatchManagedImagesWithContainers(self):
|
||||
return self.batchManagedImagesWithContainers
|
||||
def getContainerImages(self):
|
||||
return self.container_images
|
||||
|
|
|
@ -18,7 +18,7 @@ else:
|
|||
import mock
|
||||
from mock import MagicMock
|
||||
|
||||
from environment import BATCH_POOL_IMAGES
|
||||
from poolImageProvider import MARKETPLACE_IMAGES
|
||||
import azurebatchutils as utils
|
||||
from azure.batch_extensions import _file_utils as fileutils
|
||||
|
||||
|
@ -47,8 +47,8 @@ SCRIPT_DIR = os.path.abspath('azure_batch_maya/scripts/tools')
|
|||
os.environ['AZUREBATCH_MODULES'] = os.path.abspath('azure_batch_maya/modules')#os.path.join(os.path.split(scriptDir)[0], 'azure_batch_maya/Modules')
|
||||
|
||||
def os_flavor(pool_image):
|
||||
windows_offers = [value['offer'] for value in BATCH_POOL_IMAGES.values() if 'windows' in value['node_sku_id']]
|
||||
linux_offers = [value['offer'] for value in BATCH_POOL_IMAGES.values() if value['offer'] not in windows_offers]
|
||||
windows_offers = [value['offer'] for value in MARKETPLACE_IMAGES.values() if 'windows' in value['node_sku_id']]
|
||||
linux_offers = [value['offer'] for value in MARKETPLACE_IMAGES.values() if value['offer'] not in windows_offers]
|
||||
if pool_image.offer in windows_offers:
|
||||
return 'Windows'
|
||||
elif pool_image.offer in linux_offers:
|
||||
|
|
|
@ -14,20 +14,17 @@ import sys
|
|||
from poolImageFilter import PoolImageFilter
|
||||
from poolImageProvider import PoolImageProvider
|
||||
|
||||
BATCH_MANAGED_IMAGES_WITH_CONTAINERS_JSON = {
|
||||
CONTAINER_IMAGES = {
|
||||
'batchrendering/linux/maya2017:update5':
|
||||
{
|
||||
'OS': 'CentOS 73',
|
||||
'Maya': '2017-Update5',
|
||||
'VRay': 'Unsupported',
|
||||
'Arnold': 'Unsupported',
|
||||
'ImageReference' : 'CentOS73WithContainers'
|
||||
},
|
||||
'batchrendering/linux/mtoa-maya2017:2.0.1.1':
|
||||
{
|
||||
'OS': 'CentOS 73',
|
||||
'Maya': '2017-Update5',
|
||||
'VRay': 'Unsupported',
|
||||
'Arnold': '2.0.1.1',
|
||||
'ImageReference' : 'CentOS73WithContainers'
|
||||
},
|
||||
|
@ -36,7 +33,6 @@ BATCH_MANAGED_IMAGES_WITH_CONTAINERS_JSON = {
|
|||
'OS': 'CentOS 73',
|
||||
'Maya': '2017-Update5',
|
||||
'VRay': '3.52.03',
|
||||
'Arnold': 'Unsupported',
|
||||
'ImageReference' : 'CentOS73WithContainers'
|
||||
},
|
||||
'batchrendering/linux/vrayformaya-maya2017:35203':
|
||||
|
@ -44,7 +40,6 @@ BATCH_MANAGED_IMAGES_WITH_CONTAINERS_JSON = {
|
|||
'OS': 'CentOS 73',
|
||||
'Maya': '2017-Update5',
|
||||
'VRay': '3.52.03',
|
||||
'Arnold': 'Unsupported',
|
||||
'ImageReference' : 'CentOS73WithContainers'
|
||||
},
|
||||
'dummyCombinedVrayArnold':
|
||||
|
@ -60,15 +55,12 @@ BATCH_MANAGED_IMAGES_WITH_CONTAINERS_JSON = {
|
|||
{
|
||||
'OS': 'CentOS 73',
|
||||
'Maya': '2018-Update1',
|
||||
'VRay': 'Unsupported',
|
||||
'Arnold': 'Unsupported',
|
||||
'ImageReference' : 'CentOS73WithContainers'
|
||||
},
|
||||
'dummy2018-2':
|
||||
{
|
||||
'OS': 'CentOS 73',
|
||||
'Maya': '2018-Update1',
|
||||
'VRay': 'Unsupported',
|
||||
'Arnold': '2.0.1.1',
|
||||
'ImageReference' : 'CentOS73WithContainers'
|
||||
},
|
||||
|
@ -77,7 +69,6 @@ BATCH_MANAGED_IMAGES_WITH_CONTAINERS_JSON = {
|
|||
'OS': 'CentOS 73',
|
||||
'Maya': '2018-Update1',
|
||||
'VRay': '3.52.03',
|
||||
'Arnold': 'Unsupported',
|
||||
'ImageReference' : 'CentOS73WithContainers'
|
||||
},
|
||||
'dummy2018-4':
|
||||
|
@ -85,7 +76,6 @@ BATCH_MANAGED_IMAGES_WITH_CONTAINERS_JSON = {
|
|||
'OS': 'CentOS 73',
|
||||
'Maya': '2018-Update1',
|
||||
'VRay': '3.52.03',
|
||||
'Arnold': 'Unsupported',
|
||||
'ImageReference' : 'CentOS73WithContainers'
|
||||
},
|
||||
'dummy2018-5':
|
||||
|
@ -152,7 +142,7 @@ BATCH_MANAGED_IMAGES_WITH_CONTAINERS_JSON = {
|
|||
class TestPoolImages(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.poolImages = PoolImageFilter(PoolImageProvider(BATCH_MANAGED_IMAGES_WITH_CONTAINERS_JSON))
|
||||
self.poolImages = PoolImageFilter(PoolImageProvider(CONTAINER_IMAGES))
|
||||
return super(TestPoolImages, self).setUp()
|
||||
|
||||
#getOSDisplayList
|
||||
|
|
Загрузка…
Ссылка в новой задаче