Skip to content

feat(dfctl): add task preheat command for image and file preheat#1781

Merged
gaius-qi merged 5 commits intomainfrom
copilot/add-preheat-functionality
Apr 13, 2026
Merged

feat(dfctl): add task preheat command for image and file preheat#1781
gaius-qi merged 5 commits intomainfrom
copilot/add-preheat-functionality

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 13, 2026

Adds dfctl task preheat to trigger preheat of OCI images (oci:// prefix) or files (http:///https:// prefix) through the Dragonfly scheduler.

Two modes

  • gRPC (default): Directly calls scheduler's PreheatImage/PreheatFile RPCs.
  • SDK (--request-sdk): Preheats via the Dragonfly SDK proxy — uses Proxy.preheat() for images and Proxy.get() for files from dragonfly-client-util::request.

Changes

  • dragonfly-client/src/grpc/scheduler.rs — Added preheat_image and preheat_file methods to SchedulerClient, wrapping the proto RPCs from dragonfly-api.
  • dragonfly-client/src/bin/dfctl/task.rs — Added Preheat variant to TaskSubCommand with URL-scheme-based dispatch and full CLI arg set (--scheduler, --request-sdk, --platform, --username, --password, --piece-length, --tag, --application, --timeout).
  • dragonfly-client/Cargo.toml — Added oci-client workspace dep for OCI reference parsing (manifest URL construction in gRPC mode).

Usage

# Image preheat via scheduler gRPC
dfctl task preheat oci://docker.io/library/nginx:latest -s http://scheduler:8002

# File preheat via scheduler gRPC
dfctl task preheat https://example.com/file.tar.gz -s http://scheduler:8002

# Image preheat via SDK proxy
dfctl task preheat oci://docker.io/library/nginx:latest --request-sdk -s http://scheduler:8002

# With registry auth and platform selection
dfctl task preheat oci://registry.example.com/app:v1 --username user --password pass --platform linux/amd64

Copilot AI and others added 2 commits April 13, 2026 03:54
Add `dfctl task preheat` subcommand with two modes:
- gRPC mode (default): directly calls scheduler's PreheatImage/PreheatFile RPCs
- SDK mode (--request-sdk): uses Dragonfly SDK proxy for preheat

Supports:
- Image preheat via oci:// URL prefix
- File preheat via http:// or https:// URL prefix
- Optional scheduler address (--scheduler)
- Optional parameters: platform, username, password, piece-length, tag, etc.

Also adds preheat_image and preheat_file methods to SchedulerClient.

Agent-Logs-Url: https://github.com/dragonflyoss/client/sessions/c4a70baf-75e8-4d6b-bee5-6bad61c2c6f2

Co-authored-by: gaius-qi <15955374+gaius-qi@users.noreply.github.com>
@gaius-qi gaius-qi added the enhancement New feature or request label Apr 13, 2026
@gaius-qi gaius-qi added this to the v2.5.0 milestone Apr 13, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 0.77778% with 893 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.11%. Comparing base (bea655e) to head (9b31dc5).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
dragonfly-client/src/bin/dfctl/task.rs 0.00% 635 Missing ⚠️
...nfly-client/src/bin/dfctl/persistent_cache_task.rs 0.00% 125 Missing ⚠️
dragonfly-client/src/bin/dfctl/persistent_task.rs 0.00% 125 Missing ⚠️
dragonfly-client-util/src/request/mod.rs 0.00% 6 Missing ⚠️
dragonfly-client/src/bin/dfget/main.rs 77.77% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1781      +/-   ##
==========================================
- Coverage   44.43%   43.11%   -1.33%     
==========================================
  Files          91       91              
  Lines       26054    26839     +785     
==========================================
- Hits        11578    11571       -7     
- Misses      14476    15268     +792     
Files with missing lines Coverage Δ
dragonfly-client-backend/src/lib.rs 96.30% <ø> (ø)
dragonfly-client/src/bin/dfget/main.rs 49.33% <77.77%> (ø)
dragonfly-client-util/src/request/mod.rs 32.82% <0.00%> (ø)
...nfly-client/src/bin/dfctl/persistent_cache_task.rs 0.00% <0.00%> (ø)
dragonfly-client/src/bin/dfctl/persistent_task.rs 0.00% <0.00%> (ø)
dragonfly-client/src/bin/dfctl/task.rs 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gaius-qi gaius-qi marked this pull request as ready for review April 13, 2026 10:15
@gaius-qi gaius-qi requested review from a team as code owners April 13, 2026 10:15
@github-actions github-actions Bot requested review from fcgxz2003 and jim3ma April 13, 2026 10:15
@gaius-qi gaius-qi requested a review from Copilot April 13, 2026 10:16
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new dfctl task preheat subcommand to trigger scheduler-side preheating for OCI images (oci://…) and file/object URLs, with both direct scheduler gRPC mode and an optional Request SDK (--request-sdk) mode.

Changes:

  • Added dfctl task preheat with URL-scheme dispatch and extensive CLI flags for scheduler endpoint, auth, platform, piece length, scope, and timeouts.
  • Improved dfctl-family CLI error rendering by attempting to decode structured backend error details from gRPC status details.
  • Updated dragonfly-client-util::request API to make request/response headers non-optional, and added a tiny OCI scheme constant in the backend crate.

Reviewed changes

Copilot reviewed 4 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
dragonfly-client/src/bin/dfctl/task.rs Adds task preheat command implementation and extends error formatting for task list/remove/preheat paths.
dragonfly-client/src/bin/dfctl/persistent_task.rs Extends persistent task listing error formatting (backend error details + headers).
dragonfly-client/src/bin/dfctl/persistent_cache_task.rs Extends persistent cache task listing error formatting (backend error details + headers).
dragonfly-client/Cargo.toml Adds oci-client dependency for OCI reference parsing in dfctl preheat.
dragonfly-client-util/src/request/mod.rs Makes GetRequest.header and GetResponse.header non-optional and updates internal handling accordingly.
dragonfly-client-backend/src/oci.rs Introduces oci URL scheme constant.
dragonfly-client-backend/src/lib.rs Exposes the new oci module.
Cargo.lock Locks the new oci-client dependency.

Comment thread dragonfly-client-util/src/request/mod.rs
Comment thread dragonfly-client-util/src/request/mod.rs
Comment thread dragonfly-client-backend/src/oci.rs
Signed-off-by: Gaius <gaius.qi@gmail.com>
@gaius-qi gaius-qi enabled auto-merge (squash) April 13, 2026 10:39
Comment thread dragonfly-client/src/bin/dfctl/persistent_cache_task.rs
Copy link
Copy Markdown

@BraveY BraveY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@gaius-qi gaius-qi merged commit a1368de into main Apr 13, 2026
7 checks passed
@gaius-qi gaius-qi deleted the copilot/add-preheat-functionality branch April 13, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants