class PythonResolver(): def __init__( self, frame, shot_path, job_path, cali_path, python_flow, setting ): self._process = ResolveProcess( frame, None, None, shot_path, job_path, cali_path, [], [] ) self._process.on_event_emit(self._on_event_emit) self._process.setting.from_json(setting) flow_dict[python_flow]().run_python() self._process.complete() def _on_event_emit(self, event, payload): if event is ResolveEvent.COMPLETE: print('python | Complete!!') elif event is ResolveEvent.FAIL: print(f'python | FAIL: {payload}') elif event is ResolveEvent.LOG_INFO: print(f'python | {payload}') elif event is ResolveEvent.LOG_STDOUT: print(f'python | {payload}') elif event is ResolveEvent.LOG_WARNING: print(f'python | WARN: {payload}') elif event is ResolveEvent.PROGRESS: print(f'python | Progress: {payload:.2f}%')
class HythonResolver(): def __init__( self, frame, job_path, hython_flow ): self._process = ResolveProcess( frame, None, job_path, None, [], [] ) self._process.on_event_emit(self._on_event_emit) flow_dict[hython_flow]().run_hython() self._process.complete() def _on_event_emit(self, event, payload): if event is ResolveEvent.COMPLETE: print('hython | Complete!!') elif event is ResolveEvent.FAIL: print(f'hython | FAIL: {payload}') elif event is ResolveEvent.LOG_INFO: print(f'hython | {payload}') elif event is ResolveEvent.LOG_STDOUT: print(f'hython | {payload}') elif event is ResolveEvent.LOG_WARNING: print(f'hython | WARN: {payload}') elif event is ResolveEvent.PROGRESS: print(f'hython | Progress: {payload:.2f}%')
class LocalResolver(): def __init__( self, frame, alicevision_path, aruco_path, shot_path, job_path, cali_path, resolve_steps, ignore_flows, solo_flows ): self._process = ResolveProcess( frame, alicevision_path, aruco_path, shot_path, job_path, cali_path, resolve_steps, ignore_flows, solo_flows ) self._process.on_event_emit(self._on_event_emit) self._process.run() def _on_event_emit(self, event, payload): if event is ResolveEvent.COMPLETE: print('> Complete!!') elif event is ResolveEvent.FAIL: print(f'> FAIL: {payload}') elif event is ResolveEvent.LOG_INFO: print(f'INFO: {payload}') elif event is ResolveEvent.LOG_STDOUT: print(f'STDO: {payload}') elif event is ResolveEvent.LOG_WARNING: print(f'WARN: {payload}') elif event is ResolveEvent.PROGRESS: print(f'Progress: {payload:.2f}%')
def __init__( self, frame, job_path, hython_flow ): self._process = ResolveProcess( frame, None, job_path, None, [], [] ) self._process.on_event_emit(self._on_event_emit) flow_dict[hython_flow]().run_hython() self._process.complete()
def __init__( self, frame, alicevision_path, aruco_path, shot_path, job_path, cali_path, resolve_steps, ignore_flows, solo_flows ): self._process = ResolveProcess( frame, alicevision_path, aruco_path, shot_path, job_path, cali_path, resolve_steps, ignore_flows, solo_flows ) self._process.on_event_emit(self._on_event_emit) self._process.run()
def __init__( self, frame, shot_path, job_path, cali_path, python_flow, setting ): self._process = ResolveProcess( frame, None, None, shot_path, job_path, cali_path, [], [] ) self._process.on_event_emit(self._on_event_emit) self._process.setting.from_json(setting) flow_dict[python_flow]().run_python() self._process.complete()
def RenderTasks(self): """render""" job = self.GetJob() shot_path = job.GetJobExtraInfoKeyValue('shot_path') job_path = job.GetJobExtraInfoKeyValue('job_path') cali_path = job.GetJobExtraInfoKeyValueWithDefault('cali_path', None) resolve_step = job.GetJobExtraInfoKeyValue('resolve_step') gpu_core = -1 if self.OverrideGpuAffinity(): gpu_core = self.GpuAffinity()[0] ignore_flows = job.GetJobExtraInfoKeyValueWithDefault( 'ignore_flows', None) solo_flows = job.GetJobExtraInfoKeyValueWithDefault('solo_flows', None) if ignore_flows is not None: ignore_flows = [ flow_dict[flow_str] for flow_str in ignore_flows.split(',') ] else: ignore_flows = [] if solo_flows is not None: solo_flows = [ flow_dict[flow_str] for flow_str in solo_flows.split(',') ] else: solo_flows = [] self._process = ResolveProcess( frame=self.GetStartFrame(), alicevision_path=self._app_path + 'alicevision\\', aruco_path=self._app_path + 'aruco\\', shot_path=shot_path, job_path=job_path, cali_path=cali_path, resolve_steps=[ResolveStep(resolve_step)], ignore_flows=ignore_flows, solo_flows=solo_flows, gpu_core=gpu_core) parameters = job.GetJobExtraInfoKeyValueWithDefault('parameters', None) if parameters is not None: self._process.setting.from_json(parameters) self._process.on_event_emit(self._on_event_emit) self._process.run()
class FourDRecPlugin(DeadlinePlugin): """4DREC Plugin""" _app_path = '\\\\4dk-sto\\storage\\app\\' def __init__(self): self.InitializeProcessCallback += self.InitializeProcess self.StartJobCallback += self.StartJob self.RenderTasksCallback += self.RenderTasks self._process = None def Cleanup(self): """flush memory""" del self.InitializeProcessCallback del self.StartJobCallback del self.RenderTasksCallback def InitializeProcess(self): """initialize process""" self.SingleFramesOnly = False self.PluginType = PluginType.Advanced def StartJob(self): """prepare resolve""" return def RenderTasks(self): """render""" job = self.GetJob() shot_path = job.GetJobExtraInfoKeyValue('shot_path') job_path = job.GetJobExtraInfoKeyValue('job_path') cali_path = job.GetJobExtraInfoKeyValueWithDefault('cali_path', None) resolve_step = job.GetJobExtraInfoKeyValue('resolve_step') gpu_core = -1 if self.OverrideGpuAffinity(): gpu_core = self.GpuAffinity()[0] ignore_flows = job.GetJobExtraInfoKeyValueWithDefault( 'ignore_flows', None) solo_flows = job.GetJobExtraInfoKeyValueWithDefault('solo_flows', None) if ignore_flows is not None: ignore_flows = [ flow_dict[flow_str] for flow_str in ignore_flows.split(',') ] else: ignore_flows = [] if solo_flows is not None: solo_flows = [ flow_dict[flow_str] for flow_str in solo_flows.split(',') ] else: solo_flows = [] self._process = ResolveProcess( frame=self.GetStartFrame(), alicevision_path=self._app_path + 'alicevision\\', aruco_path=self._app_path + 'aruco\\', shot_path=shot_path, job_path=job_path, cali_path=cali_path, resolve_steps=[ResolveStep(resolve_step)], ignore_flows=ignore_flows, solo_flows=solo_flows, gpu_core=gpu_core) parameters = job.GetJobExtraInfoKeyValueWithDefault('parameters', None) if parameters is not None: self._process.setting.from_json(parameters) self._process.on_event_emit(self._on_event_emit) self._process.run() def _on_event_emit(self, event, payload): if event is ResolveEvent.COMPLETE: self.ExitWithSuccess() elif event is ResolveEvent.FAIL: self.FailRender(payload) elif event is ResolveEvent.LOG_INFO: self.LogInfo(payload) elif event is ResolveEvent.LOG_STDOUT: self.LogStdout(payload) elif event is ResolveEvent.LOG_WARNING: self.LogWarning(payload) elif event is ResolveEvent.PROGRESS: self.SetProgress(payload)