Beispiel #1
0
    def _get_clarisse_package(self):
        """
        Package id and name for chosen Clarisse version.

        Returns:
            dict: name and id.
        """
        package_tree = ConductorDataBlock(product="clarisse").package_tree()
        clarisse_version_att = self.node.get_attribute("clarisse_version")
        name = clarisse_version_att.get_applied_preset_label()
        package = package_tree.find_by_name(name)
        return {"name": name, "id": package.get("package_id")}
Beispiel #2
0
 def _get_package_ids(self):
     """Package Ids for chosen packages."""
     package_tree = ConductorDataBlock(product="clarisse").package_tree()
     paths = ix.api.CoreStringArray()
     self.node.get_attribute("packages").get_values(paths)
     results = []
     for path in paths:
         name = path.split("/")[-1]
         package = package_tree.find_by_name(name)
         if package:
             package_id = package.get("package_id")
             if package_id:
                 results.append(package_id)
     return results
 def _get_package_ids(self):
     """Package Ids for chosen packages."""
     package_tree = ConductorDataBlock(product="clarisse").package_tree()
     paths = ix.api.CoreStringArray()
     self.node.get_attribute("packages").get_values(paths)
     results = []
     for path in paths:
         name = path.split("/")[-1]
         package = package_tree.find_by_name(name)
         if package:
             package_id = package.get("package_id")
             if package_id:
                 results.append(package_id)
     return results
    def refresh(_, **kw):
        """Respond to do_setup button click.

        Update UI for projects and instances from the data block. kwargs
        may contain the force keyword, which will invalidate the
        datablock and fetch fresh from Conductor. We may as well update
        all ConductorJob nodes.
        """
        kw["product"] = "clarisse"
        data_block = ConductorDataBlock(**kw)
        nodes = ix.api.OfObjectArray()
        ix.application.get_factory().get_all_objects("ConductorJob", nodes)

        host = ClarisseInfo().get()
        detected_host_paths = data_block.package_tree().get_all_paths_to(
            **host)

        for obj in nodes:

            projects_ui.update(obj, data_block)
            instances_ui.update(obj, data_block)
            frames_ui.update_frame_stats_message(obj)

            title_attr = obj.get_attribute("title")
            if not title_attr.get_string():
                title_attr.set_expression(
                    '"Clarisse: {} "+$CT_SEQUENCE'.format(obj.get_name()))

            task_template_attr = obj.get_attribute("task_template")
            if not task_template_attr.get_string():
                expr = '"ct_cnode "+$PDIR+"/"+$PNAME+".render -image "'
                expr += '+$CT_SOURCES+" -image_frames_list "+$CT_CHUNKS +'
                expr += '" -directories "+$CT_DIRECTORIES'
                task_template_attr.set_expression(expr)
            task_template_attr.set_locked(True)

            packages_attr = obj.get_attribute("packages")
            if not packages_attr.get_value_count():
                for path in detected_host_paths:
                    packages_attr.add_string(path)

            inst_type_attr = obj.get_attribute("instance_type")
            if not inst_type_attr.get_long():
                inst_type_attr.set_long(1)

            project_attr = obj.get_attribute("project")
            if not project_attr.get_long():
                project_attr.set_long(1)
Beispiel #5
0
    def refresh(_, **kw):
        """Respond to do_setup button click.

        Update UI for projects and instances from the data block. kwargs
        may contain the force keyword, which will invalidate the
        datablock and fetch fresh from Conductor. We may as well update
        all ConductorJob nodes.
        """
        kw["product"] = "clarisse"
        data_block = ConductorDataBlock(**kw)
        nodes = ix.api.OfObjectArray()
        ix.application.get_factory().get_all_objects("ConductorJob", nodes)

        host = ClarisseInfo().get()
        detected_host_paths = data_block.package_tree().get_all_paths_to(
            **host)

        for obj in nodes:

            projects_ui.update(obj, data_block)
            instances_ui.update(obj, data_block)
            frames_ui.update_frame_stats_message(obj)

            title_attr = obj.get_attribute("title")
            if not title_attr.get_string():
                title_attr.set_expression(
                    '"Clarisse: {} "+$CT_SEQUENCE'.format(obj.get_name()))

            task_template_attr = obj.get_attribute("task_template")
            if not task_template_attr.get_string():
                expr = '"ct_cnode "+$PDIR+"/"+$PNAME+".render -image "'
                expr += '+$CT_SOURCES+" -image_frames_list "+$CT_CHUNKS +'
                expr += '" -directories "+$CT_DIRECTORIES'
                task_template_attr.set_expression(expr)
            task_template_attr.set_locked(True)

            packages_attr = obj.get_attribute("packages")
            if not packages_attr.get_value_count():
                for path in detected_host_paths:
                    packages_attr.add_string(path)

            inst_type_attr = obj.get_attribute("instance_type")
            if not inst_type_attr.get_long():
                inst_type_attr.set_long(1)

            project_attr = obj.get_attribute("project")
            if not project_attr.get_long():
                project_attr.set_long(1)
Beispiel #6
0
    def _get_instance(self):
        """Get everything related to the instance.

        Get the machine type, preemptible flag, and number of retries if
        preemptible. We use the key from the instance_type menu and look
        up the machine spec in the shared data where the full list of
        instance_types is stored. When exhaustion API is in effect, the
        list of available types may be dynamic, so wetell the user to
        refresh.
        """
        instance_types = ConductorDataBlock(
            product="clarisse").instance_types()
        label = self.node.get_attribute(
            "instance_type").get_applied_preset_label()

        result = {
            "preemptible": self.node.get_attribute("preemptible").get_bool(),
            "retries": self.node.get_attribute("retries").get_long(),
        }

        try:
            found = next(it for it in instance_types
                         if str(it['description']) == label)
        except StopIteration:
            ix.log_error(
                "Invalid instance type \"{}\". Try a refresh.".format(label))

        result.update(found)
        return result
Beispiel #7
0
    def _get_environment(self):
        """Collect all environment variables.

        Collect variables specified by the packages, and add those
        specified by the user.
        """
        package_tree = ConductorDataBlock(product="clarisse").package_tree()

        paths = ix.api.CoreStringArray()
        self.node.get_attribute("packages").get_values(paths)
        paths = list(paths)
        package_env = package_tree.get_environment(paths)

        extra_vars = self._get_extra_env_vars()
        package_env.extend(extra_vars)
        return package_env
    def _get_environment(self):
        """Collect all environment variables.

        Collect variables specified by the packages, and add those
        specified by the user.
        """
        package_tree = ConductorDataBlock(product="clarisse").package_tree()

        paths = ix.api.CoreStringArray()
        self.node.get_attribute("packages").get_values(paths)
        paths = list(paths)
        package_env = package_tree.get_environment(paths)

        extra_vars = self._get_extra_env_vars()
        package_env.extend(extra_vars)
        return package_env
Beispiel #9
0
    def on_detect_but(self, sender, eventid):
        """Select the current package if available in the list."""
        host = ClarisseInfo().get()
        paths = ConductorDataBlock(
            product="clarisse").package_tree().get_all_paths_to(
                **host)

        self.tree_widget.select_path_leaves(paths)
Beispiel #10
0
    def _get_environment(self):
        """
        Collect all environment variables.

        NOTE: Revisit and test the bespoke env added below in the amendments
        section.

        Returns:
            package_environment: Resolved package environment object.
        """

        package_tree = ConductorDataBlock(product="clarisse").package_tree()
        package_env = package_tree.get_environment(
            [self.clarisse_package["name"]])

        extra_vars = self._get_extra_env_vars()
        package_env.extend(extra_vars)

        # Special Amendments!
        # Clearly we need to find a better value for PYTHONHOME and add it in
        # the sidecar
        amendments = [
            {
                "name": "PYTHONHOME",
                "value": "/opt/silhouettefx/silhouette/7/silhouette-7.5.2",
                "merge_policy": "exclusive",
            },
            {
                "name": "CONDUCTOR_PATHHELPER",
                "value": 0,
                "merge_policy": "exclusive"
            },
            {
                "name": "LD_LIBRARY_PATH",
                "value": "/usr/lib/python2.7/config-x86_64-linux-gnu",
                "merge_policy": "append",
            },
        ]
        package_env.extend(amendments)

        return package_env
Beispiel #11
0
    def __init__(self, parent, x_val, y_val, width, height):
        ix.api.GuiTree.__init__(self, parent, x_val, y_val, width, height)
        self.set_border_style(ix.api.GuiTree.BORDER_STYLE_FLAT)
        self.set_shaded_entries(True)
        self.enable_multi_selection(True)
        self.set_constraints(C_LEFT, C_TOP, C_RIGHT, C_BOTTOM)
        self.child_list = []

        tree_data = ConductorDataBlock(product="clarisse").package_tree().tree

        self.root_item = self.get_root()
        self._build_ui(tree_data, self.root_item)

        self.connect(self, 'EVT_ID_TREE_SELECTION_CHANGED', self.on_selection)
Beispiel #12
0
    def _get_project(self):
        """Get the project from the attr.

        Get its ID in case the current project is no longer in the list
        of projects at conductor, throw an error.
        """

        projects = ConductorDataBlock().projects()
        project_att = self.node.get_attribute("conductor_project_name")
        label = project_att.get_applied_preset_label()
        try:
            found = next(p for p in projects if str(p["name"]) == label)
        except StopIteration:
            ix.log_error(
                'Cannot find project "{}" at Conductor.'.format(label))

        return {"id": found["id"], "name": str(found["name"])}
Beispiel #13
0
def _validate_project(obj):
    """
    Check the project is set.

    Args:
        obj (ConductorJob):
    """
    projects = ConductorDataBlock().projects()
    project_att = obj.get_attribute("conductor_project_name")
    label = project_att.get_applied_preset_label()
    if label == PROJECT_NOT_SET["name"]:
        ix.log_error('Project is not set for "{}".'.format(obj.get_name()))
    try:
        next(p for p in projects if str(p["name"]) == label)
    except StopIteration:
        ix.log_error('Cannot find project "{}" at Conductor. \
                Please ensure the PROJECT dropdown contains a \
                valid project.'.format(label))
Beispiel #14
0
def refresh(_, **kw):
    """
    Respond to connect button click, and others that may benefit from a refresh.

    Update UI for projects and instances from the data block.

    Args:
        (kw["force"]): If true, invalidate the datablock and fetch fresh from
        Conductor. We update all ConductorJob nodes. Also update the log level
        in the UI.
    """

    kw["product"] = "clarisse"
    data_block = ConductorDataBlock(**kw)
    nodes = ix.api.OfObjectArray()
    ix.application.get_factory().get_all_objects("ConductorJob", nodes)

    for obj in nodes:
        projects_ui.update(obj, data_block)
        instances_ui.update(obj, data_block)
        clarisse_version_ui.update(obj, data_block)
        frames_ui.update_frame_stats_message(obj)

    debug_ui.refresh_log_level(nodes)