pulpcore.plugin.tasking¶
All models documented here should be imported directly from the pulpcore.plugin.tasking
namespace.
- pulpcore.plugin.tasking.add_and_remove(repository_pk, add_content_units, remove_content_units, base_version_pk=None)¶
Create a new repository version by adding and then removing content units.
- Parameters
repository_pk (int) – The primary key for a Repository for which a new Repository Version should be created.
add_content_units (list) – List of PKs for
Content
that should be added to the previous Repository Version for this Repository.remove_content_units (list) – List of PKs for:class:~pulpcore.app.models.Content that should be removed from the previous Repository Version for this Repository.
base_version_pk (int) – the primary key for a RepositoryVersion whose content will be used as the initial set of content for our new RepositoryVersion
- pulpcore.plugin.tasking.dispatch(func, resources, args=None, kwargs=None, task_group=None)¶
Enqueue a message to Pulp workers with a reservation.
This method provides normal enqueue functionality, while also requesting necessary locks for serialized urls. No two tasks that claim the same resource can execute concurrently. It accepts resources which it transforms into a list of urls (one for each resource).
This method creates a
pulpcore.app.models.Task
object and returns it.The values in args and kwargs must be JSON serializable, but may contain instances of
uuid.UUID
.- Parameters
func (callable) – The function to be run by RQ when the necessary locks are acquired.
resources (list) – A list of resources to this task needs exclusive access to while running. Each resource can be either a str or a django.models.Model instance.
args (tuple) – The positional arguments to pass on to the task.
kwargs (dict) – The keyword arguments to pass on to the task.
task_group (pulpcore.app.models.TaskGroup) – A TaskGroup to add the created Task to.
Returns (pulpcore.app.models.Task): The Pulp Task that was created.
- Raises
ValueError – When resources is an unsupported type.
- pulpcore.plugin.tasking.fs_publication_export(exporter_pk, publication_pk)¶
Export a publication to the file system.
- Parameters
exporter_pk (str) – FilesystemExporter pk
publication_pk (str) – Publication pk
- pulpcore.plugin.tasking.fs_repo_version_export(exporter_pk, repo_version_pk)¶
Export a repository version to the file system.
- Parameters
exporter_pk (str) – FilesystemExporter pk
repo_version_pk (str) – RepositoryVersion pk