From 414d62d05767de59d6395d123f3a3452b8d7e094 Mon Sep 17 00:00:00 2001 From: Lubos Mjachky Date: Tue, 1 Oct 2019 16:07:35 +0200 Subject: [PATCH] Get number of total tags before finishing the task [noissue] --- pulp_docker/app/tasks/sync_stages.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pulp_docker/app/tasks/sync_stages.py b/pulp_docker/app/tasks/sync_stages.py index d1876bb0..650762be 100644 --- a/pulp_docker/app/tasks/sync_stages.py +++ b/pulp_docker/app/tasks/sync_stages.py @@ -10,6 +10,7 @@ from django.db import IntegrityError from pulpcore.plugin.models import Artifact, ProgressReport, Remote from pulpcore.plugin.stages import DeclarativeArtifact, DeclarativeContent, Stage +from pulpcore.constants import TASK_STATES from pulp_docker.app.models import (Manifest, MEDIA_TYPE, Blob, Tag, BlobManifest, ManifestListManifest) @@ -78,7 +79,10 @@ async def run(self): to_download.append(downloader.run(extra_data={'headers': V2_ACCEPT_HEADERS})) pb_parsed_tags = ProgressReport( - message='Processing Tags', code='processing.tag', state='running' + message='Processing Tags', + code='processing.tag', + state=TASK_STATES.RUNNING, + total=len(tag_list) ) for download_tag in asyncio.as_completed(to_download): @@ -115,7 +119,6 @@ async def run(self): pb_parsed_tags.increment() pb_parsed_tags.state = 'completed' - pb_parsed_tags.total = pb_parsed_tags.done pb_parsed_tags.save() for manifest_future in asyncio.as_completed(future_manifests):