Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds lazy download support #132

Merged
merged 1 commit into from Nov 30, 2018
Merged

Adds lazy download support #132

merged 1 commit into from Nov 30, 2018

Conversation

bmbouter
Copy link
Member

@bmbouter bmbouter commented Nov 14, 2018

Required PR: pulp/pulp#3738

pulp_file now meaningfully uses the 'policy' attribute when syncing
content.

This is meant to be used with this PR:
pulp/pulp#3738

https://pulp.plan.io/issues/4160
closes #4160

bmbouter pushed a commit to bmbouter/pulp that referenced this pull request Nov 14, 2018
Required PR: pulp/pulp_file#132

This includes a serializer that validates input correctly.

https://pulp.plan.io/issues/3763
closes pulp#3763
bmbouter pushed a commit to bmbouter/pulp that referenced this pull request Nov 14, 2018
Required PR: pulp/pulp_file#132

This includes a serializer that validates input correctly.

https://pulp.plan.io/issues/3763
closes pulp#3763
bmbouter pushed a commit to bmbouter/pulp that referenced this pull request Nov 20, 2018
Required PR: pulp/pulp_file#132

This includes a serializer that validates input correctly.

This also switches the finalize, write_data, and handle_headers
callbacks to be coroutines themselves. This is required because within
those callbacks the streamer needs to await on coroutines and that can
only be done from withing a coroutine itself.

https://pulp.plan.io/issues/3763
closes pulp#3763
bmbouter pushed a commit to bmbouter/pulp that referenced this pull request Nov 20, 2018
Required PR: pulp/pulp_file#132

This includes a serializer that validates input correctly.

This also switches the finalize, write_data, and handle_headers
callbacks to be coroutines themselves. This is required because within
those callbacks the streamer needs to await on coroutines and that can
only be done from withing a coroutine itself.

This also adjusts the Remote.get_downloader() method signature to take
`url` or `remote_artifact` as kwargs instead of `url` as a positional
parameter. This allows plugin writers (and the streamer) to get
downloaders configured with digest and size validation automatically
from remote_artifacts.

https://pulp.plan.io/issues/3763
closes pulp#3763
bmbouter pushed a commit to bmbouter/pulp that referenced this pull request Nov 27, 2018
Required PR: pulp/pulp_file#132

This includes a serializer that validates input correctly.

This also switches the finalize, write_data, and handle_headers
callbacks to be coroutines themselves. This is required because within
those callbacks the streamer needs to await on coroutines and that can
only be done from withing a coroutine itself.

This also adjusts the Remote.get_downloader() method signature to take
`url` or `remote_artifact` as kwargs instead of `url` as a positional
parameter. This allows plugin writers (and the streamer) to get
downloaders configured with digest and size validation automatically
from remote_artifacts.

https://pulp.plan.io/issues/3763
closes pulp#3763
bmbouter pushed a commit to bmbouter/pulp that referenced this pull request Nov 29, 2018
Required PR: pulp/pulp_file#132

This includes a serializer that validates input correctly.

This also switches the finalize, write_data, and handle_headers
callbacks to be coroutines themselves. This is required because within
those callbacks the streamer needs to await on coroutines and that can
only be done from withing a coroutine itself.

This also adjusts the Remote.get_downloader() method signature to take
`url` or `remote_artifact` as kwargs instead of `url` as a positional
parameter. This allows plugin writers (and the streamer) to get
downloaders configured with digest and size validation automatically
from remote_artifacts.

https://pulp.plan.io/issues/3763
closes pulp#3763
dv = DeclarativeVersion(first_stage, repository, mirror=mirror)
else:
dv = DeclarativeVersion(first_stage, repository, mirror=mirror, download_artifacts=False)
dv.create()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest:

download_artifacts = (remote.policy == POLICY_MODE.IMMEDIATE)
dv = DeclarativeVersion(first_stage, repository, mirror=mirror, download_artifacts=download_artifacts)

to reduce code duplication.

Let's compare using the constants.POLICY_MODE instead of the string literal.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me to use POLICY_MODE here I would need to import from pulpcore.constants which a plugin should not do directly. We need this to be in the plugin API somewhere. Maybe we should just import them through pulpcore.plugin.constants?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the Django docs show putting these types of things on the models themselves. After just importing a bunch of things "through" the plugin API, it seems easier just to do that instead. What about that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, having the constants on a model would be good.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I'll do that, thanks.

Copy link
Contributor

@jortel jortel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @bmbouter.

bmbouter pushed a commit to bmbouter/pulp that referenced this pull request Nov 30, 2018
Required PR: pulp/pulp_file#132

This includes a serializer that validates input correctly.

This also switches the finalize, write_data, and handle_headers
callbacks to be coroutines themselves. This is required because within
those callbacks the streamer needs to await on coroutines and that can
only be done from withing a coroutine itself.

This also adjusts the Remote.get_downloader() method signature to take
`url` or `remote_artifact` as kwargs instead of `url` as a positional
parameter. This allows plugin writers (and the streamer) to get
downloaders configured with digest and size validation automatically
from remote_artifacts.

https://pulp.plan.io/issues/3763
closes pulp#3763
bmbouter pushed a commit to bmbouter/pulp that referenced this pull request Nov 30, 2018
Required PR: pulp/pulp_file#132

This includes a serializer that validates input correctly.

This also switches the finalize, write_data, and handle_headers
callbacks to be coroutines themselves. This is required because within
those callbacks the streamer needs to await on coroutines and that can
only be done from withing a coroutine itself.

This also adjusts the Remote.get_downloader() method signature to take
`url` or `remote_artifact` as kwargs instead of `url` as a positional
parameter. This allows plugin writers (and the streamer) to get
downloaders configured with digest and size validation automatically
from remote_artifacts.

https://pulp.plan.io/issues/3763
closes pulp#3763
Required PR: pulp/pulp#3738

pulp_file now meaningfully uses the 'policy' attribute when syncing
content.

This is meant to be used with this PR:
pulp/pulp#3738

https://pulp.plan.io/issues/4160
closes #4160
bmbouter pushed a commit to bmbouter/pulp that referenced this pull request Nov 30, 2018
Required PR: pulp/pulp_file#132

This includes a serializer that validates input correctly.

This also switches the finalize, write_data, and handle_headers
callbacks to be coroutines themselves. This is required because within
those callbacks the streamer needs to await on coroutines and that can
only be done from withing a coroutine itself.

This also adjusts the Remote.get_downloader() method signature to take
`url` or `remote_artifact` as kwargs instead of `url` as a positional
parameter. This allows plugin writers (and the streamer) to get
downloaders configured with digest and size validation automatically
from remote_artifacts.

https://pulp.plan.io/issues/3763
closes pulp#3763
@bmbouter bmbouter merged commit fb3a0f6 into pulp:master Nov 30, 2018
@bmbouter bmbouter deleted the streamer branch November 30, 2018 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants