Project

Profile

Help

Task #2399

closed

Convert celery task repo.sync to Pulp 3

Added by ttereshc over 7 years ago. Updated over 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
Yes
Sprint Candidate:
Yes
Tags:
Sprint:
Sprint 19
Quarter:

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

Related to Pulp - Task #2380: Create a redmine task for each 2.y celery task to be converted to 3.0CLOSED - CURRENTRELEASEttereshc

Actions
Related to Pulp - Task #2456: Add working directory management to sync/publish task plumbing.CLOSED - NOTABUG

Actions
Actions #1

Updated by ttereshc over 7 years ago

  • Related to Task #2380: Create a redmine task for each 2.y celery task to be converted to 3.0 added
Actions #2

Updated by ttereshc over 7 years ago

  • Tags Pulp 3 added
Actions #3

Updated by bmbouter over 7 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?

Actions #4

Updated by mhrivnak over 7 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 maybe def 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.

Actions #5

Updated by ttereshc over 7 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 maybe def 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?

Actions #6

Updated by mhrivnak over 7 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.

Actions #7

Updated by mhrivnak over 7 years ago

  • Groomed changed from Yes to No
Actions #8

Updated by mhrivnak over 7 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.

Actions #9

Updated by mhrivnak over 7 years ago

  • Sprint/Milestone set to 30
Actions #10

Updated by bmbouter over 7 years ago

  • Description updated (diff)

Updating the description based on discussion during sprint planning.

Actions #11

Updated by bmbouter over 7 years ago

  • Related to Task #2456: Add working directory management to sync/publish task plumbing. added
Actions #12

Updated by jortel@redhat.com over 7 years ago

  • Description updated (diff)
Actions #13

Updated by bmbouter over 7 years ago

Actions #14

Updated by mhrivnak about 7 years ago

  • Sprint/Milestone changed from 30 to 36
Actions #15

Updated by amacdona@redhat.com about 7 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to amacdona@redhat.com
Actions #16

Updated by bmbouter about 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().

Actions #17

Updated by amacdona@redhat.com about 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.

Actions #18

Updated by bmbouter about 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
Actions #19

Updated by bmbouter about 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

Actions #20

Updated by mhrivnak about 7 years ago

  • Sprint/Milestone changed from 36 to 37
Actions #21

Updated by jortel@redhat.com almost 7 years ago

  • Sprint/Milestone changed from 37 to 38
Actions #22

Updated by amacdona@redhat.com almost 7 years ago

  • Status changed from ASSIGNED to POST

Added by amacdona@redhat.com almost 7 years ago

Revision 8401606b | View on GitHub

Port sync task for Pulp 3.0

closes #2399

Added by amacdona@redhat.com almost 7 years ago

Revision 8401606b | View on GitHub

Port sync task for Pulp 3.0

closes #2399

Actions #23

Updated by amacdona@redhat.com almost 7 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100
Actions #24

Updated by bmbouter about 6 years ago

  • Sprint set to Sprint 19
Actions #25

Updated by bmbouter about 6 years ago

  • Sprint/Milestone deleted (38)
Actions #26

Updated by daviddavis almost 5 years ago

  • Sprint/Milestone set to 3.0.0
Actions #27

Updated by bmbouter almost 5 years ago

  • Tags deleted (Pulp 3)
Actions #28

Updated by bmbouter over 4 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF