Forum Replies Created
-
6th May 2022 at 1:34 pm #34507
Oh ! I figured it out ! The line job_id = message.split(‘: ‘)[-1] was returning a string, but jobGet was looking for an integer, and I wasn’t looking at the proper place to find dispatcher-side error, so I hadn’t saw the real issue. It works like a charm, now. Thank you for your help !
6th May 2022 at 1:10 pm #34506I tried to move onCustomNodeMessage function into Global template 0 and to send 0,0 with sendMessage but it didn’t work either.
5th May 2022 at 12:15 pm #34503Alright, I managed to have the template python log as you explained, thanks. It looks like the onCustomNodeMessage function is not called, but I don’t know why. I tried to call it using the following line :
MInstanceAPI.sendMessage(0, self.getID(), “ABORTJOB: {}”.format(job.getJobId()))
I also tried to use MInstanceAPI.sendMessage(instance_id, self.getID(), “ABORTJOB: {}”.format(job.getJobId())), with instance_id being the id of the client rendering the chunk, but it did not work either. But the kTemplateErrorAbortRender action send just after the send message is correctly evaluated. Did it prevent the onCustomNodeMessage being evaluated as well ?
Here is the whole code :
`def onCustomNodeMessage(self, nodeId, message):
print(“Dispatcher received a custom message from node ID ” + str(nodeId) + “:” + message)
import MDispatcherAPI
job_id = message.split(‘: ‘)[-1]err, job = MDispatcherAPI.jobGet(job_id)
job.setPaused(True)
MDispatcherAPI.jobUpdate(job_id)def onCheckLogLine(self, job, chunk, clientTemplatePreferences, line, lineNum, warnings, errors, silencedWarnings, silencedErrors):
if line.find(“PROC ERR”) != -1:
import MInstanceAPI
MInstanceAPI.sendMessage(0, self.getID(), “ABORTJOB: {}”.format(job.getJobId()))# abort render when detecting PROC ERROR in log
error = MTemplateAPI.MTemplateError(1, “ABORT RENDER”, MTemplateAPI.MTemplateError.kTemplateErrorTypeError)
error.addErrorAction(MTemplateAPI.MTemplateError.kTemplateErrorAbortRender)
return error
return MTemplateAPI.MTemplateError()`
4th May 2022 at 3:27 pm #34501Hello Leonardo,
Thanks for your answer. I tried to redirect python logs to job logs using Logs section of both the renderclient and Dispatcher, but unfortunately it did not appears in chunks logs (I didn’t used evaluation version because the error I want to detect is linked to a lot of pipe-related stuff).
Regards
29th April 2022 at 10:30 am #34495Hi Leonardo,
Thank you for your answer. Your explanations were pretty clear, but unfortunately, I didn’t manage to make it work. Maybe there is something I misundertood.
In my onCheckLogLine function, I called MInstanceAPI.sendMessage(0, self.getID(), “ABORTJOB: {}”.format(job.getJobId()))
Then I declared in my template a function onCustomNodeMessage, containing the following lines :print(“Dispatcher received a custom message from node ID ” + str(nodeId) + “:” + message)
job_id = message.split(‘: ‘)[-1]
err, job = MDispatcherAPI.jobGet(job_id)
job.setPaused(True)
MDispatcherAPI.jobUpdate(job_id)It did not pause the job, and I haven’t found the print message in instance log (and chunk log seems to be empty when render is aborted). Did I miss something or the function onCustomNodeMessage have not been called ? Muster isn’t very talkative. Is there a place where script error in template are send ?
Regards
-