We have a custom event that execute python3 script on job submitted.
It work fine, except when using right click > ‘resbmit job’
We have errors that looks like python2 errors :
Event Error (OnJobSubmitted): TypeError : __init__() got an unexpected keyword argument 'text'
Does anyone can confirm that ?
Thanks
-p-
This does not look like a python 2 error, but a bug in the plugin. Does the plugin have a text
keyword argument?
Here’s the used script.
We exect it on each job submit to automatically populate the Batch Name field to regroup shots by name & excluding some jobs types (maxscript & precomp)
from Deadline.Scripting import *
from Deadline.Jobs import *
import re
"""Put the shot basename in JobBatchName field"""
def __main__( *args ):
jobs = []
if len(args) == 1:
jobId = args[0]
job = RepositoryUtils.GetJob(jobId, True)
jobs.append(job)
else:
jobs = MonitorUtils.GetSelectedJobs()
rxp = re.compile("[es][0-9]+p[0-9]+[a-z]?([._]).*", re.I)
for job in jobs:
jobName = job.JobName
m = rxp.match(jobName)
if m:
job.JobBatchName = jobName.split(m.group(1))[0]
if "[MAXSCRIPT]" in jobName:
job.JobBatchName = job.JobBatchName + "_maxscript"
if "_precomp" in jobName:
job.JobBatchName = job.JobBatchName + "_precomp"
ClientUtils.LogText("[DLAvocat] JobBatchName : " + job.JobBatchName)
RepositoryUtils.SaveJob(job)
The script is runing fine when i submit a job or if i right click > run script on the job.
It fails only when resubmiting the job