Commit 1aaabf94 authored by Niklas Hambuechen's avatar Niklas Hambuechen

qa: qa_job_utils: add `RetryingUntilJobStatus`

Dual to `RetryingWhileJobStatus`.
It retries until the given status is reached.
Signed-off-by: default avatarNiklas Hambuechen <niklash@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent 3b53dd6e
......@@ -411,6 +411,20 @@ def GetJobStatus(job_id):
return GetJobStatuses([job_id]).get(job_id, None)
def RetryingUntilJobStatus(retry_status, job_id):
""" Used with C{retry.Retry}, waits for a given status.
@type retry_status: string
@param retry_status: The job status to wait for.
@type job_id: string
@param job_id: The job id, represented as a string.
"""
status = GetJobStatus(job_id)
if status != retry_status:
raise retry.RetryAgain()
def RetryingWhileJobStatus(retry_status, job_id):
""" Used with C{retry.Retry}, waits for a status other than the one given.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment