def _wait_for_job(linode_id, job_id, timeout=300, quiet=True):
 interval = 5
 iterations = int((timeout / interval))
 for i in range(0, iterations):
  jobs_result = _query('linode', 'job.list', args={'LinodeID': linode_id})['DATA']
  if ((jobs_result[0]['JOBID'] == job_id) and (jobs_result[0]['HOST_SUCCESS'] == 1)):
   return True
  time.sleep(interval)
  if (not quiet):
   log.info('Still waiting on Job {0} for Linode {1}.'.format(job_id, linode_id))
  else:
   log.debug('Still waiting on Job {0} for Linode {1}.'.format(job_id, linode_id))
 return False

def _wait_for_job ( linode_id , job_id , timeout = 300 , quiet = True ) : interval = 5 iterations = int ( ( timeout / interval ) ) for i in range ( 0 , iterations ) : jobs_result = _query ( 'linode' , 'job.list' , args = { 'LinodeID' : linode_id } ) [ 'DATA' ] if ( ( jobs_result [ 0 ] [ 'JOBID' ] == job_id ) and ( jobs_result [ 0 ] [ 'HOST_SUCCESS' ] == 1 ) ) : return True time . sleep ( interval ) if ( not quiet ) : log . info ( 'Still waiting on Job {0} for Linode {1}.' . format ( job_id , linode_id ) ) else : log . debug ( 'Still waiting on Job {0} for Linode {1}.' . format ( job_id , linode_id ) ) return False
wait for a job to return .