Skip to content

Commit

Permalink
Add an option to upload chunks in parallel
Browse files Browse the repository at this point in the history
[noissue]
  • Loading branch information
lubosmj committed Jul 11, 2024
1 parent 566d658 commit 0c4f3ae
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pulp-glue-ostree/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
"Typing :: Typed",
]
dependencies = [
"pulp-glue>=0.23.1,<0.26",
"pulp-glue>=0.23.1,<0.28",
]

[project.urls]
Expand Down
20 changes: 17 additions & 3 deletions pulpcore/cli/ostree/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
PulpRepositoryContext,
)
from pulp_glue.common.i18n import get_translation
from pulp_glue.core.context import PulpArtifactContext
from pulp_glue.core.context import PulpArtifactContext, PulpUploadContext
from pulp_glue.ostree.context import (
PulpOstreeCommitContentContext,
PulpOstreeConfigContentContext,
Expand Down Expand Up @@ -197,6 +197,12 @@ def sync(
required=True,
help=_("Name of a repository which contains the imported commits"),
)
@click.option(
"--parallel",
is_flag=True,
default=False,
help=_("Run the uploading in parallel"),
)
@pass_repository_context
@pass_pulp_context
def import_all(
Expand All @@ -205,11 +211,12 @@ def import_all(
file: IO[bytes],
chunk_size: int,
repository_name: str,
parallel: bool,
) -> None:
assert isinstance(repository_ctx, PulpOstreeRepositoryContext)

repository_href = repository_ctx.pulp_href
artifact_href = PulpArtifactContext(pulp_ctx).upload(file, chunk_size)
artifact_href = PulpArtifactContext(pulp_ctx).upload(file, chunk_size, parallel=parallel)
kwargs = {
"href": repository_href,
"artifact": artifact_href,
Expand All @@ -235,6 +242,12 @@ def import_all(
required=False,
help=_("Name of a parent commit"),
)
@click.option(
"--parallel",
is_flag=True,
default=False,
help=_("Run the uploading in parallel"),
)
@pass_repository_context
@pass_pulp_context
def import_commits(
Expand All @@ -243,13 +256,14 @@ def import_commits(
file: IO[bytes],
chunk_size: int,
repository_name: str,
parallel: bool,
ref: Optional[str],
parent_commit: Optional[str],
) -> None:
assert isinstance(repository_ctx, PulpOstreeRepositoryContext)

repository_href = repository_ctx.pulp_href
artifact_href = PulpArtifactContext(pulp_ctx).upload(file, chunk_size)
artifact_href = PulpArtifactContext(pulp_ctx).upload(file, chunk_size, parallel=parallel)

kwargs = {
"href": repository_href,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers=[
"Typing :: Typed",
]
dependencies = [
"pulp-cli>=0.23.1,<0.26",
"pulp-cli>=0.23.1,<0.28",
"pulp-glue-ostree==0.5.0.dev",
]

Expand Down

0 comments on commit 0c4f3ae

Please sign in to comment.