Increase Celery wait times
It's a bit inefficient, but provides nicer output and a bit of settling time between each stage.
This commit is contained in:
parent
07026efb63
commit
b522306f87
|
@ -79,7 +79,7 @@ def wait_for_celery_task(CLI_CONFIG, task_detail):
|
||||||
# Wait for the task to start
|
# Wait for the task to start
|
||||||
echo(CLI_CONFIG, "Waiting for task to start...", newline=False)
|
echo(CLI_CONFIG, "Waiting for task to start...", newline=False)
|
||||||
while True:
|
while True:
|
||||||
sleep(0.25)
|
sleep(0.5)
|
||||||
task_status = pvc.lib.common.task_status(
|
task_status = pvc.lib.common.task_status(
|
||||||
CLI_CONFIG, task_id=task_id, is_watching=True
|
CLI_CONFIG, task_id=task_id, is_watching=True
|
||||||
)
|
)
|
||||||
|
@ -104,7 +104,7 @@ def wait_for_celery_task(CLI_CONFIG, task_detail):
|
||||||
newline=False,
|
newline=False,
|
||||||
)
|
)
|
||||||
while True:
|
while True:
|
||||||
sleep(0.25)
|
sleep(0.5)
|
||||||
if task_status.get("state") != "RUNNING":
|
if task_status.get("state") != "RUNNING":
|
||||||
break
|
break
|
||||||
if task_status.get("current") > last_task:
|
if task_status.get("current") > last_task:
|
||||||
|
|
|
@ -36,7 +36,7 @@ def start(celery, msg, current=0, total=1):
|
||||||
celery.update_state(
|
celery.update_state(
|
||||||
state="RUNNING", meta={"current": current, "total": total, "status": msg}
|
state="RUNNING", meta={"current": current, "total": total, "status": msg}
|
||||||
)
|
)
|
||||||
sleep(0.5)
|
sleep(1)
|
||||||
|
|
||||||
|
|
||||||
def fail(celery, msg, current=1, total=1):
|
def fail(celery, msg, current=1, total=1):
|
||||||
|
@ -67,7 +67,7 @@ def update(celery, msg, current=1, total=2):
|
||||||
celery.update_state(
|
celery.update_state(
|
||||||
state="RUNNING", meta={"current": current, "total": total, "status": msg}
|
state="RUNNING", meta={"current": current, "total": total, "status": msg}
|
||||||
)
|
)
|
||||||
sleep(0.5)
|
sleep(1)
|
||||||
|
|
||||||
|
|
||||||
def finish(celery, msg, current=2, total=2):
|
def finish(celery, msg, current=2, total=2):
|
||||||
|
@ -77,6 +77,6 @@ def finish(celery, msg, current=2, total=2):
|
||||||
state="RUNNING",
|
state="RUNNING",
|
||||||
meta={"current": current, "total": total, "status": "Finishing up"},
|
meta={"current": current, "total": total, "status": "Finishing up"},
|
||||||
)
|
)
|
||||||
sleep(0.5)
|
sleep(1)
|
||||||
logger.info(f"Success {current}/{total}: {msg}")
|
logger.info(f"Success {current}/{total}: {msg}")
|
||||||
return {"status": msg, "current": current, "total": total}
|
return {"status": msg, "current": current, "total": total}
|
||||||
|
|
Loading…
Reference in New Issue