def set_marketplace_image_mode(self, *args):
     """Set selected render node type to be a batch published VM image type.
     Displays the Batch VM image selection UI control.
     Command for select_rendernode_type radio buttons.
     """
     self.select_rendernode_type = PoolImageMode.MARKETPLACE_IMAGE.value
     if self.image_config != None:
         maya.delete_ui(self.image_config)
     self.image_config = []
     with utils.FrameLayout(label="Batch Provided Image Settings",
                            collapsable=True,
                            width=325,
                            collapse=False,
                            parent=self.rendernode_config) as framelayout:
         self.image_config.append(framelayout)
         with utils.ColumnLayout(2,
                                 col_width=((1, 80), (2, 160)),
                                 row_spacing=(1, 5),
                                 row_offset=((1, "top", 15), (5, "bottom",
                                                              15)),
                                 parent=framelayout) as os_image_layout:
             self.image_config.append(os_image_layout)
             maya.text(label="Use Image: ",
                       align='left',
                       parent=os_image_layout)
             with utils.Dropdown(self.set_os_image,
                                 parent=os_image_layout) as image_settings:
                 self._image = image_settings
                 for image in self.batch_images:
                     self._image.add_item(image)
Example #2
0
    def __init__(self, base, frame):
        """Create 'Assets' tab and add to UI frame.

        :param base: The base class for handling asset-related functionality.
        :type base: :class:`.AzureBatchAssets`
        :param frame: The shared plug-in UI frame.
        :type frame: :class:`.AzureBatchUI`
        """
        self.base = base
        self.label = "Assets"
        self.ready = False
        self.page = maya.form_layout(enableBackground=True)
        with utils.Row(2, 2, (70, 260), ("left", "left")) as proj:
            maya.text(label="Project:    ", align="left")
            self._asset_group = maya.text_field(height=25, enable=True)

        with utils.ScrollLayout(v_scrollbar=3, h_scrollbar=0,
                                height=450) as scroll:
            self.scroll_layout = scroll
            with utils.ColumnLayout(2) as sublayout:
                self.asset_display = sublayout
        f_btn = maya.button(label="Add Files", command=self.add_asset)
        d_btn = maya.button(label="Add Directory", command=self.add_dir)

        with utils.Row(1, 1, 355) as u_btn:
            self.upload_button = utils.ProcButton("Upload", "Uploading...",
                                                  self.upload)

        with utils.Row(1, 1, 355, "center", (1, "bottom", 0)) as r_btn:
            self.refresh_button = utils.ProcButton("Refresh", "Refreshing...",
                                                   self.refresh_btn_clicked)

        maya.form_layout(self.page,
                         edit=True,
                         attachForm=[(proj, 'left', 5), (proj, 'right', 5),
                                     (proj, 'top', 5), (scroll, 'left', 5),
                                     (scroll, 'right', 5), (f_btn, 'left', 5),
                                     (d_btn, 'right', 5), (u_btn, 'left', 0),
                                     (u_btn, 'right', 0), (r_btn, 'bottom', 5),
                                     (r_btn, 'left', 0), (r_btn, 'right', 0)],
                         attachControl=[(proj, "bottom", 5, scroll),
                                        (proj, "bottom", 5, scroll),
                                        (scroll, "bottom", 5, f_btn),
                                        (scroll, "bottom", 5, d_btn),
                                        (f_btn, "bottom", 5, u_btn),
                                        (d_btn, "bottom", 5, u_btn),
                                        (u_btn, "bottom", 5, r_btn)],
                         attachPosition=[(f_btn, 'right', 5, 50),
                                         (d_btn, 'left', 5, 50)])
        frame.add_tab(self)
        self.is_logged_out()
Example #3
0
    def __init__(self, base, frame, images, skus, licenses):
        """Create 'Env' tab and add to UI frame.

        :param base: The base class for handling Maya and plugin-related functionality.
        :type base: :class:`.AzureBatchEnvironment`
        :param frame: The shared plug-in UI frame.
        :type frame: :class:`.AzureBatchUI`
        """
        self.base = base
        self.label = " Env  "
        self.ready = False
        self.page = maya.form_layout(enableBackground=True)
        self.license_settings = {}
        with utils.ScrollLayout(v_scrollbar=3, h_scrollbar=0,
                                height=520) as scroll:

            with utils.RowLayout(row_spacing=20) as sublayout:
                with utils.FrameLayout(label="Render Node Configuration",
                                       collapsable=True,
                                       width=325):

                    with utils.ColumnLayout(2,
                                            col_width=((1, 160), (2, 160)),
                                            row_spacing=(1, 5),
                                            row_offset=((1, "top", 15),
                                                        (5, "bottom", 15))):
                        maya.text(label="Use Image: ", align='right')
                        with utils.Dropdown(self.set_image) as image_settings:
                            self._image = image_settings
                            for image in images:
                                self._image.add_item(image)
                        maya.text(label="Use VM Type: ", align='right')
                        with utils.Dropdown(self.set_sku) as sku_settings:
                            self._sku = sku_settings
                            for sku in skus:
                                self._sku.add_item(sku)
                        maya.text(label="Use licenses: ", align='right')
                        for label, checked in licenses.items():
                            self.license_settings[label] = maya.check_box(
                                label=label,
                                value=checked,
                                changeCommand=self.use_license_server)
                            maya.text(label="", align='right')

                with utils.FrameLayout(label="Environment Variables",
                                       collapsable=True,
                                       width=325,
                                       collapse=True):
                    with utils.Row(1, 1, 325):
                        self.env_vars = maya.table(
                            rows=0,
                            columns=2,
                            columnWidth=[(1, 155), (2, 155)],
                            label=[(1, "Setting"), (2, "Value")],
                            rowHeight=15,
                            editable=False,
                            selectionBehavior=1,
                            getCellCmd=self.populate_row)

                    with utils.ColumnLayout(2, col_width=((1, 160), (2, 160))):
                        self.custom_env_var = maya.text_field(
                            placeholderText='Env Variable')
                        self.custom_env_val = maya.text_field(
                            placeholderText='Value')
                        maya.button(label="Add", command=self.add_row)
                        maya.button(label="Delete", command=self.delete_row)

        with utils.Row(1, 1, 355, "center", (1, "bottom", 0)) as btn:
            self.refresh_button = utils.ProcButton("Refresh", "Refreshing...",
                                                   self.refresh)
        maya.form_layout(self.page,
                         edit=True,
                         attachForm=[(scroll, 'top', 5), (scroll, 'left', 5),
                                     (scroll, 'right', 5), (btn, 'bottom', 5),
                                     (btn, 'left', 5), (btn, 'right', 5)],
                         attachControl=(scroll, "bottom", 5, btn))
        frame.add_tab(self)
        self.is_logged_out()
    def __init__(self, base, frame, images, skus, licenses):
        """Create 'Env' tab and add to UI frame.

        :param base: The base class for handling Maya and plugin-related functionality.
        :type base: :class:`.AzureBatchEnvironment`
        :param frame: The shared plug-in UI frame.
        :type frame: :class:`.AzureBatchUI`
        """
        self.base = base
        self.label = " Env  "
        self.ready = False
        self.page = maya.form_layout(enableBackground=True)
        self.licenses = licenses
        self.batch_images = images
        self.poolImageFilter = PoolImageFilter(PoolImageProvider())

        self.image_config = None
        self.license_settings = {}
        self.node_sku_id = ""
        self.containerImageUI = None
        self.select_rendernode_type = PoolImageMode.MARKETPLACE_IMAGE.value

        with utils.ScrollLayout(v_scrollbar=3, h_scrollbar=0,
                                height=520) as scroll:

            with utils.RowLayout(row_spacing=20) as sublayout:
                with utils.FrameLayout(label="Render Node Configuration",
                                       collapsable=True,
                                       width=325,
                                       collapse=False) as rendernode_config:
                    self.rendernode_config = rendernode_config
                    with utils.ColumnLayout(2,
                                            col_width=((1, 100), (2, 200)),
                                            row_spacing=(1, 5),
                                            row_offset=((1, "top", 15),
                                                        (2, "bottom", 20))):
                        maya.text(label="Use VM SKU: ", align='left')
                        with utils.Dropdown(self.set_sku) as sku_settings:
                            self._sku = sku_settings
                            for sku in skus:
                                self._sku.add_item(sku)

                    with utils.Row(1, 1, 325):
                        maya.radio_group(
                            labelArray2=("Batch Provided Image",
                                         "Container Image"),
                            numberOfRadioButtons=2,
                            select=self.select_rendernode_type,
                            vertical=True,
                            onCommand1=self.set_marketplace_image_mode,
                            onCommand2=self.set_container_image_mode)

                    maya.parent()
                    self.set_marketplace_image_mode()

                with utils.FrameLayout(label="Application Licenses",
                                       collapsable=True,
                                       width=325,
                                       collapse=True):

                    with utils.ColumnLayout(2,
                                            col_width=((1, 100), (2, 200)),
                                            row_spacing=(1, 5),
                                            row_offset=((1, "top", 15))):

                        maya.text(label="Use licenses:   ", align='right')
                        for label, checked in licenses.items():
                            self.license_settings[label] = maya.check_box(
                                label=label,
                                value=checked,
                                changeCommand=self.use_license)
                            maya.text(label="", align='right')

                with utils.FrameLayout(label="Environment Variables",
                                       collapsable=True,
                                       width=325,
                                       collapse=True):

                    with utils.Row(1, 1, 325):
                        self.env_vars = maya.table(
                            height=95,
                            rows=0,
                            columns=2,
                            columnWidth=[(1, 190), (2, 190)],
                            label=[(1, "Setting"), (2, "Value")],
                            rowHeight=15,
                            editable=False,
                            selectionBehavior=1,
                            getCellCmd=self.populate_row)

                    with utils.ColumnLayout(2, col_width=((1, 200), (2, 200))):
                        self.custom_env_var = maya.text_field(
                            placeholderText='Env Variable')
                        self.custom_env_val = maya.text_field(
                            placeholderText='Value')
                        maya.button(label="Add", command=self.add_row)
                        maya.button(label="Delete", command=self.delete_row)

        with utils.Row(1, 1, 355, "center", (1, "bottom", 0)) as btn:
            self.refresh_button = utils.ProcButton("Refresh", "Refreshing...",
                                                   self.refresh_btn_clicked)
        maya.form_layout(self.page,
                         edit=True,
                         attachForm=[(scroll, 'top', 5), (scroll, 'left', 5),
                                     (scroll, 'right', 5), (btn, 'bottom', 5),
                                     (btn, 'left', 5), (btn, 'right', 5)],
                         attachControl=(scroll, "bottom", 5, btn))
        frame.add_tab(self)
        self.is_logged_out()
    def __init__(self, poolImageFilter, parent, image_config, renderer):

        self.poolImageFilter = poolImageFilter

        self.renderer = renderer

        self.selected_os = None
        self.selected_maya = None
        self.selected_vray = None
        self.selected_arnold = None

        with utils.FrameLayout(label="Container Image Settings",
                               collapsable=True,
                               width=325,
                               collapse=False,
                               parent=parent) as framelayout:

            image_config.append(framelayout)

            with utils.ColumnLayout(2,
                                    col_width=((1, 100), (2, 200)),
                                    row_spacing=(1, 5),
                                    row_offset=((1, "top", 15), (5, "bottom",
                                                                 15)),
                                    parent=framelayout) as imageLayout:

                image_config.append(imageLayout)

                image_config.append(
                    maya.text(label="OS : ", align='left', parent=imageLayout))

                with utils.Dropdown(self.os_dropdown_set,
                                    parent=imageLayout) as os_dropdown:

                    image_config.append(os_dropdown)

                    self.os_dropdown = os_dropdown

                    for os_version in self.poolImageFilter.getOSDisplayList():
                        self.os_dropdown.add_item(os_version)

                    self.selected_os = self.os_dropdown.value()

                image_config.append(
                    maya.text(label="Maya Version : ",
                              align='left',
                              parent=imageLayout))

                with utils.Dropdown(self.maya_dropdown_set,
                                    parent=imageLayout) as maya_dropdown:

                    image_config.append(maya_dropdown)
                    self.maya_dropdown = maya_dropdown

                    for maya_version in self.poolImageFilter.getMayaDisplayList(
                            self.selected_os):
                        self.maya_dropdown.add_item(maya_version)

                    self.selected_maya = self.maya_dropdown.value()

                if self.renderer == "vray":

                    image_config.append(
                        maya.text(label="VRay Version : ",
                                  align='left',
                                  parent=imageLayout))

                    with utils.Dropdown(self.vray_dropdown_set,
                                        parent=imageLayout) as vray_dropdown:
                        image_config.append(vray_dropdown)
                        self.vray_dropdown = vray_dropdown
                        for vray_version in self.poolImageFilter.getVrayDisplayList(
                                self.selected_os, self.selected_maya):
                            self.vray_dropdown.add_item(vray_version)

                        self.selected_vray = self.vray_dropdown.value()

                if self.renderer == "arnold":

                    image_config.append(
                        maya.text(label="Arnold Version : ",
                                  align='left',
                                  parent=imageLayout))

                    with utils.Dropdown(self.arnold_dropdown_set,
                                        parent=imageLayout) as arnold_dropdown:
                        image_config.append(arnold_dropdown)
                        self.arnold_dropdown = arnold_dropdown
                        for arnold_version in self.poolImageFilter.getArnoldDisplayList(
                                self.selected_os, self.selected_maya):
                            self.arnold_dropdown.add_item(arnold_version)

                        self.selected_arnold = self.arnold_dropdown.value()
Example #6
0
    def set_pool_auto(self, *args):
        """Set selected pool type to be new pool of given size.
        Displays the pool size UI control.
        Command for select_pool_type radio buttons.
        """
        self.select_pool_type = self.AUTO_POOL
        self.base.env_manager.ui.set_enabled(True)
        self.submit_enabled(True)
        maya.delete_ui(self.pool_config)
        if self.container_image_text_row is not None:
            maya.delete_ui(self.container_image_text_row)
        if self.container_image_dropdown_row is not None:
            maya.delete_ui(self.container_image_dropdown_row)
        if self.persistent_pool_dropdown_row is not None:
            maya.delete_ui(self.persistent_pool_dropdown_row)
            self.persistent_pool_dropdown_row = None
        if self.render_node_config_row is not None:
            maya.delete_ui(self.render_node_config_row)
            self.render_node_config_row = None
        self.pool_config = []

        with utils.ColumnLayout(4,
            col_width=((1, 100), (2, 50), (3, 100), (4, 50)),
            row_spacing=(1, 10),
            row_offset=(1, "bottom", 5),
            parent=self.pool_settings) as num_vms_column_layout:
                self.pool_config.append(num_vms_column_layout)
                self.pool_config.append(maya.text(
                    label="Dedicated VMs:   ",
                    align="right",
                    parent=self.pool_config[0]))
                self.pool_config.append(maya.int_field(
                    value=self.select_dedicated_instances,
                    minValue=1,
                    maxValue=self.base.max_pool_size,
                    changeCommand=self.set_dedicated_instances,
                    annotation="Number of dedicated VMs in pool",
                    parent=self.pool_config[0]))
                self.pool_config.append(maya.text(
                    label="Low-pri VMs:   ",
                    align="right",
                    parent=self.pool_config[0]))
                self.pool_config.append(maya.int_field(
                    value=self.select_low_pri_instances,
                    minValue=0,
                    maxValue=self.base.max_pool_size,
                    changeCommand=self.set_low_pri_instances,
                    annotation="Number of low-priority VMs in pool",
                    parent=self.pool_config[0]))
        
        available_images = self.base.env_manager.get_pool_container_images()
        if len(available_images) > 1:
            with utils.Row(1,1,100) as container_image_text_row:
                self.container_image_text_row = container_image_text_row
                self.pool_config.append(container_image_text_row)
                maya.text(label="Container Image to Render with:", align="left")

            with utils.Row(1, 1, 355, "left", (1, "bottom", 10), parent=self.pool_settings) as container_image_dropdown_row:
                self.container_image_dropdown_row = container_image_dropdown_row
                self.pool_config.append(container_image_dropdown_row)
                with utils.Dropdown(self.set_task_container_image, 
                    annotation="Select the Container Image to run the Render with",
                    width=355, parent=self.pool_config[-1]) as container_dropdown:
                    self.pool_config.append(container_dropdown)
                    for container_image in available_images:
                        container_dropdown.add_item(container_image)
                    self.set_task_container_image(container_dropdown.value())

        with utils.Row(1,1,300, "center", (1, "bottom", 20)) as render_node_config_row:
            self.render_node_config_row = render_node_config_row
            self.pool_config.append(render_node_config_row)
            self.pool_config.append(maya.text(label="* Render Node configuration is available on the ""Env"" tab."))
Example #7
0
    def __init__(self, base, frame):
        """Create 'Submit' tab and add to UI frame.

        :param base: The base class for handling jobs submission functionality.
        :type base: :class:`.AzureBatchSubmission`
        :param frame: The shared plug-in UI frame.
        :type frame: :class:`.AzureBatchUI`
        """
        self.base = base
        self.frame = frame
        self.label = "Submit"
        self.page = maya.form_layout(enableBackground=True)
        self.select_dedicated_instances = 1
        self.select_low_pri_instances = 0
        self.selected_container_image = None
        self.container_image_text_row = None
        self.container_image_dropdown_row = None
        self.persistent_pool_dropdown_row = None
        self.render_node_config_row = None
        self.reused_pool_id = None
        self.container_config = []
        self.select_pool_type = self.AUTO_POOL
        with utils.ScrollLayout(height=475, parent=self.page) as scroll:
            box_label = "Pool Settings"
            with utils.FrameLayout(label=box_label, collapsable=True) as pool_settings:
                self.pool_settings = pool_settings
                with utils.ColumnLayout(
                        2, col_width=((1,100),(2,200)), row_spacing=(1,10),
                        row_offset=((1, "top", 20),(5, "bottom", 15))):
                    maya.text(label="Pools:   ", align="right")
                    maya.radio_group(
                        labelArray3=("Auto provision a pool for this job",
                                     "Reuse an existing persistent pool",
                                     "Create a new persistent pool"),
                        numberOfRadioButtons=3,
                        select=self.select_pool_type,
                        vertical=True,
                        onCommand1=self.set_pool_auto,
                        onCommand2=self.set_pool_reuse,
                        onCommand3=self.set_pool_new)
                    self.pool_config = []

            box_label = "Render Settings"
            with utils.FrameLayout(label=box_label, collapsable=True) as box:
                self.render_module = box

        with utils.Row(3, 2, (120,200,35)) as watch:
            self.job_watcher_ui()

        with utils.Row(1, 1, 355, "center") as s_btn:
            self.submit_button = utils.ProcButton(
                "Submit Job", "Submitting...", self.submit)

        with utils.Row(1, 1, 355, "center", (1,"bottom",0)) as r_btn:
            self.refresh_button = utils.ProcButton(
                "Refresh", "Refreshing...", self.refresh_btn_clicked)

        maya.form_layout(
            self.page, edit=True,
            attachForm=[(scroll, 'top', 5),
                        (scroll, 'left', 5), (scroll, 'right', 5),
                        (watch, 'left', 0), (watch, 'right', 0),
                        (s_btn, 'left', 0), (s_btn, 'right', 0),
                        (r_btn, 'bottom', 5),
                        (r_btn, 'left', 0), (r_btn, 'right', 0)],
            attachControl=[(scroll, "bottom", 5, watch),
                           (watch, "bottom" ,5, s_btn),
                           (s_btn, "bottom", 5, r_btn)])
        frame.add_tab(self)