-
Notifications
You must be signed in to change notification settings - Fork 168
Conversation
1c805d7
to
05e5789
Compare
I think it'd be super neat if we used Spinx-y docstrings where mentions of classes, for example, are written as |
6bfd702
to
34542f5
Compare
I'm going to put some work into making the docstrings great since this is the new Plugin API, but having some more comments on the code currently here would be great. |
@@ -0,0 +1,6 @@ | |||
from pulp.platform import ProgressBar, ProgressSpinner, Repository, RepositoryContent |
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.
This needs to be from pulp.platform.models import ....
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.
good catch, done.
So far, I like this approach the best. It provides clear separation of concerns between the platform (core) model and the plugin integration (layer) model. Plugin (contributed) objects are used differently by the platform so having them be an extension of the platform model instead of part of the platform model seems appropriate. Also, this achieves the goal of simplifying the plugin writer's universe. It reinforces this:
I assume you'll be adding additional methods on these classes for feature parity with pulp2 model after we have consensus on the approach? |
@jortel Thanks a lot for the review. Everything suggested makes sense and I will revise it today along with improving the docstrings. The one thing I had not planned on doing was adding more methods. The upload in 2.y was on the importer but I think that can become an all-platform activity and the plugin writer would not have to implement anything to support it. Similarly for Copy. It's likely other methods do need to be added though. What do you think those methods are? |
Agreed about the After review of the pulp2 models only a few things come to mind.
|
|
||
def publish(self): | ||
""" | ||
Perform a publish |
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.
It would be great to emphasize here that the plugin writer should definitely not try to implement their publish logic on this class. They should implement it somewhere else, and just call their workflow from here.
Looking very good! I think this will be mergeable when your next changes are done. |
@jortel some responses:
I think removing published data when the distributor gets deleted will continue to be important. There may be a more elegant way to trigger that on the model than how we did it in pulp 2, such as using the post_delete signal.
That sounds like it might be a good fit for a class or static method on the unit model, but I'm light on details of what it would need to do. |
My preference would be to have the platform provide a set of methods to interact with the filesystem which records the ownership of files and purges them (accounting for shared directories) automatically. It doesn't seem like something the plugin writer should ever need to worry about. We already provide a utility method to attempt to handle race conditions during directory creation, anyway. |
Recapping discussion with @bmbouter Upload could (as one option) be handled by putting a class method on each unit model called something like Copy and remove are both great candidates for a default implementation in the platform, with the option for the plugin writer to override and provide custom logic. Examples for why that's useful include dependency resolution in pulp_rpm, copying docker manifests and blobs along with the tags that reference them, etc. I agree that all of that can be considered and implemented in the future and not on this PR. |
Majorly agree. This lines up well with the "managed publications" idea I've described in the past. We'll get there! |
34542f5
to
81ac3d9
Compare
It is expected that plugins wanting to support publish will provide an implementation on the | ||
subclassed Distributor. | ||
|
||
The publish to perform uses the model attributes to encapsulate all of the information |
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 find the first few words a little awkward to read. I think you could just cut them out and reduce this to "The model attributes encapsulate all of the information required."
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.
agreed
I made some suggestions, but otherwise it looks fine to me. |
81ac3d9
to
4cc4740
Compare
:class `~nectar.downloaders.base.Downloader` object. Using this interface, content that is | ||
stored locally or in multiple locations can be fetched more efficiently. | ||
|
||
The platform will use one :class `~pulp.plugin.Cataloger` instance per content source so this |
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.
should be :class:
, right?
I'm satisfied. The suggestion made by @mhrivnak is good (though, I strongly oppose using signals) that the derived plugin |
Based on everything here, this looks good to me as well |
4cc4740
to
4b0201c
Compare
This PR adds the following base objects as part of the plugin API. * Cataloger * Importer * Profiler * Publisher It also imports the following objects from pulp.platform.models for usage by plugins: * ProgressBar * ProgressSpinner * Repository * RepositoryContent It removes several modules from the old pulp.plugins package. closes pulp#2181 https://pulp.plan.io/issues/2181
4b0201c
to
06ed427
Compare
Fixes an issue where tasks which go through apply_async() directly fail to be associated with a worker, and thus are not properly cancelled when the worker is restarted mid-execution and performs cleanup. closes #2734 https://pulp.plan.io/issues/2734 (cherry picked from commit 9bca6a9)
This PR adds a base Cataloger and Profiler objects to
pulp.plugin. It as imports the following objects from
pulp.platform.models for usage by plugins:
It removes several modules from the old pulp.plugins
package.
This does not have an interface for upload. After thinking about it I believe platform can do everything for upload assuming that a plugin writer has defined the Content type correctly. If this turns out not to be the case we can easily add the upload interface.
closes #2181
https://pulp.plan.io/issues/2181