def post_publish(context, change_task_status=False): if not os.path.isfile(context.publish_path): logger.error("Something wrong with publish") return # set task publish file logger.info("start post publish...") db = db_api.DbApi(context.project).db_obj current_task = task_from_db_path.task_from_db_path(db, context.work_path) logger.info("Current Task: %s" % current_task) if os.path.isfile(context.image_path): db.upload_thumbnail(current_task, context.image_path) db.update_file_path(current_task, publish_file_path=context.publish_path) logger.info("update task publish file: %s" % context.publish_path) # change task status if change_task_status: db.update_task_status(current_task, "Delivered") logger.info("update task status: Delivered") # # for shotgun register publish file # self.logger.info("publish path: %s" % self.context.publish_path) # try: # tk = toolkit.Toolkit(self.project).tk_obj # self.logger.info("%s" % repr(tk.get_context_from_path(self.context.publish_path))) # tk.publish_file(self.context.publish_path) # except RuntimeError as e: # self.logger.error(str(e)) logger.info("All Done.")
def update_task_status(self, file_path): task = task_from_db_path.task_from_db_path(self.__db, file_path) self.__db.update_task_status(task, "In progress") self.__logger.info("Change task status to In progress.") from datetime import datetime now_time = datetime.now().strftime('%Y-%m-%d') self.__db.update_task(task, sub_date=now_time) self.__logger.info("Change task sub date: %s" % now_time)
def post_qcpublish(context): from miraLibs.dbLibs import db_api from miraLibs.pipeLibs.pipeDb import task_from_db_path db = db_api.DbApi(context.project).db_obj task = task_from_db_path.task_from_db_path(db, context.work_path) if not task: logger.warning("No matched task") return db.update_task_status(task, "Supervisor Review") db.upload_thumbnail(task, context.work_image_path) # upload version db.upload_version(task, media_path=context.work_video_path, file_path=context.work_path) logger.info("Upload version done.") # update task db.update_file_path(task, work_file_path=context.work_path) logger.info("Update work file done.")
def post_start(self): if not os.path.isfile(self.work_file): self.logger.error("Something wrong with start") return # set task sg_startfile self.logger.info("start post start...") db = db_api.DbApi(self.project).db_obj # register the file path current_task = task_from_db_path.task_from_db_path(db, self.work_file) if db.typ == "shotgun": create_filesystem_structure.create_filesystem_structure(self.work_file, engine="tk-%s" % self.engine) self.logger.info("Current Task: %s" % current_task) # update sg_workfile if db.typ == "shotgun": db.update_task(current_task, sg_workfile=self.work_file) self.logger.info("update task sg_workfile: %s" % self.work_file) # update sg_status_list db.update_task_status(current_task, "Ready to Start") self.logger.info("update task sg_status_list: Ready to Start") self.logger.info("\n\nALL Done!")