-
Notifications
You must be signed in to change notification settings - Fork 46
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
Acs refresh #536
Acs refresh #536
Conversation
457a67d
to
bd09a22
Compare
ea09754
to
9554571
Compare
9554571
to
471614a
Compare
pulp_file/app/tasks/acs.py
Outdated
acs_path.repository = repo | ||
acs_path.save() | ||
acs_url = os.path.join(acs.remote.url, acs_path.path) | ||
synchronize(acs.remote.pk, repo.pk, False, acs_url) |
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.
Instead of calling synchronize
directly here dispatch this task instead: https://github.com/pulp/pulp_file/blob/main/pulp_file/app/tasks/synchronizing.py#L27 You can do that similarly to how the sync viewset does: https://github.com/pulp/pulp_file/blob/main/pulp_file/app/viewsets.py#L98-L107
The main difference is that you want all of your tasks to be a task group. You should create a TaskGroup
and then set it on each task dispatched https://github.com/pulp/pulpcore/blob/24be668caed280eeda7413a563cdd612d423441c/pulpcore/tasking/tasks.py#L45
Here's an example of TaskGroup being created https://github.com/pulp/pulpcore/blob/de67d41c39d9d4bde2e8f86e4bf3f51d6cc774e7/pulpcore/app/tasks/importer.py#L376 Also list it as a CreatedResource https://github.com/pulp/pulpcore/blob/de67d41c39d9d4bde2e8f86e4bf3f51d6cc774e7/pulpcore/app/tasks/importer.py#L379 Then set the TaskGroup on the tasks dispatched.
I'd recommend not doing any GroupProgressReport
for now, and instead we can add that in after all ^ is done.
Post any questions you have please. Thanks!
|
||
.. code-block:: bash | ||
|
||
http POST localhost:24817/pulp/api/v3/remotes/file/file/ name="remoteForACS" policy="on_demand" url="http://fixtures.pulpproject.org/" |
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 we should use pulp CLI commands instead.
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.
The CLI commands haven’t been merged yet so they’re subject to changing. I’d be happy to update this in a follow up PR.
|
||
""" | ||
super().__init__() | ||
self.remote = remote | ||
self.url = url if url else remote.url |
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.
👍
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 moving this to __init__
would make it more explicit (because it happens earlier)
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.
Which __init__
do you mean? I believe this is first place where it is needed to be checked.
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 comment didn't make sense. I was meant to ask if it made sense to move this to synchronize()
because then the value of url
would be more concrete earlier in the call stack. Just a thought. Do what you think makes sense.
9674b61
to
61be30c
Compare
61be30c
to
e6cc190
Compare
Attached issue: https://pulp.plan.io/issues/9377 |
pulp_file/app/tasks/acs.py
Outdated
acs_path.save() | ||
acs_url = os.path.join(acs.remote.url, acs_path.path) | ||
# Dispatch each ACS path to own task and assign it to common TaskGroup | ||
task_group = TaskGroup.objects.create(description=f"Refresh of {acs_path.path}") |
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.
We won't be able to move the TaskGroup creation to the viewset until we implement this in pulpcore. Let's continue to keep the TaskGroup
creation in this task for now until we can do that and then we'll refactor it. I plan to discuss this change at the pulpcore meeting next Tuesday.
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 made this https://github.com/pulp/pulpcore/pull/1618/files
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.
@pavelpicka this is now available for use in pulpcore pulp/pulpcore#1618
So I think move the TaskGroup creation to the viewset and return it to the user using the new Response type in pulpcore. Then have all tasks (including this one and its subtasks) be members of the task_group.
Hello @pavelpicka! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-09-15 12:29:01 UTC |
691050b
to
d458e12
Compare
d458e12
to
29732dc
Compare
29732dc
to
3a86a9a
Compare
4db4530
to
6ae5f5a
Compare
38af16e
to
79a4ba6
Compare
The code changes look good to me 👍 |
pulp_file/app/viewsets.py
Outdated
if created: | ||
acs_path.repository = repo | ||
acs_path.save() | ||
acs_url = os.path.join(acs.remote.url, acs_path.path) |
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 should probably check if path is blank or not. I'm imagining that if you don't set paths for the ACS, it'll just use the remote url (e.g. http://fixtures.pulpproject.org/PULP_MANIFEST
) but what it does instead is it appends a slash (http://fixtures.pulpproject.org/PULP_MANIFEST/
).
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.
sounds like good idea to add tests for no-path ACS and ACS with more paths.
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 idea, will do 👍
8b2c7d3
to
84e22ee
Compare
Added `refresh` endpoint to support ACS. closes: #9377 https://pulp.plan.io/issues/9377
84e22ee
to
d06a0d0
Compare
Added
refresh
endpoint to support ACS.closes: #9377
https://pulp.plan.io/issues/9377
Required PR: pulp/pulpcore#1496