Example #1
0
    def RB_CONFIG(self):
        self.G_DEBUG_LOG.info('[Maya.RBconfig.start.....]')
        if self.G_CG_TILE_COUNT != self.G_CG_TILE:
            print(
                "----------------------------------------loading plugins start ------------------------------------------"
            )
            #kill maya
            CLASS_MAYA_UTIL.killMayabatch(
                self.G_DEBUG_LOG)  #kill mayabatch.exe
            # ----------------set env  -------------------
            os.environ["MAYA_UI_LANGUAGE"] = "en_US"
            os.environ['MAYA_DISABLE_CIP'] = '1'
            os.environ['MAYA_DISABLE_CLIC_IPM'] = '1'
            os.environ['MAYA_DISABLE_CER'] = '1'
            if int(self.CG_VERSION) >= 2016:
                os.environ['MAYA_OPENCL_IGNORE_DRIVER_VERSION'] = '1'
                os.environ['MAYA_VP2_DEVICE_OVERRIDE'] = 'VirtualDeviceDx11'
            if int(self.RENDER_LAYER_TYPE):
                os.environ['MAYA_ENABLE_LEGACY_RENDER_LAYERS'] = "0"
            else:
                os.environ['MAYA_ENABLE_LEGACY_RENDER_LAYERS'] = "1"
            # ----------------load maya plugin-------------------
            self.G_DEBUG_LOG.info('插件配置')
            if self.G_CG_CONFIG_DICT:
                sys.stdout.flush()
                custom_config = os.path.join(
                    self.G_NODE_MAYAFUNCTION,
                    self.G_CUSTOM_CONFIG_NAME).replace('\\', '/')
                if self.G_NODE_MAYAFUNCTION:
                    if os.path.exists(custom_config):
                        sys.stdout.flush()
                        print("custom_config is: " + custom_config)
                        sys.stdout.flush()
                    else:
                        print("Can not find the CustomConfig file: %s." %
                              custom_config)
                print("plugin path:")
                print(self.G_CG_CONFIG_DICT)
                sys.stdout.flush()
                maya_plugin = MayaPlugin(self.G_CG_CONFIG_DICT,
                                         [custom_config], self.G_USER_ID,
                                         self.G_TASK_ID, self.G_DEBUG_LOG)
                maya_plugin.config()
                sys.stdout.flush()
            print(
                "----------------------------------------loading plugins end ------------------------------------------"
            )
            self.G_DEBUG_LOG.info('[Maya.RBconfig.end.....]')

            # #------------get render cmd----------
            self.MAYA_FINAL_RENDER_CMD = self.get_render_cmd()
            self.G_DEBUG_LOG.info(self.MAYA_FINAL_RENDER_CMD)
        else:
            self.G_DEBUG_LOG.info(
                "[RenderNuke  Comp...........................]")
        self.G_DEBUG_LOG.info('[RenderMaya.RB_CONFIG.end.....]')
        self.format_log('done', 'end')
Example #2
0
 def RB_CONFIG(self):
     self.G_DEBUG_LOG.info('Analyse maya file is intact or not .... ')
     try:
         if self.check_maya_file_intact():
             self.G_DEBUG_LOG.info('%s  might be incomplete and corrupt. .... '%(self.G_INPUT_CG_FILE))
             self.cg_file_error = 1
             return 0
     except Exception as err:
         self.mylog_err(err)
         
     self.G_DEBUG_LOG.info('[Maya.RBconfig.start.....]')
     print("----------------------------------------config start ------------------------------------------")
     #kill maya       
     CLASS_MAYA_UTIL.killMayabatch(self.G_DEBUG_LOG)  #kill mayabatch.exe
     # ----------------set env  -------------------
     os.environ["MAYA_UI_LANGUAGE"] = "en_US"
     os.environ['MAYA_DISABLE_CIP'] = '1'
     os.environ['MAYA_DISABLE_CLIC_IPM'] = '1'
     os.environ['MAYA_DISABLE_CER'] = '1'
     if float(self.CG_VERSION)>=2016:
         os.environ['MAYA_OPENCL_IGNORE_DRIVER_VERSION'] = '1'
         os.environ['MAYA_VP2_DEVICE_OVERRIDE'] = 'VirtualDeviceDx11'
     if int(self.RENDER_LAYER_TYPE):
         os.environ['MAYA_ENABLE_LEGACY_RENDER_LAYERS'] = "0"
     else:
         os.environ['MAYA_ENABLE_LEGACY_RENDER_LAYERS'] = "1"
     # ----------------load maya plugin-------------------
     self.G_DEBUG_LOG.info('插件配置')
     if self.G_CG_CONFIG_DICT:           
         sys.stdout.flush()
         custom_config=os.path.join(self.G_NODE_MAYAFUNCTION,self.G_CUSTOM_CONFIG_NAME).replace('\\','/') 
         if self.G_NODE_MAYAFUNCTION:                 
             if os.path.exists(custom_config): 
                 sys.stdout.flush()
                 print("custom_config is: " + custom_config )               
                 sys.stdout.flush()
             else:
                 print("Can not find the CustomConfig file: %s." % custom_config)
         print(self.G_CG_CONFIG_DICT)
         sys.stdout.flush()
         maya_plugin=MayaPlugin(self.G_CG_CONFIG_DICT,[custom_config],self.G_USER_ID,self.G_TASK_ID,self.G_DEBUG_LOG,self.G_PLUGIN_PATH)
         maya_plugin.config()           
         sys.stdout.flush()      
     print("----------------------------------------config end ------------------------------------------")
     self.G_DEBUG_LOG.info('[Maya.RBconfig.end.....]')
Example #3
0
    def maya_cmd_callback(self, my_popen, my_log):
        exit_maya_on = 0
        while my_popen.poll() is None:
            result_line = my_popen.stdout.readline().strip()
            result_line = result_line.decode(sys.getfilesystemencoding())
            # result_line = result_line.decode('utf-8')
            result_line = self.bytes_to_str(result_line)
            result_line = self.to_gbk(result_line)
            if result_line == '':
                continue
            CLASS_COMMON_UTIL.log_print(my_log, result_line)

            if self.g_one_machine_multiframe is True:
                if '[_____render end_____]' in result_line:  # [_____render end_____][1]
                    frame = re.search('\[(-?\d+)\]', result_line).group(1)
                    self.multiframe_complete_list.append(frame)
                    end_time = int(time.time())
                    print('[self.render_record]: {}'.format(
                        self.render_record))
                    self.render_record[frame]['end_time'] = end_time
                    self.render_record[str(
                        int(frame) + int(self.G_CG_BY_FRAME))] = {
                            'start_time': end_time,
                            'end_time': -1
                        }

            if "License error" in result_line or "[mtoa] Failed batch render" in result_line or "error checking out license for arnold" in result_line or "No license for product (-1)" in result_line:
                self.exitcode = -1
                # CLASS_MAYA_UTIL.killMayabatch(my_log)
                return self.exitcode

            #任务渲染完,强制退出maya
            completed_key = "Scene %s completed" % (
                self.renderSettings["maya_file"])
            if completed_key in result_line:
                exit_maya_on = 1
                print("success maya batch end !!!")
                sys.stdout.flush()
                time.sleep(1)
                CLASS_MAYA_UTIL.killMayabatch(my_log)  # kill mayabatch.exe
                return exit_maya_on
Example #4
0
    def RB_RENDER(self):
        self.G_DEBUG_LOG.info('[maya.RBanalyse.start.....]')
        options = {}
        options["user_id"] = self.G_USER_ID
        options["task_id"] = self.G_TASK_ID
        options["cg_project"] = self.G_INPUT_PROJECT_PATH
        options["cg_file"] = self.G_INPUT_CG_FILE
        options["task_json"] = self.G_TASK_JSON
        options["asset_json"] = self.G_ASSET_JSON
        options["tips_json"] = self.G_TIPS_JSON
        options["cg_version"] = self.CG_VERSION
        options["cg_plugins"] = self.G_CG_CONFIG_DICT["plugins"]
        print("99999999999")
        self.G_DEBUG_LOG.info(options)
        mayabatch = ["C:/Program Files/Autodesk/Maya%s/bin/mayabatch.exe" % \
                     (options["cg_version"]),
                     "D:/Program Files/Autodesk/Maya%s/bin/mayabatch.exe" % \
                     (options["cg_version"]),
                     "E:/Program Files/Autodesk/Maya%s/bin/mayabatch.exe" % \
                     (options["cg_version"]),
                     "F:/Program Files/Autodesk/Maya%s/bin/mayabatch.exe" % \
                     (options["cg_version"]),
                     "D:/Alias/Maya%sx64/bin/mayabatch.exe" % (options["cg_version"])]

        mayabatch = [i for i in mayabatch if os.path.isfile(i)]
        if mayabatch:
            mayabatch = mayabatch[0]
        else:
            print("there no Maya%s" % options["cg_version"])
            sys.exit(555)

        if self.G_RENDER_OS == '0':
            mayabatch = '/usr/autodesk/' + self.G_CG_VERSION + '-x64/bin/mayabatch.exe'
            if not os.path.exists(mayabatch):
                mayabatch = '/usr/autodesk/' + self.G_CG_VERSION + '/bin/mayabatch.exe'

        mayabatch = mayabatch.replace('\\', '/')
        # self.G_AN_MAYA_FILE=os.path.join(self.G_NODE_MAYASCRIPT,'Analyze.py').replace('\\','/')
        # analyse_cmd = "%s %s --ui %s --ti %s --proj %s --cgfile %s --taskjson %s --assetjson %s --tipsjson %s" %(mayaExePath,self.G_AN_MAYA_FILE,self.G_USER_ID,self.G_TASK_ID,self.G_INPUT_PROJECT_PATH,self.G_INPUT_CG_FILE,self.G_TASK_JSON,self.G_ASSET_JSON,self.G_TIPS_JSON)
        # print analyse_cmd
        str_options = re.sub(r"\\\\", r"/", repr(options))
        str_dir = self.G_NODE_MAYASCRIPT.replace("\\", "/")
        analyse_cmd = "\"%s\" -command \"python \\\"options=%s;" \
              "import sys;sys.path.insert(0, '%s');import Analyze;reload(Analyze);" \
              "Analyze.analyze_maya(options)\\\"" % \
              (mayabatch, str_options, str_dir)

        print(analyse_cmd)
        self.G_FEE_PARSER.set('render', 'start_time', str(int(time.time())))
        self.G_DEBUG_LOG.info(
            "\n\n-------------------------------------------Start maya program-------------------------------------\n\n"
        )
        # analyse_cmd = analyse_cmd.encode(sys.getfilesystemencoding())
        print("analyse cmd info:\n")
        self.G_DEBUG_LOG.info(analyse_cmd)
        analyze_code, analyze_result = CLASS_COMMON_UTIL.cmd(
            analyse_cmd,
            my_log=self.G_DEBUG_LOG,
            continue_on_error=True,
            my_shell=True,
            callback_func=self.maya_cmd_callback)
        print(analyze_code, analyze_result)
        print(self.tips_info_dict)
        if self.tips_info_dict:
            self.write_tips_info()
            self.G_DEBUG_LOG.info("write tips info_2 ok.")
        CLASS_MAYA_UTIL.kill_lic_all(my_log=self.G_DEBUG_LOG)
        self.G_FEE_PARSER.set('render', 'end_time', str(int(time.time())))
        self.G_DEBUG_LOG.info('[maya.RBanalyse.end.....]')
Example #5
0
    def RB_CONFIG(self):
        self.G_DEBUG_LOG.info('[Maya.RBconfig.start.....]')
        # try:
        # if float(self.CG_VERSION)==2017:
        # os.system ("robocopy /e /ns /nc /nfl /ndl /np  \"//10.70.242.102/render_p/script/User/100000056/maya2017\"  \"C:/Program Files/Autodesk/Maya2017/scripts/others\"" )
        # except Exception as err:
        # self.G_DEBUG_LOG.infor(err)

        if self.G_CG_TILE_COUNT != self.G_CG_TILE:
            print(
                "----------------------------------------loading plugins start ------------------------------------------"
            )
            #kill maya
            CLASS_MAYA_UTIL.killMayabatch(
                self.G_DEBUG_LOG)  #kill mayabatch.exe
            # ----------------set env  -------------------
            os.environ["MAYA_UI_LANGUAGE"] = "en_US"
            os.environ['MAYA_DISABLE_CIP'] = '1'
            os.environ['MAYA_DISABLE_CLIC_IPM'] = '1'
            os.environ['MAYA_DISABLE_CER'] = '1'
            if float(self.CG_VERSION) >= 2016:
                os.environ['MAYA_OPENCL_IGNORE_DRIVER_VERSION'] = '1'
                os.environ['MAYA_VP2_DEVICE_OVERRIDE'] = 'VirtualDeviceDx11'
            if int(self.RENDER_LAYER_TYPE):
                os.environ['MAYA_ENABLE_LEGACY_RENDER_LAYERS'] = "0"
            else:
                os.environ['MAYA_ENABLE_LEGACY_RENDER_LAYERS'] = "1"
            # ----------------load maya plugin-------------------
            self.G_DEBUG_LOG.info('插件配置')
            if self.G_CG_CONFIG_DICT:
                sys.stdout.flush()
                custom_config = os.path.join(
                    self.G_NODE_MAYAFUNCTION,
                    self.G_CUSTOME_CONFIG_NAME).replace('\\', '/')
                if self.G_NODE_MAYAFUNCTION:
                    if os.path.exists(custom_config):
                        sys.stdout.flush()
                        print("custom_config is: " + custom_config)
                        sys.stdout.flush()
                    else:
                        print("Can not find the CustomConfig file: %s." %
                              custom_config)
                print("plugin path:")
                print(self.G_CG_CONFIG_DICT)
                sys.stdout.flush()
                maya_plugin = MayaPlugin(self.G_CG_CONFIG_DICT,
                                         [custom_config], self.G_USER_ID,
                                         self.G_TASK_ID, self.G_DEBUG_LOG)
                maya_plugin.config()
                sys.stdout.flush()
            print(
                "----------------------------------------loading plugins end ------------------------------------------"
            )
            self.G_DEBUG_LOG.info('[Maya.RBconfig.end.....]')

            # #------------get render cmd----------
            self.MAYA_FINAL_RENDER_CMD = self.get_render_cmd()
            self.G_DEBUG_LOG.info(self.MAYA_FINAL_RENDER_CMD)
        else:
            self.G_DEBUG_LOG.info(
                "[RenderNuke  Comp...........................]")
        self.G_DEBUG_LOG.info('[RenderMaya.RB_CONFIG.end.....]')
        self.format_log('done', 'end')
Example #6
0
    def get_render_cmd(self):
        self.renderSettings = {}
        self.mappings = {}
        render_cmd = ''

        if self.G_RENDER_OS == '0':
            if float(self.CG_VERSION) < 2016:
                version_name = "%s-x64" % (self.CG_VERSION)
            else:
                version_name = self.CG_VERSION
            self.renderSettings["render.exe"] = "/usr/autodesk/" \
                "maya%s/bin/Render" % (version_name)
            self.renderSettings["mayabatch.exe"] = "/usr/autodesk/" \
                "maya%s/bin/maya -batch" % (version_name)
        self.renderSettings["render.exe"] = "C:/Program Files/Autodesk/" \
            "maya%s/bin/render.exe" % (self.CG_VERSION)
        self.renderSettings["output"] = os.path.normpath(
            self.G_WORK_RENDER_TASK_OUTPUT).replace("\\", "/")

        # 一机多帧
        self.renderSettings[
            "g_one_machine_multiframe"] = self.g_one_machine_multiframe
        if self.g_one_machine_multiframe is True:
            self.renderSettings["output"] = os.path.join(
                os.path.normpath(self.G_WORK_RENDER_TASK_OUTPUT),
                "temp_out").replace("\\", "/")
        self.renderSettings["output_frame"] = os.path.normpath(
            self.G_WORK_RENDER_TASK_OUTPUT).replace("\\", "/")

        if not os.path.exists(self.renderSettings["output"]):
            os.makedirs(self.renderSettings["output"])

        self.renderSettings["tile_region"] = ""
        self.renderSettings["tiles"] = int(self.G_CG_TILE_COUNT)
        self.renderSettings["tile_index"] = int(self.G_CG_TILE)
        # -----------render tiles------------
        if self.renderSettings["tiles"] > 1:
            tile_region = self.get_region(
                int(self.G_CG_TILE_COUNT), int(self.G_CG_TILE),
                int(self.G_TASK_JSON_DICT['scene_info_render'][
                    self.G_CG_LAYER_NAME]['common']['width']),
                int(self.G_TASK_JSON_DICT['scene_info_render'][
                    self.G_CG_LAYER_NAME]['common']['height']))
            self.renderSettings["tile_region"] = " ".join(
                [str(i) for i in tile_region])

            self.renderSettings["output"] = "%s/%s/%s/" % \
                (os.path.normpath(self.G_WORK_RENDER_TASK_OUTPUT).replace("\\", "/"),self.G_CG_START_FRAME,
                 self.renderSettings["tile_index"])
            self.renderSettings["output"] = os.path.normpath(
                self.renderSettings["output"])
            if not os.path.exists(self.renderSettings["output"]):
                os.makedirs(self.renderSettings["output"])

        if self.G_INPUT_PROJECT_PATH:
            if os.path.exists(self.G_INPUT_PROJECT_PATH):
                os.chdir(self.G_INPUT_PROJECT_PATH)

        self.renderSettings["maya_file"] = os.path.normpath(
            self.G_INPUT_CG_FILE)
        self.renderSettings["start"] = self.G_CG_START_FRAME
        self.renderSettings["end"] = self.G_CG_END_FRAME
        self.renderSettings["by"] = self.G_CG_BY_FRAME

        self.renderSettings["renderableCamera"] = self.G_CG_OPTION
        self.renderSettings["renderableLayer"] = self.G_CG_LAYER_NAME
        self.renderSettings["projectPath"] = os.path.normpath(
            self.G_INPUT_PROJECT_PATH)
        self.renderSettings["renderType"] = "render.exe"
        if self.ENABLE_LAYERED == "1":
            self.renderSettings["width"] = int(
                self.G_TASK_JSON_DICT['scene_info_render'][
                    self.G_CG_LAYER_NAME]['common']['width'])
            self.renderSettings["height"] = int(
                self.G_TASK_JSON_DICT['scene_info_render'][
                    self.G_CG_LAYER_NAME]['common']['height'])
        else:
            self.renderSettings["width"] = int(
                self.G_TASK_JSON_DICT['scene_info_render']
                ['defaultRenderLayer']['common']['width'])
            self.renderSettings["height"] = int(
                self.G_TASK_JSON_DICT['scene_info_render']
                ['defaultRenderLayer']['common']['height'])

        #"-----------------------------cmd--------------------------------"
        cmd = "\"%(render.exe)s\" -s %(start)s -e %(end)s -b %(by)s " \
            "-proj \"%(projectPath)s\" -rd \"%(output)s\"" \
            % self.renderSettings
        if self.G_CG_OPTION:
            cmd += " -cam \"%(renderableCamera)s\"" % self.renderSettings
        if self.G_CG_LAYER_NAME:
            cmd += " -rl \"%(renderableLayer)s\"" % self.renderSettings

        pre_render_dict = {}
        pre_render_dict["enable_layered"] = self.ENABLE_LAYERED
        pre_render_dict["projectPath"] = os.path.normpath(
            self.G_INPUT_PROJECT_PATH)
        pre_render_dict["mapping"] = self.mappings
        pre_render_dict["renderableCamera"] = self.G_CG_OPTION
        pre_render_dict["renderableLayer"] = self.G_CG_LAYER_NAME
        pre_render_dict["task_json"] = self.G_TASK_JSON
        pre_render_dict["start"] = self.G_CG_START_FRAME
        pre_render_dict["c_prerender"] = self.G_RN_MAYA_CUSTOME_PRERENDER
        pre_render_dict["user_id"] = self.G_USER_ID
        pre_render_dict["task_id"] = self.G_TASK_ID
        pre_render_dict["plugins"] = self.G_CG_CONFIG_DICT["plugins"]

        # self.MAYA_BASE_RENDER_CMD = cmd

        # cmd += " -preRender \"python \\\"pre_render_dict=%s;execfile(\\\\\\\"%s\\\\\\\")\\\"\"" % (pre_render_dict,self.G_RN_MAYA_PRERENDER)

        #---------------render cmd-------------------------

        # ----------render tile------------
        if self.ENABLE_LAYERED == "1":
            self.renderer = self.G_TASK_JSON_DICT['scene_info_render'][
                self.G_CG_LAYER_NAME]['common']['renderer']
            if self.renderSettings["tile_region"]:
                if self.renderer in ["mentalRay", "arnold", "vray"]:
                    if self.renderer == "mentalRay" and float(
                            self.CG_VERSION) < 2017:
                        cmd += " -r mr -reg %(tile_region)s" % self.renderSettings
                    elif self.renderer == "mentalRay" and float(
                            self.CG_VERSION
                    ) > 2016.5 and "mentalray" in self.CG_PLUGINS_DICT:
                        cmd += " -r mr -reg %(tile_region)s" % self.renderSettings

                    elif self.renderer == "arnold" and "mtoa" in self.CG_PLUGINS_DICT:
                        cmd += " -r arnold -reg %(tile_region)s" % self.renderSettings

                    elif self.renderer == "vray" and "vrayformaya" in self.CG_PLUGINS_DICT:
                        cmd += " -r vray -reg %(tile_region)s" % self.renderSettings

                    else:
                        print("please confirm the renderer is correct!")
                        print(
                            "current render layer \'s render is %s ,not in [mentalRay,arnold,vray]"
                            % (self.renderer))
                        sys.exit(555)
                if self.renderer in ["mayaSoftware"]:
                    cmd += " -r sw -reg %(tile_region)s" % self.renderSettings
            else:
                if self.renderer == "renderman" and "RenderMan_for_Maya" in self.CG_PLUGINS_DICT:
                    cmd += " -r rman"
                if self.renderer == "vray" and "vrayformaya" in self.CG_PLUGINS_DICT:
                    cmd += " -r vray"
                if self.renderer == "redshift" and "redshift_GPU" in self.CG_PLUGINS_DICT:
                    cmd += " -r redshift -logLevel 1"
                    gpu_n = "0,1"
                    cmd += " -gpu {%s}" % (gpu_n)
                else:
                    pass

        else:

            scene_info_render_dict = self.G_TASK_JSON_DICT['scene_info_render']
            renderer_list = CLASS_MAYA_UTIL.dict_get(scene_info_render_dict,
                                                     "renderer")
            self.G_DEBUG_LOG.info(renderer_list)

            if "redshift_GPU" in self.CG_PLUGINS_DICT and "redshift" in renderer_list:
                cmd += " -r redshift -logLevel 1"
                gpu_n = "0,1"
                cmd += " -gpu {%s}" % (gpu_n)

            if "RenderMan_for_Maya" in self.CG_PLUGINS_DICT and "renderman" in renderer_list:
                cmd += " -r rman"

        max_threads_number = int(multiprocessing.cpu_count())

        if " -r " not in cmd and float(self.CG_VERSION) < 2017:
            # cmd += " -mr:art -mr:aml"
            cmd += " -mr:rt %s -mr:aml" % max_threads_number

        # self.RENDERCMD = cmd
        options = {}
        options["output"] = self.renderSettings["output"]
        options["output_frame"] = self.renderSettings["output_frame"]
        options["g_one_machine_multiframe"] = self.g_one_machine_multiframe

        #-------------get custom render cmd-------------

        # -------------add post render cmd-------------
        if self.g_one_machine_multiframe is True:
            cmd += " -postFrame \"python \\\"options=%s;execfile(\\\\\\\"%s\\\\\\\")\\\";\"" % (
                options, self.G_RN_MAYA_POSTRENDER)

        if "-r rman" in cmd:
            cmd += " -setAttr Format:resolution \"%(width)s %(height)s\" \"%(maya_file)s\"" % self.renderSettings
        else:
            cmd += " -x %(width)s -y %(height)s \"%(maya_file)s\"" % self.renderSettings

        print("render cmd info:")
        sys.stdout.flush()
        return cmd
Example #7
0
    def RB_RENDER(self):  #5

        self.format_log('渲染', 'start')
        if int(self.G_CG_TILE_COUNT) != int(self.G_CG_TILE):
            self.G_DEBUG_LOG.info('[RenderMaya.RB_RENDER.start.....]')
            # if self.PRE_DICT == None:
            # render_cmd = self.MAYA_FINAL_RENDER_CMD

            # elif self.PRE_DICT['RENDER_CMD']:
            # render_cmd = self.PRE_DICT['RENDER_CMD']
            # print ("The custom render cmd: ")
            # print (render_cmd)

            # else:
            # render_cmd = self.MAYA_FINAL_RENDER_CMD

            # ------------get render cmd----------
            render_cmd = self.MAYA_FINAL_RENDER_CMD
            sys.stdout.flush()
            self.G_DEBUG_LOG.info(render_cmd)

            start_time = int(time.time())
            if self.g_one_machine_multiframe is True:
                render_list = CLASS_COMMON_UTIL.need_render_from_frame(
                    self.G_CG_FRAMES)
                self.render_record.update({
                    render_list[0]: {
                        'start_time': start_time,
                        'end_time': 0
                    }
                })
                pass
            self.G_FEE_PARSER.set('render', 'start_time', str(start_time))

            self.G_DEBUG_LOG.info(
                "\n\n-------------------------------------------Start maya program-------------------------------------\n\n"
            )
            result_code, _ = CLASS_COMMON_UTIL.cmd(
                render_cmd,
                my_log=self.G_RENDER_LOG,
                continue_on_error=True,
                my_shell=True,
                callback_func=self.maya_cmd_callback)

            self.cg_return_code = result_code
            end_time = int(time.time())
            self.G_FEE_PARSER.set('render', 'end_time', str(end_time))

            # if self.g_one_machine_multiframe is True:
            #     CLASS_MAYA_UTIL.clean_dir(self.G_WORK_RENDER_TASK_OUTPUT, my_log=self.G_DEBUG_LOG)

            CLASS_MAYA_UTIL.kill_lic_all(my_log=self.G_DEBUG_LOG)
            self.G_FEE_PARSER.set('render', 'end_time', str(end_time))
            self.G_DEBUG_LOG.info('[RenderMaya.RB_RENDER.end.....]')

        else:
            self.G_DEBUG_LOG.info('[RenderNuke.RB_RENDER.start.....]')
            self.G_FEE_PARSER.set('render', 'start_time',
                                  str(int(time.time())))
            options = {}
            options["func_path"] = self.G_NODE_MAYAFUNCTION
            options["tiles"] = int(self.G_CG_TILE_COUNT)
            options["tile_index"] = int(self.G_CG_TILE)
            options["width"] = int(self.G_TASK_JSON_DICT['scene_info_render'][
                self.G_CG_LAYER_NAME]['common']['width'])
            options["height"] = int(self.G_TASK_JSON_DICT['scene_info_render'][
                self.G_CG_LAYER_NAME]['common']['height'])
            options["output"] = self.G_WORK_RENDER_TASK_OUTPUT
            options["g_tiles_path"] = self.G_TILES_PATH
            options["g_task_id"] = self.G_TASK_ID
            options["g_cg_start_frame"] = self.G_CG_START_FRAME
            print(options)
            nuke_merge = NukeMerge(options)
            nuke_merge.render(self.G_DEBUG_LOG)
            CLASS_MAYA_UTIL.kill_lic_all(my_log=self.G_DEBUG_LOG)
            self.G_FEE_PARSER.set('render', 'end_time', str(int(time.time())))
            self.G_DEBUG_LOG.info('[RenderNuke.RB_RENDER.end.....]')

        self.format_log('done', 'end')
Example #8
0
    def RB_CONFIG(self):
        self.G_DEBUG_LOG.info('[Maya.RBconfig.start.....]')
        try:
            if self.CG_VERSION == '2017':
                # os.system ("robocopy /e /ns /nc /nfl /ndl /np  \"//10.70.242.102/render_p/script/User/100000056/maya2017\"  \"C:/Program Files/Autodesk/Maya2017/scripts/others\"" )
                copy_cmd = '{fcopy_path} /speed=full /force_close /no_confirm_stop /force_start "{source}" /to="{destination}"'.format(
                    fcopy_path='c:\\fcopy\\FastCopy.exe',
                    source=os.path.join(
                        r'B:\plugins\maya_new\2017updata3').replace('/', '\\'),
                    destination=os.path.join(
                        r"C:/Program Files/Autodesk/Maya2017/scripts/others").
                    replace("/", "\\"),
                )

                CLASS_COMMON_UTIL.cmd(copy_cmd,
                                      my_log=None,
                                      try_count=3,
                                      continue_on_error=True)

        except Exception as err:
            self.G_DEBUG_LOG.infor(err)

        if self.G_CG_TILE_COUNT != self.G_CG_TILE:
            print(
                "----------------------------------------loading plugins start ------------------------------------------"
            )
            # kill maya
            CLASS_MAYA_UTIL.killMayabatch(
                self.G_DEBUG_LOG)  # kill mayabatch.exe
            # ----------------set env  -------------------
            os.environ["MAYA_UI_LANGUAGE"] = "en_US"
            os.environ['MAYA_DISABLE_CIP'] = '1'
            os.environ['MAYA_DISABLE_CLIC_IPM'] = '1'
            os.environ['MAYA_DISABLE_CER'] = '1'
            if float(self.CG_VERSION) >= 2016:
                os.environ['MAYA_OPENCL_IGNORE_DRIVER_VERSION'] = '1'
                os.environ['MAYA_VP2_DEVICE_OVERRIDE'] = 'VirtualDeviceDx11'
            if int(self.RENDER_LAYER_TYPE):
                os.environ['MAYA_ENABLE_LEGACY_RENDER_LAYERS'] = "0"
            else:
                os.environ['MAYA_ENABLE_LEGACY_RENDER_LAYERS'] = "1"
            # ----------------load maya plugin-------------------
            self.G_DEBUG_LOG.info('插件配置')
            if self.G_CG_CONFIG_DICT:
                sys.stdout.flush()
                custom_config = os.path.join(
                    self.G_NODE_MAYAFUNCTION,
                    self.G_CUSTOME_CONFIG_NAME).replace('\\', '/')
                if self.G_NODE_MAYAFUNCTION:
                    if os.path.exists(custom_config):
                        sys.stdout.flush()
                        print("custom_config is: " + custom_config)
                        sys.stdout.flush()
                    else:
                        print("Can not find the CustomConfig file: %s." %
                              custom_config)
                print("plugin path:")
                print(self.G_CG_CONFIG_DICT)
                sys.stdout.flush()
                maya_plugin = MayaPlugin(self.G_CG_CONFIG_DICT,
                                         [custom_config], self.G_USER_ID,
                                         self.G_TASK_ID, self.G_DEBUG_LOG)
                maya_plugin.config()
                sys.stdout.flush()
            print(
                "----------------------------------------loading plugins end ------------------------------------------"
            )
            self.G_DEBUG_LOG.info('[Maya.RBconfig.end.....]')

        else:
            self.G_DEBUG_LOG.info(
                "[RenderNuke  Comp...........................]")
        self.G_DEBUG_LOG.info('[RenderMaya.RB_CONFIG.end.....]')
        self.format_log('done', 'end')
Example #9
0
    def RB_RENDER(self):  #5

        self.format_log('渲染', 'start')
        if int(self.G_CG_TILE_COUNT) != int(self.G_CG_TILE):
            self.G_DEBUG_LOG.info('[RenderMaya.RB_RENDER.start.....]')
            # if self.PRE_DICT == None:
            # render_cmd = self.MAYA_FINAL_RENDER_CMD

            # elif self.PRE_DICT['RENDER_CMD']:
            # render_cmd = self.PRE_DICT['RENDER_CMD']
            # print ("The custom render cmd: ")
            # print (render_cmd)

            # else:
            # render_cmd = self.MAYA_FINAL_RENDER_CMD

            # 是否一机多帧
            if self.g_one_machine_multiframe is True:
                if int(self.G_RECOMMIT_FLAG) > 0:
                    cmd = r'c:\fcopy\FastCopy.exe /cmd=force_copy /speed=full /force_close /no_confirm_stop /force_start "{}" /to="{}"'.format(
                        os.path.join(self.G_REMOTE_TASK_CFG,
                                     self.render_record_json),
                        self.G_WORK_RENDER_TASK_MULTIFRAME,
                    )
                    CLASS_COMMON_UTIL.cmd(cmd, my_log=self.G_DEBUG_LOG)
                # 监控线程
                frames = self.remain_frames()
                render_list = CLASS_COMMON_UTIL.need_render_from_frame(frames)
                t = threading.Thread(target=self.loop_handle_complete,
                                     args=(render_list, ))
                t.start()
                self.monitor_complete_thread = t

            # ------------get render cmd----------
            render_cmd = self.MAYA_FINAL_RENDER_CMD
            sys.stdout.flush()
            self.G_DEBUG_LOG.info(render_cmd)
            start_time = int(time.time())
            if self.g_one_machine_multiframe is True:
                self.render_record.update(
                    {frames[0]: {
                         'start_time': start_time,
                         'end_time': 0
                     }})
                pass
            self.G_FEE_PARSER.set('render', 'start_time', str(start_time))

            self.G_DEBUG_LOG.info(
                "\n\n-------------------------------------------Start maya program-------------------------------------\n\n"
            )
            result_code, _ = CLASS_COMMON_UTIL.cmd(
                render_cmd,
                my_log=self.G_DEBUG_LOG,
                continue_on_error=True,
                my_shell=True,
                callback_func=self.maya_cmd_callback)

            self.cg_return_code = result_code
            end_time = int(time.time())
            self.G_FEE_PARSER.set('render', 'end_time', str(end_time))

            CLASS_MAYA_UTIL.kill_lic_all(my_log=self.G_DEBUG_LOG)
            self.G_FEE_PARSER.set('render', 'end_time', str(end_time))
            self.G_DEBUG_LOG.info('[RenderMaya.RB_RENDER.end.....]')

        else:
            self.G_DEBUG_LOG.info('[RenderNuke.RB_RENDER.start.....]')
            self.G_FEE_PARSER.set('render', 'start_time',
                                  str(int(time.time())))
            options = {}
            options["func_path"] = self.G_NODE_MAYAFUNCTION
            options["tiles"] = int(self.G_CG_TILE_COUNT)
            options["tile_index"] = int(self.G_CG_TILE)
            options["width"] = int(self.G_TASK_JSON_DICT['scene_info_render'][
                self.G_CG_LAYER_NAME]['common']['width'])
            options["height"] = int(self.G_TASK_JSON_DICT['scene_info_render'][
                self.G_CG_LAYER_NAME]['common']['height'])
            options["output"] = self.G_WORK_RENDER_TASK_OUTPUT
            options["g_tiles_path"] = self.G_TILES_PATH
            options["g_task_id"] = self.G_TASK_ID
            options["g_cg_start_frame"] = self.G_CG_START_FRAME
            print(options)
            nuke_merge = NukeMerge(options)
            nuke_merge.render(self.G_DEBUG_LOG)
            CLASS_MAYA_UTIL.kill_lic_all(my_log=self.G_DEBUG_LOG)
            self.G_FEE_PARSER.set('render', 'end_time', str(int(time.time())))
            self.G_DEBUG_LOG.info('[RenderNuke.RB_RENDER.end.....]')

        self.format_log('done', 'end')
Example #10
0
    def RB_CONFIG(self):
        """拷贝2017的mayaBatchRenderProcedure,删除mayabatch进程,设置环境变量,执行 MayaPlugin 配置插件,
        get_render_cmd 获取cmd内容 并打印."""
        self.G_DEBUG_LOG.info('[Maya.RBconfig.start.....]')
        try:
            if float(self.CG_VERSION) == 2017:
                # 拷贝mayaBatchRenderProcedure.mel
                # os.system ("robocopy /e /ns /nc /nfl /ndl /np  \"//10.70.242.102/render_p/script/User/100000056/maya2017\"  \"C:/Program Files/Autodesk/Maya2017/scripts/others\"" )
                copy_cmd = '{fcopy_path} /speed=full /force_close /no_confirm_stop /force_start "{source}" /to="{destination}"'.format(
                    fcopy_path='c:\\fcopy\\FastCopy.exe',
                    source=os.path.join(
                        r'\\10.60.100.104\new_render_data\input\p\script\User\10000036\CG\Maya\script\2017updata3'
                    ).replace('/', '\\'),
                    destination=os.path.join(
                        r"C:/Program Files/Autodesk/Maya2017/scripts/others").
                    replace("/", "\\"),
                )

                CLASS_COMMON_UTIL.cmd(copy_cmd,
                                      my_log=None,
                                      try_count=3,
                                      continue_on_error=True)

        except Exception as err:
            self.G_DEBUG_LOG.infor(err)

        # G_CG_TILE_COUNT = 分块总数 G_CG_TILE = 当前分块号码  相等的情况是合并帧任务
        if self.G_CG_TILE_COUNT != self.G_CG_TILE:
            print(
                "----------------------------------------loading plugins start ------------------------------------------"
            )
            #kill maya
            CLASS_MAYA_UTIL.killMayabatch(
                self.G_DEBUG_LOG)  #kill mayabatch.exe
            # ----------------set env  -------------------
            os.environ["MAYA_UI_LANGUAGE"] = "en_US"
            os.environ['MAYA_DISABLE_CIP'] = '1'
            os.environ['MAYA_DISABLE_CLIC_IPM'] = '1'
            os.environ['MAYA_DISABLE_CER'] = '1'
            #设置Viewport2.0
            if float(self.CG_VERSION) >= 2016:
                os.environ['MAYA_OPENCL_IGNORE_DRIVER_VERSION'] = '1'
                os.environ['MAYA_VP2_DEVICE_OVERRIDE'] = 'VirtualDeviceDx11'
            #根据平台设置渲染层模式 设置
            if int(self.RENDER_LAYER_TYPE):
                os.environ['MAYA_ENABLE_LEGACY_RENDER_LAYERS'] = "0"
            else:
                os.environ['MAYA_ENABLE_LEGACY_RENDER_LAYERS'] = "1"
            # ----------------load maya plugin-------------------
            self.G_DEBUG_LOG.info('插件配置')
            if self.G_CG_CONFIG_DICT:
                sys.stdout.flush()
                #c:\script\new_py\CG\Maya\function\C_PreRender.py
                custom_config = os.path.join(
                    self.G_NODE_MAYAFUNCTION,
                    self.G_CUSTOME_CONFIG_NAME).replace('\\', '/')
                # 在munu.log打印出 prerender路径
                if self.G_NODE_MAYAFUNCTION:
                    if os.path.exists(custom_config):
                        sys.stdout.flush()
                        print("custom_config is: " + custom_config)
                        sys.stdout.flush()
                    else:
                        print("Can not find the CustomConfig file: %s." %
                              custom_config)
                print("plugin path:")
                print(self.G_CG_CONFIG_DICT)
                sys.stdout.flush()
                #执行 MayaPlugin
                maya_plugin = MayaPlugin(self.G_CG_CONFIG_DICT,
                                         [custom_config], self.G_USER_ID,
                                         self.G_TASK_ID, self.G_DEBUG_LOG)
                maya_plugin.config()
                sys.stdout.flush()
            print(
                "----------------------------------------loading plugins end ------------------------------------------"
            )
            self.G_DEBUG_LOG.info('[Maya.RBconfig.end.....]')

            # #------------get render cmd----------
            self.MAYA_FINAL_RENDER_CMD = self.get_render_cmd()
            #打印 cmd 内容
            self.G_DEBUG_LOG.info(self.MAYA_FINAL_RENDER_CMD)
        else:
            self.G_DEBUG_LOG.info(
                "[RenderNuke  Comp...........................]")
        self.G_DEBUG_LOG.info('[RenderMaya.RB_CONFIG.end.....]')
        self.format_log('done', 'end')
Example #11
0
    def RB_RENDER(self):
        self.G_DEBUG_LOG.info('[maya.RBanalyse.start.....]')
        if self.cg_file_error == 0:
            analyse_cmd = ''
            options = {}
            options["user_id"] = self.G_USER_ID
            options["task_id"] = self.G_TASK_ID
            options["cg_project"] = self.G_INPUT_PROJECT_PATH
            options["cg_file"] = self.G_INPUT_CG_FILE
            options["task_json"] = self.G_TASK_JSON
            options["asset_json"] = self.G_ASSET_JSON
            options["tips_json"] = self.G_TIPS_JSON
            options["cg_version"] = self.CG_VERSION
            options["cg_plugins"] = self.G_CG_CONFIG_DICT["plugins"]
            options["platform"] = self.G_PLATFORM
            options["channel"] = "web"
            self.G_DEBUG_LOG.info(options)
            self.G_DEBUG_LOG.info("current os is %s" % self.G_RENDER_OS)
            if self.G_RENDER_OS == '1':
                mayabatch = ["C:/Program Files/Autodesk/Maya%s/bin/mayabatch.exe" % \
                             (options["cg_version"]),
                             "D:/Program Files/Autodesk/Maya%s/bin/mayabatch.exe" % \
                             (options["cg_version"]),
                             "E:/Program Files/Autodesk/Maya%s/bin/mayabatch.exe" % \
                             (options["cg_version"]),
                             "F:/Program Files/Autodesk/Maya%s/bin/mayabatch.exe" % \
                             (options["cg_version"]),
                             "D:/Alias/Maya%sx64/bin/mayabatch.exe" % (options["cg_version"])]
        
                mayabatch = [i for i in mayabatch if os.path.isfile(i)]
                if mayabatch:
                    mayabatch = mayabatch[0]
                else:
                    self.G_DEBUG_LOG.info("there no Maya%s" % options["cg_version"])
                    sys.exit(555)
    
            elif self.G_RENDER_OS== '0':
                mayabatch = '/usr/autodesk/maya' + self.CG_VERSION + '-x64/bin/maya'
                if not os.path.exists(mayabatch):
                    mayabatch = '/usr/autodesk/maya' + self.CG_VERSION + '/bin/maya'
            else:
                self.G_DEBUG_LOG.info("Current OS is %s" % self.G_RENDER_OS)
                sys.exit(555)
    
            mayabatch= mayabatch.replace('\\','/')
            self.G_AN_MAYA_FILE=os.path.join(self.G_NODE_MAYASCRIPT,'Analyze.py').replace('\\','/')
            
            # analyse_cmd = "%s %s --ui %s --ti %s --proj %s --cgfile %s --taskjson %s --assetjson %s --tipsjson %s" %(mayaExePath,self.G_AN_MAYA_FILE,self.G_USER_ID,self.G_TASK_ID,self.G_INPUT_PROJECT_PATH,self.G_INPUT_CG_FILE,self.G_TASK_JSON,self.G_ASSET_JSON,self.G_TIPS_JSON)
            # print analyse_cmd
            str_options = re.sub(r"\\\\", r"/", repr(options))
            str_dir = self.G_NODE_MAYASCRIPT.replace("\\", "/")
            if self.G_RENDER_OS != '0':
                analyse_cmd = "\"%s\" -command \"python \\\"options=%s;import sys;sys.path.insert(0, '%s');import Analyze;reload(Analyze);Analyze.analyze_maya(options)\\\"\"" % (mayabatch, str_options, str_dir)
            else:
                cg_project = os.path.normpath(self.G_INPUT_PROJECT_PATH).replace("\\", "/")
                cg_file = os.path.normpath(self.G_INPUT_CG_FILE).replace("\\", "/")
                task_json = os.path.normpath(self.G_TASK_JSON).replace("\\", "/")
                analyse_cmd = "\"%s\" -batch -command \"python \\\"cg_file,cg_project,task_json=\\\\\\\"%s\\\\\\\",\\\\\\\"%s\\\\\\\",\\\\\\\"%s\\\\\\\";execfile(\\\\\\\"%s\\\\\\\")\\\"\"" %(mayabatch,cg_file,cg_project,task_json,self.G_AN_MAYA_FILE)
    
            self.G_FEE_PARSER.set('render','start_time',str(int(time.time())))
            self.G_DEBUG_LOG.info("\n\n-------------------------------------------Start maya program-------------------------------------\n\n")
            self.G_DEBUG_LOG.info("analyse cmd info:\n")
            analyze_code,analyze_result=CLASS_COMMON_UTIL.cmd(analyse_cmd,my_log=self.G_DEBUG_LOG,continue_on_error=True,my_shell=True,callback_func=self.maya_cmd_callback)
            self.G_DEBUG_LOG.info(analyze_result)
            self.G_DEBUG_LOG.info(analyze_code)

        self.G_DEBUG_LOG.info(self.tips_info_dict)
        if self.tips_info_dict:
            self.write_tips_info()
            self.G_DEBUG_LOG.info("write tips info_2 ok.")
        if not os.path.exists(self.G_ASSET_JSON):
            self.write_asset_info()
            self.G_DEBUG_LOG.info("asset.json is not exist.")
            self.G_DEBUG_LOG.info("write assets info_2 ok.")
        CLASS_MAYA_UTIL.kill_lic_all(my_log=self.G_DEBUG_LOG)        
        self.G_FEE_PARSER.set('render','end_time',str(int(time.time())))
        self.G_DEBUG_LOG.info('[maya.RBanalyse.end.....]')
Example #12
0
    def RB_RENDER(self):  # 5

        self.format_log('渲染', 'start')
        if int(self.G_CG_TILE_COUNT) != int(self.G_CG_TILE):
            self.G_DEBUG_LOG.info('[RenderMaya.RB_RENDER.start.....]')

            # ------------get render cmd----------

            # #------------get render cmd----------
            self.MAYA_FINAL_RENDER_CMD = self.get_render_cmd()

            render_cmd = self.MAYA_FINAL_RENDER_CMD
            sys.stdout.flush()
            self.G_DEBUG_LOG.info('render cmd info:')
            self.G_DEBUG_LOG.info(render_cmd)

            self.start_monitor()  # 开启监控线程

            start_time = int(time.time())
            if self.g_one_machine_multiframe is True:
                render_list = CLASS_COMMON_UTIL.need_render_from_frame(
                    self.G_CG_FRAMES)
                self.render_record.update({
                    render_list[0]: {
                        'start_time': start_time,
                        'end_time': 0
                    }
                })
                pass
            self.G_FEE_PARSER.set('render', 'start_time', str(start_time))

            self.G_DEBUG_LOG.info(
                "\n\n-------------------------------------------Start maya program-------------------------------------\n\n"
            )
            result_code, _ = CLASS_MAYA_UTIL.maya_cmd(
                render_cmd,
                my_log=self.G_RENDER_LOG,
                continue_on_error=False,
                my_shell=True,
                callback_func=self.maya_cmd_callback)

            self.cg_return_code = result_code
            end_time = int(time.time())
            self.G_FEE_PARSER.set('render', 'end_time', str(end_time))

            CLASS_MAYA_UTIL.kill_lic_all(my_log=self.G_DEBUG_LOG)
            self.G_FEE_PARSER.set('render', 'end_time', str(end_time))
            self.G_DEBUG_LOG.info('[RenderMaya.RB_RENDER.end.....]')

        else:
            self.G_DEBUG_LOG.info('[RenderNuke.RB_RENDER.start.....]')
            self.G_FEE_PARSER.set('render', 'start_time',
                                  str(int(time.time())))
            options = {}
            options["func_path"] = self.G_NODE_MAYAFUNCTION
            options["tiles"] = int(self.G_CG_TILE_COUNT)
            options["tile_index"] = int(self.G_CG_TILE)
            options["width"] = int(self.G_TASK_JSON_DICT['scene_info_render'][
                self.G_CG_LAYER_NAME]['common']['width'])
            options["height"] = int(self.G_TASK_JSON_DICT['scene_info_render'][
                self.G_CG_LAYER_NAME]['common']['height'])
            options["output"] = self.G_WORK_RENDER_TASK_OUTPUT
            options["g_tiles_path"] = self.G_TILES_PATH
            options["g_task_id"] = self.G_TASK_ID
            options["g_cg_start_frame"] = self.G_CG_START_FRAME
            self.G_DEBUG_LOG.info(options)
            nuke_merge = NukeMerge(options)
            nuke_merge.render(self.G_DEBUG_LOG)
            CLASS_MAYA_UTIL.kill_lic_all(my_log=self.G_DEBUG_LOG)
            self.G_FEE_PARSER.set('render', 'end_time', str(int(time.time())))
            self.G_DEBUG_LOG.info('[RenderNuke.RB_RENDER.end.....]')

        # 日志过滤调用errorbase类
        monitor_ini_dict = {}
        monitor_ini_dict["G_INPUT_CG_FILE"] = self.G_INPUT_CG_FILE
        monitor_ini_dict["CG_NAME"] = self.CG_NAME
        monitor_ini_dict["CG_VERSION"] = self.CG_VERSION
        monitor_ini_dict["CG_PLUGINS_DICT"] = self.CG_PLUGINS_DICT
        monitor_ini_dict["G_INPUT_USER_PATH"] = self.G_INPUT_USER_PATH
        monitor_ini_dict["G_OUTPUT_USER_PATH"] = self.G_OUTPUT_USER_PATH
        monitor_ini_dict["G_NODE_NAME"] = self.G_NODE_NAME
        monitor_ini_dict["G_NODE_ID"] = self.G_NODE_ID
        monitor_ini_dict[
            "G_WORK_RENDER_TASK_OUTPUT"] = self.G_WORK_RENDER_TASK_OUTPUT
        monitor_ini_dict["G_DEBUG_LOG"] = self.G_DEBUG_LOG

        monitor_log = ErrorBase(monitor_ini_dict)
        monitor_log.run()

        self.stop_monitor()  # stop monitor  结束监控线程
        self.format_log('done', 'end')