comparison Tests/Toolbox.py @ 179:8a2dd77d4035

testing split/merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 01 Oct 2018 17:54:32 +0200
parents d468cbe1b161
children 911070f790e3
comparison
equal deleted inserted replaced
178:c896ac762b9f 179:8a2dd77d4035
245 print('No job was created!') 245 print('No job was created!')
246 return False 246 return False
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
251 a = set(DoGet(orthanc, '/jobs'))
252 func()
253 b = set(DoGet(orthanc, '/jobs'))
254
255 diff = list(b - a)
256 if len(diff) != 1:
257 print('No job was created!')
258 return None
259 elif WaitJobDone(orthanc, diff[0]):
260 return diff[0]
261 else:
262 print('Error while executing the job')
263 return None
264
250 def GetDockerHostAddress(): 265 def GetDockerHostAddress():
251 route = subprocess.check_output([ '/sbin/ip', 'route' ]) 266 route = subprocess.check_output([ '/sbin/ip', 'route' ])
252 m = re.search(r'default via ([0-9.]+)', route) 267 m = re.search(r'default via ([0-9.]+)', route)
253 if m == None: 268 if m == None:
254 return 'localhost' 269 return 'localhost'