comparison Tests/Toolbox.py @ 181:911070f790e3

more checks
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 08 Oct 2018 17:16:11 +0200
parents 8a2dd77d4035
children 6ff9d035b26b
comparison
equal deleted inserted replaced
180:fcb0c14dadb8 181:911070f790e3
247 else: 247 else:
248 return WaitJobDone(orthanc, diff[0]) 248 return WaitJobDone(orthanc, diff[0])
249 249
250 def MonitorJob2(orthanc, func): # "func" is a lambda 250 def MonitorJob2(orthanc, func): # "func" is a lambda
251 a = set(DoGet(orthanc, '/jobs')) 251 a = set(DoGet(orthanc, '/jobs'))
252 func() 252 job = func()
253 b = set(DoGet(orthanc, '/jobs')) 253 b = set(DoGet(orthanc, '/jobs'))
254 254
255 diff = list(b - a) 255 diff = list(b - a)
256 if len(diff) != 1: 256 if len(diff) != 1:
257 print('No job was created!') 257 print('No job was created!')
258 return None
259 elif (not 'ID' in job or
260 diff[0] != job['ID']):
261 print('Mismatch in the job ID')
258 return None 262 return None
259 elif WaitJobDone(orthanc, diff[0]): 263 elif WaitJobDone(orthanc, diff[0]):
260 return diff[0] 264 return diff[0]
261 else: 265 else:
262 print('Error while executing the job') 266 print('Error while executing the job')