The bpy.ops.flamenco.submit_job() API execution fails when submitting render task in the background #104187

Closed
opened 2023-02-21 08:44:40 +01:00 by kaikai_liu · 5 comments

System Information
Operating System(s): Windows 10

Flamenco Version
Is Broken: Flamenco 3.1
Worked OK:

Short description of error
I used a python script to submit render task with bpy.ops.flamenco.submit_job() API. That is OK when I running this script by command,

> blender xxx.blender --python xxx.py

but when I want to execute it in the background by this command,

> blender xxx.blender --python xxx.py -b

the script will have problem, it shows that:

> ERROR (wm.operator): C:\Users\blender\git\blender-v330\blender.git\source\blender\windowmanager\intern\wm_event_system.cc:1419 wm_operator_invoke: invalid operator call 'FLAMENCO_OT_submit_job'

This is my code,

scene = bpy.context.scene
scene.flamenco_job_name = "test"
bpy.ops.flamenco.fetch_job_types()
scene.flamenco_job_type = 'simple-blender-render'
scene.flamenco_job_settings.frames = '1-1'
scene.flamenco_job_settings.render_output_root = render_output_dir
bpy.ops.flamenco.submit_job("INVOKE_DEFAULT")

I don't know why the bpy.ops.flamenco.submit_job() connot work in the background.
Please help!

**System Information** Operating System(s): Windows 10 **Flamenco Version** Is Broken: Flamenco 3.1 Worked OK: <!-- the version that still worked ok, if this worked before. --> **Short description of error** I used a python script to submit render task with bpy.ops.flamenco.submit_job() API. That is OK when I running this script by command, ``` > blender xxx.blender --python xxx.py ``` but when I want to execute it in the background by this command, ``` > blender xxx.blender --python xxx.py -b ``` the script will have problem, it shows that: ``` > ERROR (wm.operator): C:\Users\blender\git\blender-v330\blender.git\source\blender\windowmanager\intern\wm_event_system.cc:1419 wm_operator_invoke: invalid operator call 'FLAMENCO_OT_submit_job' ``` This is my code, ``` scene = bpy.context.scene scene.flamenco_job_name = "test" bpy.ops.flamenco.fetch_job_types() scene.flamenco_job_type = 'simple-blender-render' scene.flamenco_job_settings.frames = '1-1' scene.flamenco_job_settings.render_output_root = render_output_dir bpy.ops.flamenco.submit_job("INVOKE_DEFAULT") ``` I don't know why the bpy.ops.flamenco.submit_job() connot work in the background. Please help!

Hi @kaikai_liu, I'm trying to do the same thing and I've ended up in the same situation.

Hi @kaikai_liu, I'm trying to do the same thing and I've ended up in the same situation.

The Flamenco add-on was not designed for running in the background. It only has an invoke() function, which is meant for interactive use, and thus is not available when running Blender in headless mode.

What's the organisation of your storage? As in, which of the three options documented at https://flamenco.blender.org/usage/shared-storage/ are you using? If I know that, I can help you better with a solution that may not even involve running Blender at all (to submit the job, that is).

The Flamenco add-on was not designed for running in the background. It only has an `invoke()` function, which is meant for interactive use, and thus is not available when running Blender in headless mode. What's the organisation of your storage? As in, which of the three options documented at https://flamenco.blender.org/usage/shared-storage/ are you using? If I know that, I can help you better with a solution that may not even involve running Blender at all (to submit the job, that is).
Sybren A. Stüvel added the
Status
Needs Information from User
label 2023-10-10 11:14:47 +02:00

Hey, thanks for your response. In my case I'm using Shaman.

I thought about implementing my own API client to submit jobs, but since I don't know the ins and outs of Shaman, I thought it would just be easier to use the add-on.

This is my imperfect, quick and easy solution. Run Blender in graphical mode, submit the job and kill Blender after some time.

Hey, thanks for your response. In my case I'm using Shaman. I thought about implementing my own API client to submit jobs, but since I don't know the ins and outs of Shaman, I thought it would just be easier to use the add-on. [This](https://github.com/a13xie/flamenco-submitter/blob/the-chosen-one/submit.sh) is my imperfect, quick and easy solution. Run Blender in graphical mode, submit the job and kill Blender after some time.
Author

Thanks, I read about Flamenco API and found a solution to my problem. It's a good idea to submit my job without running Blender.

Thanks, I read about Flamenco API and found a solution to my problem. It's a good idea to submit my job without running Blender.

@a13xie when using Shaman things are quite a bit more complex, and indeed then you'd need some functionality of the add-on. I would recommend copying the addon/flamenco/bat directory into your own Python code, to see if you can use it (after some adjustments) directly. Submitting to Shaman doesn't need Blender.

@a13xie when using Shaman things are quite a bit more complex, and indeed then you'd need some functionality of the add-on. I would recommend copying the `addon/flamenco/bat` directory into your own Python code, to see if you can use it (after some adjustments) directly. Submitting to Shaman doesn't need Blender.
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: studio/flamenco#104187
No description provided.