Spaces:
Running
Running
Added Timeout error to the "wait" function
Browse files
app.py
CHANGED
@@ -35,8 +35,11 @@ class Prodia:
|
|
35 |
|
36 |
def wait(self, job):
|
37 |
job_result = job
|
38 |
-
|
|
|
39 |
while job_result['status'] not in ['succeeded', 'failed']:
|
|
|
|
|
40 |
time.sleep(0.25)
|
41 |
job_result = self.get_job(job['job'])
|
42 |
|
|
|
35 |
|
36 |
def wait(self, job):
|
37 |
job_result = job
|
38 |
+
start_wait = time.time()
|
39 |
+
|
40 |
while job_result['status'] not in ['succeeded', 'failed']:
|
41 |
+
if int(time.time() - start_wait) > 60:
|
42 |
+
raise Exception(f"Timeout error: {job_result['status']}")
|
43 |
time.sleep(0.25)
|
44 |
job_result = self.get_job(job['job'])
|
45 |
|