Ejemplo n.º 1
0
    def reuse_selected_pool_dropdown_changed(self, poolId):
        maya.delete_ui(self.container_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)
        self.container_config = []
        self.reused_pool_id = poolId
        if not poolId:
            self.submit_enabled(False)
        else:
            self.submit_enabled(True)
            available_images = self.base.pool_manager.get_pool_container_images(poolId)
            if len(available_images) > 0:
                with utils.Row(1,1,100, parent=self.pool_settings) as container_image_text_row:
                    self.container_image_text_row = container_image_text_row
                    self.container_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.container_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) as container_dropdown:
                        #self.container_config.append(container_dropdown)
                        for container_image in available_images:
                            container_dropdown.add_item(container_image)
                        self.set_task_container_image(container_dropdown.value())
Ejemplo n.º 2
0
    def __init__(self, base, frame):
        """Create 'Jobs' tab and add to UI frame.

        :param base: The base class for handling jobs monitoring functionality.
        :type base: :class:`.AzureBatchJobHistory`
        :param frame: The shared plug-in UI frame.
        :type frame: :class:`.AzureBatchUI`
        """
        self.base = base
        self.label = " Jobs "
        self.ready = False
        self.jobs_displayed = []
        self.page = maya.form_layout(enableBackground=True)

        with utils.Row(1, 1, 360, "center") as lbl:
            self.total = maya.text(label="", font="boldLabelFont")
        self.paging_display()
        with utils.ScrollLayout(v_scrollbar=3, h_scrollbar=0,
                                height=478) as scroll:
            with utils.RowLayout(row_spacing=20) as sublayout:
                if not self.jobs_displayed:
                    self.empty_jobs = maya.text(label="Loading job data...",
                                                align='left',
                                                font="boldLabelFont")
                self.jobs_layout = sublayout

        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=[(lbl, 'top', 0), (lbl, 'left', 5),
                                     (lbl, 'right', 5),
                                     (self.first_btn, 'left', 5),
                                     (self.last_btn, 'right', 5),
                                     (scroll, 'left', 5), (scroll, 'right', 5),
                                     (btn, 'bottom', 5), (btn, 'left', 0),
                                     (btn, 'right', 0)],
                         attachControl=[(self.first_btn, "top", 5, lbl),
                                        (self.prev_btn, "top", 5, lbl),
                                        (self.last_btn, "top", 5, lbl),
                                        (self.next_btn, "top", 5, lbl),
                                        (scroll, "top", 5, self.first_btn),
                                        (scroll, "top", 5, self.next_btn),
                                        (scroll, "top", 5, self.prev_btn),
                                        (scroll, "top", 5, self.last_btn),
                                        (scroll, "bottom", 5, btn)],
                         attachPosition=[
                             (lbl, 'top', 5, 0),
                             (self.first_btn, 'right', 5, 25),
                             (self.prev_btn, 'left', 5, 25),
                             (self.prev_btn, 'right', 5, 50),
                             (self.next_btn, 'right', 5, 75),
                             (self.next_btn, 'left', 5, 50),
                             (self.last_btn, 'left', 5, 75),
                         ])
        frame.add_tab(self)
        self.is_logged_out()
Ejemplo n.º 3
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()
Ejemplo n.º 4
0
    def init_post_auth(self):
        maya.delete_ui(self.auth_temp_ui_elements)
        if self.subscription_ui_elements is not None and not len(
                self.subscription_ui_elements) == 0:
            maya.delete_ui(self.subscription_ui_elements)
        if self.subscription_row is not None:
            maya.delete_ui(self.subscription_row)
        if self.batch_account_row is not None:
            maya.delete_ui(self.batch_account_row)
        if self.account_ui_elements:
            maya.delete_ui(self.account_ui_elements)
        self.account_ui_elements = []
        self.subscription_ui_elements = []

        box_label = "Batch Account Settings"
        with utils.FrameLayout(
                label=box_label,
                collapsable=True,
                width=345,
                collapse=False,
                parent=self.frames_layout) as batch_account_framelayout:
            self.batch_account_framelayout = batch_account_framelayout
            with utils.Row(1, 1, (300), ("left"), [1, "top", 15]):
                self.account_status_field = maya.text(label="", align="center")
                self.account_status = "Please select Subscription"
            with utils.Row(2, 2, (100, 200),
                           ("left", "left")) as subscriptionRow:
                self.subscription_row = subscriptionRow
                maya.text(label="Subscription:    ", align="right")
                with utils.Dropdown(self.select_subscription_in_dropdown
                                    ) as subscription_dropdown:
                    self._subscription_dropdown = subscription_dropdown
                    self._subscription_dropdown.add_item("")
                    self.subscription_ui_elements.append(
                        self._subscription_dropdown)

                    subscriptions = self.base.available_subscriptions()
                    self.subscriptions_by_displayname = dict([
                        (sub.display_name, sub) for sub in subscriptions
                    ])
                    for sub in subscriptions:
                        self._subscription_dropdown.add_item(sub.display_name)

            self.draw_threads_and_logging_rows(self.frames_layout,
                                               self.account_ui_elements)

        self.auth_status = "Authenticated"
        self.disable(True)
        maya.refresh()
Ejemplo n.º 5
0
    def init_after_subscription_selected(self):
        self.account_status = "Loading"
        maya.refresh()
        if self.batch_account_row is not None:
            maya.delete_ui(self.batch_account_row)
        if self.account_ui_elements:
            maya.delete_ui(self.account_ui_elements)
        self.disable(False)
        self.account_ui_elements = []
        with utils.Row(
                2,
                2, (100, 200), ("left", "left"),
                parent=self.batch_account_framelayout) as batch_account_row:
            self.batch_account_row = batch_account_row
            maya.text(label="Batch Account:    ", align="right")
            with utils.Dropdown(
                    self.select_account_in_dropdown) as account_dropdown:
                self._account_dropdown = account_dropdown
                self._account_dropdown.add_item("")
                accounts = self.base.available_batch_accounts()
                self.accounts_by_name = dict([(account.name, account)
                                              for account in accounts])
                for account in accounts:
                    self._account_dropdown.add_item(account.name)
        self.account_status = "Please select Batch Account"

        self.draw_threads_and_logging_rows(self.frames_layout,
                                           self.account_ui_elements)
        self.disable(True)
        maya.refresh()
Ejemplo n.º 6
0
    def __init__(self, base, frame):
        """Create 'Pools' tab and add to UI frame.

        :param base: The base class for handling pools monitoring functionality.
        :type base: :class:`.AzureBatchPools`
        :param frame: The shared plug-in UI frame.
        :type frame: :class:`.AzureBatchUI`
        """
        self.base = base
        self.label = "Pools "
        self.ready = False
        self.pools_displayed = []
        self.page = maya.form_layout(enableBackground=True)
        with utils.ScrollLayout(v_scrollbar=3, h_scrollbar=0,
                                height=520) as scroll:
            with utils.RowLayout(row_spacing=20) as sublayout:
                if not self.pools_displayed:
                    self.empty_pools = maya.text(label="Loading pool data...",
                                                 font="boldLabelFont",
                                                 parent=sublayout)
                self.pools_layout = sublayout
        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', 0), (btn, 'right', 0)],
                         attachControl=(scroll, "bottom", 5, btn))
        frame.add_tab(self)
        self.is_logged_out()
Ejemplo n.º 7
0
    def change_batch_account_button_pressed(self, *args):
        self.account_status = "Loading"
        maya.refresh()
        maya.form_layout(self.page, edit=True, enable=False)
        if self.account_ui_elements:
            maya.delete_ui(self.account_ui_elements)
        if self.batch_account_row is not None:
            maya.delete_ui(self.batch_account_row)
        self.account_ui_elements = []
        with utils.Row(
                2,
                2, (100, 200), ("left", "left"),
                parent=self.batch_account_framelayout) as batch_account_row:
            self.batch_account_row = batch_account_row
            maya.text(label="Batch Account:    ", align="right")
            with utils.Dropdown(
                    self.select_account_in_dropdown) as account_dropdown:
                self._account_dropdown = account_dropdown
        accounts = self.base.available_batch_accounts()
        self.accounts_by_name = dict([(account.name, account)
                                      for account in accounts])
        self._account_dropdown.add_item(
            "")  #dummy value so dropdown appears empty
        for account in accounts:
            self._account_dropdown.add_item(account.name)
        self.account_status = "Account Configured"

        self.draw_threads_and_logging_rows(self.frames_layout,
                                           self.account_ui_elements)
        maya.form_layout(self.page, edit=True, enable=True)
        maya.refresh()
Ejemplo n.º 8
0
    def set_pool_reuse(self, *args):
        """Set selected pool type to be an existing pool with given ID.
        Loads the currently available pools and displays the pool IDs 
        in a dropdown menu.
        Command for select_pool_type radio buttons.
        """
        self.submit_enabled(False)
        self.base.env_manager.ui.set_enabled(False)

        self.select_pool_type = self.EXISTING_POOL
        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)
        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.Row(1,1,100, parent=self.pool_settings) as reuse_pool_row:
            self.pool_config.append(reuse_pool_row)
            loading_message = maya.text(
                label="loading...",
                align="left")
            self.pool_config.append(loading_message)
            maya.refresh()
            pool_options = self.base.available_pools()
            maya.text(loading_message, edit=True, label="Reused Pool ID:   ")

        with utils.Row(1, 1, 355, "left", (1, "bottom", 5), parent=self.pool_settings) as persistent_pool_dropdown_row:
            self.persistent_pool_dropdown_row = persistent_pool_dropdown_row
            self.pool_config.append(persistent_pool_dropdown_row)

            with utils.Dropdown(self.reuse_selected_pool_dropdown_changed, annotation="Select an existing persistent pool.") as pool_dropdown:
                self.pool_config.append(pool_dropdown)
                self.pool_dropdown = pool_dropdown
                pool_dropdown.add_item("")
                for pool_id in pool_options:
                    pool_dropdown.add_item(pool_id)
Ejemplo n.º 9
0
 def display_info(self, label):
     """Display text data as a label with a heading.
     :param str label: The text for the data heading.
     """
     with utils.Row(2, 2, (100,220), ("right","left"),
                    parent=self.job_details) as row:
         self.content.append(row)
         self.content.append(maya.text(label=label, align="right"))
         input = maya.text(align="left", label="")
         self.content.append(input)
     return input, row
Ejemplo n.º 10
0
 def display_data(self, label):
     """Display text data as a non-editable text field with heading.
     :param str label: The text for the data heading.
     """
     with utils.Row(2, 2, (100,220), ("right","left"),
                    parent=self.job_details) as row:
         self.content.append(row)
         self.content.append(maya.text(label=label, align="right"))
         input = maya.text_field(text="", editable=False)
         self.content.append(input)
     return input, row
Ejemplo n.º 11
0
    def draw_threads_and_logging_rows(self, parent, element_list):
        box_label = "Plugin Settings"
        if self.plugin_settings_framelayout is not None:
            maya.delete_ui(self.plugin_settings_framelayout)
        with utils.FrameLayout(label=box_label,
                               collapsable=True,
                               width=345,
                               collapse=True,
                               parent=parent) as plugin_settings_framelayout:
            self.plugin_settings_framelayout = plugin_settings_framelayout
            element_list.append(plugin_settings_framelayout)
            with utils.Row(2,
                           2, (100, 200), ("left", "left"),
                           parent=plugin_settings_framelayout) as threadsRow:
                element_list.append(threadsRow)
                maya.text(label="Threads:    ", align="right")
                self._threads = maya.int_field(
                    changeCommand=self.set_threads,
                    annotation=
                    "The maximum number of parallel threads to use for uploading of assets",
                    height=25,
                    minValue=1,
                    maxValue=40,
                    enable=True,
                    value=self.base.threads)

            with utils.Row(2,
                           2, (100, 200), ("left", "center"),
                           parent=plugin_settings_framelayout) as loggingRow:
                element_list.append(loggingRow)
                maya.text(label="Logging:    ", align="right")
                with utils.Dropdown(self.set_logging) as log_settings:
                    self._logging = log_settings
                    self._logging.add_item("Debug")
                    self._logging.add_item("Info")
                    self._logging.add_item("Warning")
                    self._logging.add_item("Error")
Ejemplo n.º 12
0
 def display_watcher(self):
     """Display output download directory selection elements for
     job watcher.
     :returns: Text field object for directory path.
     """
     with utils.Row(3, 2, (100,190,40), ("right","center","center"),
                    parent=self.job_details) as row:
         self.content.append(row)
         self.content.append(maya.text(label="Outputs:   ", align="right"))
         input = maya.text_field(text=self.selected_dir, editable=False)
         self.content.append(maya.symbol_button(
             image="SP_DirOpenIcon.png",
             command=self.select_dir,
             annotation="Select Download Directory"))
     return input, row
Ejemplo n.º 13
0
    def init_after_batch_account_selected(self):
        if self.account_ui_elements:
            maya.delete_ui(self.account_ui_elements)
        self.account_ui_elements = []
        self.account_status = "Batch Account Configured"
        with utils.Row(
                2,
                2, (100, 200), ("left", "left"),
                parent=self.batch_account_framelayout) as storageAccountRow:
            self.account_ui_elements.append(storageAccountRow)
            maya.text(label="Storage Account:", align="right")
            self.storage_account_field = maya.text_field(
                height=25,
                enable=True,
                editable=False,
                text=self.base.storage_account)

        self.draw_threads_and_logging_rows(self.frames_layout,
                                           self.account_ui_elements)

        maya.form_layout(self.page, edit=True, enable=True)
        self.settings.init_after_account_selected()
Ejemplo n.º 14
0
    def change_subscription_button_pressed(self, *args):
        self.account_status = "Loading"
        maya.refresh()
        maya.form_layout(self.page, edit=True, enable=False)
        if self.subscription_row is not None:
            maya.delete_ui(self.subscription_row)
        if self.subscription_ui_elements is not None and not len(
                self.subscription_ui_elements) == 0:
            maya.delete_ui(self.subscription_ui_elements)
        if self.batch_account_row is not None:
            maya.delete_ui(self.batch_account_row)
        if self.account_ui_elements:
            maya.delete_ui(self.account_ui_elements)
        with utils.Row(
                2,
                2, (100, 200), ("left", "left"),
                parent=self.batch_account_framelayout) as subscriptionRow:
            self.subscription_row = subscriptionRow
            maya.text(label="Subscription:    ", align="right")
            with utils.Dropdown(self.select_subscription_in_dropdown
                                ) as subscription_dropdown:
                self._subscription_dropdown = subscription_dropdown
            self.account_ui_elements = []
            subscriptions = self.base.available_subscriptions()
            self.subscriptions_by_displayname = dict([
                (sub.display_name, sub) for sub in subscriptions
            ])
            self._subscription_dropdown.add_item(
                "")  #dummy value so dropdown appears empty
            for sub in subscriptions:
                self._subscription_dropdown.add_item(sub.display_name)
            maya.menu(self._subscription_dropdown.menu, edit=True, enable=True)
            self.account_status = "Please select Subscription"

        self.draw_threads_and_logging_rows(self.frames_layout,
                                           self.account_ui_elements)
        maya.form_layout(self.page, edit=True, enable=True)
        maya.refresh()
Ejemplo n.º 15
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)
Ejemplo n.º 16
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.label = "Submit"
        self.page = maya.form_layout(enableBackground=True)
        self.select_pool_type = self.AUTO_POOL
        self.select_dedicated_instances = 1
        self.select_low_pri_instances = 0

        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
                maya.col_layout(numberOfColumns=2,
                                columnWidth=((1, 100), (2, 200)),
                                rowSpacing=(1, 10),
                                rowOffset=((1, "top", 20), ))
                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)
                maya.parent()
                self.pool_config = []
                self.pool_config.append(
                    maya.col_layout(numberOfColumns=4,
                                    columnWidth=((1, 100), (2, 50), (3, 100),
                                                 (4, 50)),
                                    rowSpacing=(1, 10),
                                    rowOffset=((1, "bottom", 20), ),
                                    parent=self.pool_settings))
                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]))
                maya.parent()

            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)

        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)
Ejemplo n.º 17
0
    def __init__(self, base, frame):
        """Create 'Config' tab and add to UI frame.

        :param base: The base class for handling configuration and
         auth-related functionality.
        :type base: :class:`.AzureBatchConfig`
        :param frame: The shared plug-in UI frame.
        :type frame: :class:`.AzureBatchUI`
        """
        self.base = base
        self.label = "Config"
        self.ready = False
        self.page = maya.form_layout()

        with utils.ScrollLayout(height=520, parent=self.page) as scroll:
            self.heading = maya.text(label="Authenticating plug-in...",
                                        align="center", font="boldLabelFont")
            with utils.Row(2, 2, (70,260), ("left","left"),
                           [(1, "top", 15),(2,"top",15)]):
                maya.text(label="Status: ", align="left")
                self.auth_status = maya.text(label="", align="left")
            
            with utils.Row(2, 2, (70,260), ("left","left")):
                maya.text(label="Service:    ", align="left")
                self._endpoint = maya.text_field(height=25, enable=True)
            
            #TODO: Allow set to 0 to disable threads
            with utils.Row(2, 2, (70,260), ("left","left")):
                maya.text(label="Threads:    ", align="left")
                self._threads = maya.int_field(
                    changeCommand=self.set_threads,
                    height=25,
                    minValue=1,
                    maxValue=40,
                    enable=True,
                    value=20)
            
            with utils.Row(2, 2, (70,260), ("left","center"),
                           [(1, "bottom", 20),(2,"bottom",15)]):
                maya.text(label="Logging:    ", align="left")
                with utils.Dropdown(self.set_logging) as log_settings:
                    self._logging = log_settings
                    self._logging.add_item("Debug")
                    self._logging.add_item("Info")
                    self._logging.add_item("Warning")
                    self._logging.add_item("Error")

            box_label = "Azure Authentication Settings"
            with utils.FrameLayout(label=box_label, collapsable=True):
                with utils.Row(2, 2, (140, 180), ("right","center"),
                               [(1, "top", 20),(2, "top", 15)]):
                    maya.text(label="Batch Account:   ", align="right")
                    self._account = maya.text_field(height=25, enable=True)

                with utils.Row(2, 2, (140, 180), ("right","center"),
                               [(1, "bottom", 20),(2,"bottom",15)]):
                    maya.text(label="Batch Key:   ", align="right")
                    self._key = maya.text_field(height=25, enable=True)

                with utils.Row(2, 2, (140, 180), ("right","center"),
                               [(1, "bottom", 20),(2,"bottom",15)]):
                    maya.text(label="Storage Account:   ", align="right")
                    self._storage = maya.text_field(height=25, enable=True)

                with utils.Row(2, 2, (140, 180), ("right","center"),
                               [(1, "bottom", 20),(2,"bottom",15)]):
                    maya.text(label="Storage Key:   ", align="right")
                    self._storage_key = maya.text_field(height=25, enable=True)

        with utils.Row(1, 1, 355, "center", (1, "bottom",0)) as btn:
            self._authenticate = maya.button(label="Authenticate",
                                             command=self.authenticate,
                                             enable=True)
        maya.form_layout(self.page, edit=True,
                         attachForm=[(scroll, 'top', 5),
                                     (scroll, 'left', 5), (scroll, 'right', 5),
                                     (btn, 'bottom', 5),
                                     (btn, 'left', 0), (btn, 'right', 0)],
                         attachControl=(scroll, "bottom", 5, btn))
        frame.add_tab(self)
        maya.form_layout(self.page, edit=True, enable=False)
        maya.refresh()
Ejemplo n.º 18
0
 def on_expand(self):
     """Command for the expanding of the job reference frame layout.
     Loads latest details for the specified job and populates UI.
     """
     with utils.Row(2, 2, (100,220), parent=self.job_details) as row:
         self.content.append(row)
         self.content.append(maya.text(label=""))
         self._thumbnail = maya.image()
         self.content.append(self._thumbnail)
     self._status, st_row = self.display_info("Status:   ")
     self._progress, pr_row = self.display_info("Progress:   ")
     self._submission, sb_row = self.display_info("Submitted:   ")
     self._tasks, tk_row = self.display_info("Task Count:   ")
     self._job, jb_row = self.display_data("Job ID:   ")
     self._pool, pl_row = self.display_data("Pool:   ")
     self._dir, dr_row = self.display_watcher()
     self.refresh_button = self.display_button(
         "btn_refresh.png", self.refresh, "Refresh")
     self.view_button = self.display_button(
         "btn_portal.png", self.open_portal,
         "View this job in the portal")
     self.watch_button = self.display_button(
         "btn_background.png", self.start_watcher,
         "Watch this job in the background")
     self.cancel_button = self.display_button(
         "btn_cancel.png", self.cancel_job, "Cancel this job")
     self.delete_button = self.display_button(
         "btn_delete.png",self.delete_job, "Delete job")
     maya.form_layout(
         self.job_details, edit=True,
         attachForm=[(row,"top",5), (row,"left",5), (row,"right",5),
                     (st_row,"left",5), (st_row,"right",5),
                     (pr_row,"left",5), (pr_row,"right",5),
                     (sb_row,"left",5), (sb_row,"right",5),
                     (tk_row,"left",5), (tk_row,"right",5),
                     (jb_row,"left",5), (jb_row,"right",5),
                     (pl_row,"left",5), (pl_row,"right",5),
                     (dr_row,"left",5), (dr_row,"right",5),
                     (self.refresh_button,"left",5),
                     (self.delete_button,"right",5),
                     (self.refresh_button,"bottom",5),
                     (self.view_button,"bottom",5),
                     (self.watch_button,"bottom",5),
                     (self.cancel_button,"bottom",5),
                     (self.delete_button,"bottom",5)],
        attachControl=[(st_row,"top",5, row),
                       (pr_row,"top",5, st_row),
                       (sb_row,"top",5, pr_row),
                       (tk_row,"top",5, sb_row),
                       (jb_row,"top",5, tk_row),
                       (pl_row,"top",5, jb_row),
                       (dr_row,"top",5, pl_row),
                       (self.refresh_button,"top",5, dr_row),
                       (self.view_button,"top",5, dr_row),
                       (self.watch_button,"top",5, dr_row),
                       (self.cancel_button,"top",5, dr_row),
                       (self.delete_button, "top", 5, dr_row)],
         attachPosition=[(self.refresh_button, 'right', 5, 20),
                         (self.view_button, 'left', 5, 20),
                         (self.view_button, 'right', 5, 40),
                         (self.watch_button, 'right', 5, 60),
                         (self.watch_button, 'left', 5, 40),
                         (self.cancel_button, 'left', 5, 60),
                         (self.cancel_button, 'right', 5, 80),
                         (self.delete_button, 'left', 5, 80)])
     self.base.job_selected(self)
     maya.execute(self.base.load_tasks)
     maya.execute(self.base.get_thumbnail)  
     maya.refresh()
Ejemplo n.º 19
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.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()
Ejemplo n.º 20
0
    def init_post_config_file_read(self):
        maya.delete_ui(self.heading)
        self.heading = None
        box_label = "AzureActiveDirectory Authentication"
        aad_domain_hover_message = "Sign in to the Azure portal and hover over your account name on the upper right-hand side, your AAD Domain will be the bottom value shown, e.g. \"contoso.onmicrosoft.com\""

        with utils.FrameLayout(label=box_label,
                               collapsable=True,
                               width=345,
                               collapse=False,
                               parent=self.frames_layout) as aad_framelayout:
            self.aad_framelayout = aad_framelayout
        with utils.Row(1,
                       1, (300), ("left"), [1, "top", 15],
                       parent=self.aad_framelayout):
            self.auth_status_field = maya.text(label="", align="center")
        with utils.Row(2,
                       2, (100, 200), ("right", "center"),
                       parent=self.aad_framelayout) as aad_environment_row:
            self.aad_environment_row = aad_environment_row
            maya.text(label="Environment:   ",
                      align="right",
                      parent=self.aad_environment_row,
                      annotation=aad_domain_hover_message)

            with utils.Dropdown(
                    self.aad_environment_changed,
                    parent=aad_environment_row) as aad_environment_dropdown:
                self.aad_environment_dropdown = aad_environment_dropdown
                for id in self.base.aad_environment_provider.getAADEnvironments(
                ):
                    self.aad_environment_dropdown.add_item(id)
                if self.base.aad_environment_id:
                    self.aad_environment_dropdown.select(
                        self.base.aad_environment_id)
                else:
                    self.aad_environment_dropdown.select("AzureCloud")

        with utils.Row(2,
                       2, (100, 200), ("right", "center"),
                       parent=self.aad_framelayout) as aad_tenant_row:
            self.aad_tenant_row = aad_tenant_row
            maya.text(label="AAD Domain:   ",
                      align="right",
                      parent=self.aad_tenant_row,
                      annotation=aad_domain_hover_message)

            #Registering changeCommand captures changes to the field when not confirmed with enter.
            #Registering enterCommand with alwaysInvokeEnterCommandOnReturn allows the same value to be reentered so as to generate a new login prompt.
            self.aad_tenant_field = maya.text_field(
                height=25,
                enable=True,
                changeCommand=self.aad_tenant_name_changed,
                enterCommand=self.aad_tenant_name_changed,
                alwaysInvokeEnterCommandOnReturn=True,
                annotation=aad_domain_hover_message,
                parent=self.aad_tenant_row)

        maya.form_layout(self.page,
                         edit=True,
                         enable=False,
                         attachForm=[(self.scroll_layout, 'top', 5),
                                     (self.scroll_layout, 'left', 5),
                                     (self.scroll_layout, 'right', 5)])

        cached_tenant_name = self.base.aad_tenant_name
        if cached_tenant_name and cached_tenant_name != None and cached_tenant_name != 'None':
            maya.text_field(self.aad_tenant_field,
                            edit=True,
                            text=cached_tenant_name)
Ejemplo n.º 21
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()
Ejemplo n.º 22
0
    def init_from_config(self):
        maya.delete_ui(self.auth_temp_ui_elements)
        self.subscription_ui_elements = []
        box_label = "Batch Account Settings"
        with utils.FrameLayout(
                label=box_label,
                collapsable=True,
                width=345,
                collapse=False,
                parent=self.frames_layout) as batch_account_framelayout:
            self.batch_account_framelayout = batch_account_framelayout
            with utils.Row(1,
                           1, (300), ("left"), [1, "top", 15],
                           parent=self.batch_account_framelayout):
                self.account_status_field = maya.text(label="", align="center")
                self.account_status = maya.text(label="", align="center")

            with utils.Row(3, 3, (100, 170, 30),
                           ("left", "left", "left")) as subscriptionRow:
                maya.text(label="Subscription:    ", align="left")
                with utils.Dropdown(self.select_subscription_in_dropdown,
                                    enable=False) as subscription_dropdown:
                    self._subscription_dropdown = subscription_dropdown
                    self.subscription_ui_elements.append(
                        self._subscription_dropdown)
                    self._subscription_dropdown.add_item(
                        self.base.subscription_name)

                self._change_subscription_button = maya.button(
                    label="Change",
                    command=self.change_subscription_button_pressed,
                    width=30)
                self.subscription_row = subscriptionRow

            with utils.Row(3, 3, (100, 170, 30),
                           ("left", "left", "left")) as batch_account_row:
                maya.text(label="Batch Account:    ", align="left")
                maya.refresh()
                with utils.Dropdown(self.select_account_in_dropdown,
                                    enable=False) as account_dropdown:
                    self._account_dropdown = account_dropdown
                    self._account_dropdown.add_item(self.base.batch_account)

                self._change_batch_account_button = maya.button(
                    label="Change",
                    command=self.change_batch_account_button_pressed,
                    width=30)
                self.batch_account_row = batch_account_row

            #TODO test the case that autostorage is removed from a stored account in config
            self.account_ui_elements = []
            with utils.Row(2,
                           2, (100, 200), ("left", "left"),
                           parent=self.batch_account_framelayout
                           ) as storageAccountRow:
                self.account_ui_elements.append(storageAccountRow)
                maya.text(label="Storage Account:", align="left")
                self.storage_account_field = maya.text_field(
                    height=25,
                    enable=True,
                    editable=False,
                    text=self.base.storage_account)

            self.draw_threads_and_logging_rows(self.frames_layout,
                                               self.account_ui_elements)

        self.account_status = "Batch Account Configured"
        self.auth_status = "Authenticated"
        self.disable(True)
        maya.form_layout(self.page, edit=True, enable=True)
        maya.refresh()
Ejemplo n.º 23
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."))