Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #419 from lubosmj/total-values-count
Browse files Browse the repository at this point in the history
Get number of total tags before finishing the task
  • Loading branch information
ipanova authored Oct 1, 2019
2 parents 0c2551e + 414d62d commit dfd5677
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pulp_docker/app/tasks/sync_stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit dfd5677

Please sign in to comment.