diff --git a/flamenco_worker/cli.py b/flamenco_worker/cli.py index 7f56453a05000fdc5fb106ba88c1fa01ba3c421a..e89b9e35bb5d0bd01ae36da89023784e41be30ad 100644 --- a/flamenco_worker/cli.py +++ b/flamenco_worker/cli.py @@ -115,8 +115,8 @@ def main(): push_log_max_interval=confparser.interval_secs('push_log_max_interval_seconds'), push_log_max_entries=confparser.value('push_log_max_entries', int), push_act_max_interval=confparser.interval_secs('push_act_max_interval_seconds'), - worker_storage_dir=confparser.value('worker_storage_dir'), - worker_output_dir=confparser.value('worker_output_dir'), + worker_dir=confparser.value('worker_dir'), + worker_blender_param=confparser.value('worker_blender_param'), worker_blender_cmd=confparser.value('worker_blender_cmd'), initial_state='testing' if args.test else 'awake', run_single_task=args.single, diff --git a/flamenco_worker/commands.py b/flamenco_worker/commands.py index d0506302661926937a7c10b6b9a5ce5d5d126506..3f776eb378cd648d9fed595ed0c809d073db0ee8 100644 --- a/flamenco_worker/commands.py +++ b/flamenco_worker/commands.py @@ -609,13 +609,15 @@ class BlenderRenderCommand(AbstractSubprocessCommand): '-noaudio', '--background', settings['filepath'], + '--python', + settings['blender_param'] ] if settings.get('python_expr'): cmd.extend(['--python-expr', settings['python_expr']]) if settings.get('render_output'): cmd.extend(['--render-output', settings['render_output']]) - if settings.get('format'): - cmd.extend(['--render-format', settings['format']]) + #if settings.get('format'): + # cmd.extend(['--render-format', settings['format']]) if settings.get('frames'): cmd.extend(['--render-frame', settings['frames']]) return cmd diff --git a/flamenco_worker/runner.py b/flamenco_worker/runner.py index 926f6afac900f2073e3516521b06e60911dbce6c..69f140d280e4f6c0c99dc934eff3befdb4cc81aa 100644 --- a/flamenco_worker/runner.py +++ b/flamenco_worker/runner.py @@ -51,54 +51,64 @@ class TaskRunner: settings['blender_cmd'] = fworker.worker_blender_cmd return + def check_blender_param(self, settings: dict, fworker: worker.FlamencoWorker): + if not fworker.worker_blender_param: + return + + settings['blender_param'] = fworker.worker_blender_param + return + def check_storage_dir(self, settings: dict, fworker: worker.FlamencoWorker): - if not fworker.worker_storage_dir: + if not fworker.worker_dir: return if not settings.get('filepath'): return - (head, tail) = os.path.split(os.path.normpath(settings['filepath'])) - (head, tail) = os.path.split(head) + #(head, tail) = os.path.split(os.path.normpath(settings['filepath'])) + #(head, tail) = os.path.split(head) - settings['filepath'] = os.path.normpath(settings['filepath']).replace(head, os.path.normpath(fworker.worker_storage_dir)) + #settings['filepath'] = os.path.normpath(settings['filepath']).replace(head, os.path.normpath(fworker.worker_storage_dir)) + settings['filepath'] = os.path.normpath(fworker.worker_dir + '/' + settings['filepath']) return def check_output_dir(self, settings: dict, fworker: worker.FlamencoWorker): - if not fworker.worker_output_dir: + if not fworker.worker_dir: return if not settings.get('render_output'): return - (head, tail) = os.path.split(os.path.normpath(settings['render_output'])) - (head, tail) = os.path.split(head) + #(head, tail) = os.path.split(os.path.normpath(settings['render_output'])) + #(head, tail) = os.path.split(head) + + #settings['render_output'] = os.path.normpath(settings['render_output']).replace(head, os.path.normpath(fworker.worker_output_dir)) + settings['render_output'] = os.path.normpath(fworker.worker_dir + '/' + settings['render_output']) - settings['render_output'] = os.path.normpath(settings['render_output']).replace(head, os.path.normpath(fworker.worker_output_dir)) return def check_src_dir(self, settings: dict, fworker: worker.FlamencoWorker): - if not fworker.worker_output_dir: + if not fworker.worker_dir: return if not settings.get('src'): return - (head, tail) = os.path.split(os.path.normpath(settings['src'])) + #(head, tail) = os.path.split(os.path.normpath(settings['src'])) - settings['src'] = os.path.normpath(settings['src']).replace(head, os.path.normpath(fworker.worker_output_dir)) + settings['src'] = os.path.normpath(fworker.worker_dir + '/' + settings['src']) #.replace(head, os.path.normpath(fworker.worker_output_dir)) return def check_dest_dir(self, settings: dict, fworker: worker.FlamencoWorker): - if not fworker.worker_output_dir: + if not fworker.worker_dir: return if not settings.get('dest'): return - (head, tail) = os.path.split(os.path.normpath(settings['dest'])) + #(head, tail) = os.path.split(os.path.normpath(settings['dest'])) - settings['dest'] = os.path.normpath(settings['dest']).replace(head, os.path.normpath(fworker.worker_output_dir)) + settings['dest'] = os.path.normpath(fworker.worker_dir + '/' + settings['dest']) #.replace(head, os.path.normpath(fworker.worker_output_dir)) return async def execute(self, task: dict, fworker: worker.FlamencoWorker) -> bool: @@ -118,7 +128,8 @@ class TaskRunner: cmd_settings = cmd_info.get('settings') print(cmd_settings) - self.check_blender_cmd(cmd_settings, fworker) + self.check_blender_cmd(cmd_settings, fworker) + self.check_blender_param(cmd_settings, fworker) self.check_storage_dir(cmd_settings, fworker) self.check_output_dir(cmd_settings, fworker) self.check_src_dir(cmd_settings, fworker) diff --git a/flamenco_worker/runner.py~ b/flamenco_worker/runner.py~ index 103d8fd47c490a9fcbd88c107a1ad3117768d340..10c45588e9966f0ca4f29dca3a4174c1385a828d 100644 --- a/flamenco_worker/runner.py~ +++ b/flamenco_worker/runner.py~ @@ -52,57 +52,56 @@ class TaskRunner: return def check_storage_dir(self, settings: dict, fworker: worker.FlamencoWorker): - if not fworker.worker_storage_dir: + if not fworker.worker_dir: return if not settings.get('filepath'): return - (head, tail) = os.path.split(os.path.normpath(settings['filepath'])) - (head, tail) = os.path.split(head) + #(head, tail) = os.path.split(os.path.normpath(settings['filepath'])) + #(head, tail) = os.path.split(head) - settings['filepath'] = os.path.normpath(settings['filepath']).replace(head, os.path.normpath(fworker.worker_storage_dir)) + #settings['filepath'] = os.path.normpath(settings['filepath']).replace(head, os.path.normpath(fworker.worker_storage_dir)) + settings['filepath'] = os.path.normpath(fworker.worker_dir + '/' + settings['filepath']) return def check_output_dir(self, settings: dict, fworker: worker.FlamencoWorker): - if not fworker.worker_output_dir: + if not fworker.worker_dir: return if not settings.get('render_output'): return - (head, tail) = os.path.split(os.path.normpath(settings['render_output'])) - (head, tail) = os.path.split(head) + #(head, tail) = os.path.split(os.path.normpath(settings['render_output'])) + #(head, tail) = os.path.split(head) + + #settings['render_output'] = os.path.normpath(settings['render_output']).replace(head, os.path.normpath(fworker.worker_output_dir)) + settings['render_output'] = os.path.normpath(fworker.worker_dir + '/' + settings['render_output']) - settings['render_output'] = os.path.normpath(settings['render_output']).replace(head, os.path.normpath(fworker.worker_output_dir)) return def check_src_dir(self, settings: dict, fworker: worker.FlamencoWorker): - if not fworker.worker_output_dir: + if not fworker.worker_dir: return if not settings.get('src'): return - (head, tail) = os.path.split(os.path.normpath(settings['src'])) - (head, tail) = os.path.split(head) - (head, tail) = os.path.split(head) + #(head, tail) = os.path.split(os.path.normpath(settings['src'])) - settings['src'] = os.path.normpath(settings['src']).replace(head, os.path.normpath(fworker.worker_output_dir)) + settings['src'] = os.path.normpath(fworker.worker_dir + '/' + settings['src']) #.replace(head, os.path.normpath(fworker.worker_output_dir)) return def check_dest_dir(self, settings: dict, fworker: worker.FlamencoWorker): - if not fworker.worker_output_dir: + if not fworker.worker_dir: return if not settings.get('dest'): return - (head, tail) = os.path.split(os.path.normpath(settings['dest'])) - (head, tail) = os.path.split(head) - (head, tail) = os.path.split(head) + #(head, tail) = os.path.split(os.path.normpath(settings['dest'])) - settings['dest'] = os.path.normpath(settings['dest']).replace(head, os.path.normpath(fworker.worker_output_dir)) + settings['dest'] = os.path.normpath(fworker.worker_dir + '/' + settings['dest']) #.replace(head, os.path.normpath(fworker.worker_output_dir)) return async def execute(self, task: dict, fworker: worker.FlamencoWorker) -> bool: diff --git a/flamenco_worker/worker.py b/flamenco_worker/worker.py index bc6e6d3813d345a3d32c5fec17c9aeabf47ffb3b..6df00177fe24e9526639914c1a205ca858f7790c 100644 --- a/flamenco_worker/worker.py +++ b/flamenco_worker/worker.py @@ -53,8 +53,8 @@ class FlamencoWorker: worker_id = attr.ib(validator=attr.validators.instance_of(str)) worker_secret = attr.ib(validator=attr.validators.instance_of(str)) - worker_storage_dir = attr.ib(validator=attr.validators.instance_of(str)) - worker_output_dir = attr.ib(validator=attr.validators.instance_of(str)) + worker_dir = attr.ib(validator=attr.validators.instance_of(str)) + worker_blender_param = attr.ib(validator=attr.validators.instance_of(str)) worker_blender_cmd = attr.ib(validator=attr.validators.instance_of(str)) loop = attr.ib(validator=attr.validators.instance_of(asyncio.AbstractEventLoop))