Task #2399
closedConvert celery task repo.sync to Pulp 3
100%
Description
Task name in Pulp 2: `pulp.server.managers.repo.sync.sync`.
Task implementation in Pulp 2: https://github.com/pulp/pulp/blob/3.0-dev/server/pulp/server/controllers/repository.py#L694
The 2.y implementation does a huge amount of things we don't need to do anymore. The 3.0 implementation should do the following:
1. Query for the instance of the Importer's Master model that needs to be synced
2. Cast that Importer master instance to a detail instance
3. Set the working_dir attribute on the detail instance. This was part of issue #2456
4. Call sync (it should take no arguments)
Related issues
Updated by ttereshc about 8 years ago
- Related to Task #2380: Create a redmine task for each 2.y celery task to be converted to 3.0 added
Updated by bmbouter about 8 years ago
Here are questions I have:
1) What are the arguments for the task? scheduled_calls is not part of 3.0 so the signature would become: def sync(repo_id, sync_config_override=None)
or maybe def sync(importer_id, importer_config_override=None)
2) Will validation of the importer's config occur in the task AND in the view layer? The 2.y code does it in both.
3) How will we handle unit counts? Is that going to be implicit in the unit creation or will the task have to "fully rebuild" the unit counts at the end?
Updated by mhrivnak about 8 years ago
bmbouter wrote:
Here are questions I have:
1) What are the arguments for the task? scheduled_calls is not part of 3.0 so the signature would become:
def sync(repo_id, sync_config_override=None)
or maybedef sync(importer_id, importer_config_override=None)
Having it take a reference to the importer seems most appropriate. The importer is the thing doing the sync, and the thing that has the data necessary to do the sync.
2) Will validation of the importer's config occur in the task AND in the view layer? The 2.y code does it in both.
Seems reasonable. I'm not sure the task should make any assumptions about how it got queued, or how good the validation was at that point. Generally in multi-service design, the less trust that's required between services, the more robust the system will be. "Every service for itself."
3) How will we handle unit counts? Is that going to be implicit in the unit creation or will the task have to "fully rebuild" the unit counts at the end?
Do you mean managing the repo counts that are stored on the repo? I think we're going to try auto-generating that on the fly in pulp 3 when a repo endpoint handles a request, which is much easier and cheaper to do with a relational DB than mongodb.
Updated by ttereshc about 8 years ago
mhrivnak wrote:
bmbouter wrote:
Here are questions I have:
1) What are the arguments for the task? scheduled_calls is not part of 3.0 so the signature would become:
def sync(repo_id, sync_config_override=None)
or maybedef sync(importer_id, importer_config_override=None)
Having it take a reference to the importer seems most appropriate. The importer is the thing doing the sync, and the thing that has the data necessary to do the sync.
What do you mean by importer_id? UUID? repo + importer name?
Is it possible that importer will be deleted and then created again after the task was created? Or is deletion of importer going to be a celery task as well (and not just something performed in a view) so it is safe to refer to importer directly?
Updated by mhrivnak about 8 years ago
- Groomed changed from No to Yes
- Sprint Candidate changed from No to Yes
Either way, it is possible that the importer will have been removed and recreated between the time this task is queued and the time it runs.
My inclination is to reference the natural key. Users have an opportunity to give importers a meaningful identifier. If they replace an importer with one that has the same identifier, it's reasonable to assume that the new importer was intended to take the place of the original.
Updated by mhrivnak about 8 years ago
- Groomed changed from No to Yes
I feel confident that the remaining questions are implementation details, and can be hammered out while working on the task.
Updated by bmbouter about 8 years ago
- Description updated (diff)
Updating the description based on discussion during sprint planning.
Updated by bmbouter about 8 years ago
- Related to Task #2456: Add working directory management to sync/publish task plumbing. added
Updated by amacdona@redhat.com over 7 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to amacdona@redhat.com
Updated by bmbouter over 7 years ago
- Description updated (diff)
This story includes creating and deleting the working directory but it should not. The creation of the working directory is done by call and deleted by on_success() or on_failure().
Updated by amacdona@redhat.com over 7 years ago
- Description updated (diff)
I removed many of the steps for this story. Since importer/publisher overrides are no longer a part of the MVP, validation is also no longer necessary since that will take place before the configuration is saved to the db.
Updated by bmbouter over 7 years ago
I think some of the removed deliverables need to come back.
- validating the importer
- setting the current working directory for the interpreter and then unsetting it at the end
Updated by bmbouter over 7 years ago
Per discussion on pulp-dev[0] I'll suggest that these are the two pieces that we need to add back:
- raise a ValueError('feed cannot be null') if the feed is null <--- this is business logic
- setting the current working directory for the interpreter and then unsetting it at the end
[0]: https://www.redhat.com/archives/pulp-dev/2017-April/msg00007.html
Updated by jortel@redhat.com over 7 years ago
- Sprint/Milestone changed from 37 to 38
Updated by amacdona@redhat.com over 7 years ago
- Status changed from ASSIGNED to POST
Added by amacdona@redhat.com over 7 years ago
Added by amacdona@redhat.com over 7 years ago
Revision 8401606b | View on GitHub
Port sync task for Pulp 3.0
closes #2399
Updated by amacdona@redhat.com over 7 years ago
- Status changed from POST to MODIFIED
- % Done changed from 0 to 100
Applied in changeset pulp|8401606b530f6fb712b98fc0359d41a3cb560069.
Updated by bmbouter about 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Port sync task for Pulp 3.0
closes #2399