JSON/Python Api

General discussions and questions.
Post Reply
g-LuL
Posts: 10
Joined: Mon Mar 27, 2017 7:37 am

JSON/Python Api

Post by g-LuL »

Hi Timur,

I'm using the python api to send JSON with this code :

Code: Select all

afnetwork.sendServer(jsonDatadata)
I'm getting jobs, then blocks but not tasks.
Is it possible to get current active tasks (and their log files) by this way ? I want to restart some stucked blender tasks (a blender bug actually) automatically.
Or should I parse the afanasy filesystem ?

Thanks
Manu
g-LuL
Posts: 10
Joined: Mon Mar 27, 2017 7:37 am

Re: JSON/Python Api

Post by g-LuL »

Hi,

Just to explain it a bit, Blender has two different bugs on my project. In both case, it "stops" calculating without sending any information.
The log files aren't updated anymore after those bugs happened but the blender process is still alive.
So maybe can I use af_task_update_timeout ? This attribute setting is 30 but afanasy doesn't stop the task. Maybe I'm missing something.

Thanks
Manu
User avatar
timurhai
Site Admin
Posts: 911
Joined: Sun Jan 15, 2017 8:40 pm
Location: Russia, Korolev
Contact:

Re: JSON/Python Api

Post by timurhai »

Hi.

af_task_update_timeout limits time for render send any update about running task.
Any update can mean that the task is simple running.
No state changes means an update to, render updates that task has no changes.
This update needed to ensure that afrender did not forgot about this task at all, due some afanasy-related or not-afanasy-related (network) bug.

You can try to use af_task_progress_change_timeout that limits time of a task progress (percentage) change:
https://github.com/CGRU/cgru/commit/326 ... a736e254cb

Python parser class should stand for task running watching.
You can measure any timeout in a parser class.
For example you can measure time when task produced any latest stdout (or stderr).
Timur Hairulin
CGRU 3.3.1, Ubuntu 20.04, 22.04, MS Windows 10 (clients only).
g-LuL
Posts: 10
Joined: Mon Mar 27, 2017 7:37 am

Re: JSON/Python Api

Post by g-LuL »

Hi Timur,

Thanks for your answer.
I will look into this.
One more question : is it possible to restart task after this timeout instead of raising an error ?

Thanks
Manu
User avatar
timurhai
Site Admin
Posts: 911
Joined: Sun Jan 15, 2017 8:40 pm
Location: Russia, Korolev
Contact:

Re: JSON/Python Api

Post by timurhai »

Not possible.
Error state exactly stands for it.
And it can be automatically restarted any times (number of error retries).
Timur Hairulin
CGRU 3.3.1, Ubuntu 20.04, 22.04, MS Windows 10 (clients only).
g-LuL
Posts: 10
Joined: Mon Mar 27, 2017 7:37 am

Re: JSON/Python Api

Post by g-LuL »

Yeah I've just seen this (error retries) in the config.json file. It will work for my blender bugs !
Sorry for the dumb question and thanks again ! :)
Manu
Post Reply