Exemple #1
0
    def set_custom_hardware(self, custom_hardware, task_info, task_path):
        """Check whether the hardware configuration information exists and whether it meets the requirements."""
        hardware_config_list = self.api.user.get_hardware_config()
        platform = task_info['task_info']['platform']
        cg_id = task_info['task_info']['cg_id']
        plugins = task_info['software_config']['plugins']
        check_keys = ['model', 'ram', 'gpuNum']
        gpu_num = custom_hardware.get('gpuNum')
        hardware_id = ''
        for one_hardware_config in hardware_config_list:
            if not one_hardware_config['status']:
                continue
            not_support_cgid = one_hardware_config['notSupportCgId']
            if not_support_cgid and cg_id in not_support_cgid:
                if all(map(lambda key: custom_hardware[key] == one_hardware_config[key], check_keys)):
                    raise NotSupportCGSoftwareError
            if one_hardware_config['platform'] != int(platform):
                continue
            if not all(map(lambda key: custom_hardware[key] == one_hardware_config[key], check_keys)):
                continue
            not_support_plugin_list = one_hardware_config['notSupportPluginList']
            if not_support_plugin_list:
                for plugin_str in not_support_plugin_list:
                    new_plugin_str = plugin_str.replace("(", "").replace(")", "")
                    for plugin_name, plugin_ver in plugins.items():
                        plugin_data = "%s %s" % (plugin_name, plugin_ver)
                        re_result = re.findall(new_plugin_str, plugin_data, re.I)
                        if re_result and re_result[0]:
                            raise NotSupportPluginError

            hardware_id = str(one_hardware_config.get('id', ""))

        if not hardware_id:
            raise HardwareConfigIdError

        update_hardware_config = {
            "hardwareConfigId": hardware_id,
            "ram": custom_hardware["ram"].replace("GB", ""),
            "graphics_cards_num": gpu_num[0] if gpu_num else "2"
        }
        update_task_info(update_hardware_config, task_path)
    "plugin_config": {
        "KtoA": "2.4.0.3"
    },
    "platform": render_para['platform']
}

analyze_obj = AnalyzeKatana(**analyze_info)
analyze_obj.analyse()


# Step2: Add some custom parameters, or update the original parameter value
update_task = {
    "pre_frames": "100",
    "stop_after_test": "1"
}
update_task_info(update_task, analyze_obj.task_json)

custom_info_to_task = {}
append_to_task(custom_info_to_task, analyze_obj.task_json)

custom_info_to_upload = [
    r"F:\cache\add.png",
    r"F:\cache\ass.jpg",
    r"F:\cache\back3.jpg",
    r"F:\cache\back10.jpg",
    r"F:\cache\cizhuan.jpg",
    r"F:\cache\plane.abc",
    r"F:\cache\plane.abc",
]
append_to_upload(custom_info_to_upload, analyze_obj.upload_json)