yaotungyu

tots job completion detect

Sep 30th, 2020 (edited)
761
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from deadline9.DeadlineConnect import DeadlineCon
  2. from deadline_rest import deadline_tools as dt
  3. from deadline9 import JobReports
  4. from deadline9 import TaskReports
  5. from deadline9 import Slaves
  6. from deadline9 import Jobs
  7. ddln_conProp = DeadlineCon(**dt.DEADLINE_HOST)
  8. ddln_taskreporter = TaskReports.TaskReports(ddln_conProp.connectionProperties)
  9. ddln_jobreporter = JobReports.JobReports(ddln_conProp.connectionProperties)
  10. ddln_slavereporter = Slaves.Slaves(ddln_conProp.connectionProperties)
  11. ddln_jobs = Jobs.Jobs(ddln_conProp.connectionProperties)
  12.  
  13. from aronado import _sg_query_util
  14. reload(_sg_query_util)
  15. active_jobs_get = ddln_jobs.GetJobsInState('1')
  16. active_tots_sfn_jobs = [j for j in active_jobs_get if 'TOTS' in j['Props']['Batch'] and 'sfn' in j['Props']['Batch']]
  17. print len(active_tots_sfn_jobs)
  18. for a in active_tots_sfn_jobs:
  19.     job_shot_code = a['Props']['Batch'].split('_sfn_')[0]
  20.     task_dict = _sg_query_util.get_shot_tasks(job_shot_code)
  21.     if [t for t in task_dict if (t['content']=='Shot_Finalling' and t['sg_status_list']=='rdr')or(t['content']=='Shot_Finalling' and t['sg_status_list']=='rdq')] == []:
  22.         ddln_jobs.CompleteJob(a['_id'])
  23.         print 'completed job:',a['Props']['Batch'],':',a['_id']
RAW Paste Data