-
Notifications
You must be signed in to change notification settings - Fork 53
Conversation
pulp_docker/app/tasks/sync_stages.py
Outdated
pb.increment() | ||
|
||
with ProgressBar(message='Creating Download requests for Tags') as pb: | ||
# could use total of len(tag_list) but if schema1 is present done will be < total |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is just creating download requests, even schema1 tags will be downloaded the number will be len(tag_list)
pulp_docker/app/tasks/sync_stages.py
Outdated
pb.increment() | ||
|
||
with ProgressBar(message='Parsing SchemaV2 Tags') as pb: | ||
while to_download: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you go with this pattern rather than asyncio.as_completed(to_download)? This seems fine, just curious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think there was any particular reason, i can change it to as_completed for the sake of readability
b1520c3
to
990817f
Compare
8f49e99
to
5f88d68
Compare
@ipanova I fixed some things, but now your branch needs to be rebased. |
a559955
to
0509280
Compare
pulp_docker/app/tasks/sync_stages.py
Outdated
@@ -1,11 +1,12 @@ | |||
import json | |||
import logging | |||
import asyncio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: move to alphabetical order
pulp_docker/app/tasks/sync_stages.py
Outdated
raw = content_file.read() | ||
results.artifact_attributes['file'] = results.path | ||
try: | ||
saved_artifact = Artifact(**results.artifact_attributes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line should be moved out of the try/except.
pulp_docker/app/tasks/sync_stages.py
Outdated
pb.increment() | ||
|
||
else: | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment here? It's sort of surprising that no mediatype means schema1.
pulp_docker/app/tasks/sync_stages.py
Outdated
raise Exception(msg) | ||
|
||
async def create_and_process_tagged_manifest_list(self, tag_dc, manifest_list_data): | ||
def create_and_process_tagged_manifest_list(self, tag_dc, manifest_list_data): | ||
""" | ||
Create a ManifestList and nested ImageManifests from the Tag artifact. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer creates nested ImageManifests
pulp_docker/app/tasks/sync_stages.py
Outdated
|
||
return list_dc | ||
|
||
def create_and_process_tagged_manifest(self, tag_dc, manifest_data): | ||
""" | ||
Create a Manifest and nested ManifestBlobs from the Tag artifact. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer creates nested ManifestBlobs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, this is what I meant by "process", so maybe the name of the function should be changed too.
try: | ||
thru.save() | ||
except IntegrityError: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment here why IntegrityError is ok
pulp_docker/app/tasks/synchronize.py
Outdated
ResolveContentFutures, | ||
QueryExistingArtifacts, | ||
QueryExistingContents, | ||
ContentSaver, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alpha order pls
Took a first pass, nothing but nits, looking great! I'll do a more thorough review with some manual testing after you make the changes we discussed earlier today. |
e10b2af
to
8ec95d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not hand tested, but if travis is passing, I am ok to merge. I would rather merge now (even if there are problems) than hand test a lot-- this will help us to build more helpful functional tests and get the current version out to the community.
|
||
|
||
class TagListStage(Stage): | ||
class DockerFirstStage(Stage): | ||
""" | ||
The first stage of a pulp_docker sync pipeline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be good to add a second paragraph that explains the steps that take place since this is an unusually heavy first stage.
pulp_docker/app/tasks/sync_stages.py
Outdated
man_dcs = {} | ||
total_blobs = [] | ||
|
||
with ProgressBar(message='Downloading tag list for the repo', total=1) as pb: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/for the repo//
pulp_docker/app/tasks/sync_stages.py
Outdated
to_download.append(downloader.run(extra_data={'headers': V2_ACCEPT_HEADERS})) | ||
pb.increment() | ||
|
||
pb1 = ProgressBar(message='Parsed SchemaV2 Tags', state='running') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Parsed/Parsing/ to be consistent with the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parsed_s2_tags if we plan to do s1. If not parsed_tags.
pulp_docker/app/tasks/sync_stages.py
Outdated
pb1 = ProgressBar(message='Parsed SchemaV2 Tags', state='running') | ||
pb2 = ProgressBar(message='Parsing Manifest List Tags', state='running') | ||
pb3 = ProgressBar(message='Parsing Manifests Tags', state='running') | ||
global pb4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do some but not others need to be global? Perhaps a comment would be helpful.
pulp_docker/app/tasks/sync_stages.py
Outdated
await self.put(tag_dc) | ||
pb1.increment() | ||
else: | ||
# in case it a schema1 continue to the next tag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a DEBUG log message would be good here also.
pulp_docker/app/tasks/sync_stages.py
Outdated
pb3 = ProgressBar(message='Parsing Manifests Tags', state='running') | ||
global pb4 | ||
pb4 = ProgressBar(message='Parsing Blobs', state='running') | ||
pb5 = ProgressBar(message='Parsing Manifests', state='running') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how you did these progress bars. It nicely separates the workflow we need to follow from the workflow the user would want to see.
pulp_docker/app/tasks/sync_stages.py
Outdated
pb4 = ProgressBar(message='Parsing Blobs', state='running') | ||
pb5 = ProgressBar(message='Parsing Manifests', state='running') | ||
while to_download: | ||
done, to_download = await asyncio.wait(to_download, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you use the as_completed loop below, it would be more readable if both loops are the same. (Ignore if this works better for some reason)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i changed this to as_completed, i also moved the saving of the Artifact after we check the mediatype, so we do not save Artifact of schema1
pulp_docker/app/tasks/sync_stages.py
Outdated
async def create_and_process_tagged_manifest_list(self, tag_dc, manifest_list_data): | ||
""" | ||
Create a ManifestList and nested ImageManifests from the Tag artifact. | ||
Create a ManifestList from the Tag artifact. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/from the Tag artifact//. Since we don't read the artifact here.
pulp_docker/app/tasks/sync_stages.py
Outdated
""" | ||
Create a pending manifest from manifest data in a ManifestList. | ||
Create a Manifest from manifest data in a ManifestList. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More generally, since this data is coming in, it doesn't matter where its from to this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wanted to stress that this manifest is not tagged and when creating it, we rely on some information provided from ML
self.relate_manifest_to_list(dc) | ||
elif dc.extra_data.get('blob_relation'): | ||
self.relate_blob(dc) | ||
elif dc.extra_data.get('config_relation'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can a single unit have relations to multiple types of other objects? If so, I think these need to be ifs, not elifs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my thinking was to create a singe relation type per unit, so elif is correct here
pulp_docker/app/tasks/sync_stages.py
Outdated
to_download.append(downloader.run(extra_data={'headers': V2_ACCEPT_HEADERS})) | ||
pb.increment() | ||
|
||
pb1 = ProgressBar(message='Parsed SchemaV2 Tags', state='running') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parsed_s2_tags if we plan to do s1. If not parsed_tags.
pulp_docker/app/tasks/sync_stages.py
Outdated
pb.increment() | ||
|
||
pb1 = ProgressBar(message='Parsed SchemaV2 Tags', state='running') | ||
pb2 = ProgressBar(message='Parsing Manifest List Tags', state='running') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parsed_manifest_list_tags
pulp_docker/app/tasks/sync_stages.py
Outdated
|
||
pb1 = ProgressBar(message='Parsed SchemaV2 Tags', state='running') | ||
pb2 = ProgressBar(message='Parsing Manifest List Tags', state='running') | ||
pb3 = ProgressBar(message='Parsing Manifests Tags', state='running') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parsed_manifest_tags
closes #4173 closes #4178 https://pulp.plan.io/issues/4173 https://pulp.plan.io/issues/4178
8ec95d3
to
568c4a3
Compare
No description provided.