Page 1 of 1

JSON/Python Api

Posted: Thu May 18, 2017 3:28 pm
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

Re: JSON/Python Api

Posted: Fri May 19, 2017 7:29 am
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

Re: JSON/Python Api

Posted: Fri May 19, 2017 8:41 am
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).

Re: JSON/Python Api

Posted: Fri May 19, 2017 9:06 am
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

Re: JSON/Python Api

Posted: Fri May 19, 2017 9:10 am
by timurhai
Not possible.
Error state exactly stands for it.
And it can be automatically restarted any times (number of error retries).

Re: JSON/Python Api

Posted: Fri May 19, 2017 9:12 am
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 ! :)