Skip to content

Conversation

gaius-qi
Copy link
Member

Description

This pull request introduces changes to enhance the task ID generation mechanism, support additional parameters for preheating tasks, and update dependencies. The most significant updates include introducing a new method for task ID generation based on content, adding new fields to support preheating tasks, and updating test cases and dependencies accordingly.

Task ID Generation Enhancements:

  • Introduced TaskIDV2ByContent to generate task IDs based on specific content, and renamed TaskIDV2 to TaskIDV2ByURLBased for clarity. (pkg/idgen/task_id.go, [[1]](https://github.com/dragonflyoss/dragonfly/pull/3994/files#diff-f4e3be584567d673178c90030a1e6bcbf3ec570f3917883bd8a597109d04ebd9L94-R95), [[2]](https://github.com/dragonflyoss/dragonfly/pull/3994/files#diff-f4e3be584567d673178c90030a1e6bcbf3ec570f3917883bd8a597109d04ebd9R108-R112))
  • Updated all references to TaskIDV2 in the codebase and tests to use the new method names. (scheduler/resource/standard/task_test.go, [scheduler/resource/standard/task_test.goL53-R53](https://github.com/dragonflyoss/dragonfly/pull/3994/files#diff-13e3b39c3374c1ec57fa09fc69e1f99e2ff5a22d2de022a61735d1e38362eb68L53-R53), and similar changes in other test files)

Preheating Task Enhancements:

  • Added a new field ContentForCalculatingTaskID to the PreheatRequest, PreheatArgs, GetTaskArgs, and DeleteTaskArgs structs to support task ID calculation based on content. (internal/job/types.go, [[1]](https://github.com/dragonflyoss/dragonfly/pull/3994/files#diff-4cf243b506c9b48a2f463e4cadc4e9e17bba62d0039fd324029aef5bb728612aR38), manager/types/job.go, [[2]](https://github.com/dragonflyoss/dragonfly/pull/3994/files#diff-d878064c028a450c53f765d31dff1bea45dc8d3346201e65989d98b2fb976d62R152-R157), [[3]](https://github.com/dragonflyoss/dragonfly/pull/3994/files#diff-d878064c028a450c53f765d31dff1bea45dc8d3346201e65989d98b2fb976d62R212-R216), [[4]](https://github.com/dragonflyoss/dragonfly/pull/3994/files#diff-d878064c028a450c53f765d31dff1bea45dc8d3346201e65989d98b2fb976d62R260-R264))
  • Updated the preheat and related methods to handle the new ContentForCalculatingTaskID field. (scheduler/job/job.go, [[1]](https://github.com/dragonflyoss/dragonfly/pull/3994/files#diff-d9c3b15511ab73786700fed2b761b4e8ef1b73b60183deaab4f8aa5a8130cf8cL173-R179), [[2]](https://github.com/dragonflyoss/dragonfly/pull/3994/files#diff-d9c3b15511ab73786700fed2b761b4e8ef1b73b60183deaab4f8aa5a8130cf8cR318), [[3]](https://github.com/dragonflyoss/dragonfly/pull/3994/files#diff-d9c3b15511ab73786700fed2b761b4e8ef1b73b60183deaab4f8aa5a8130cf8cR462), [[4]](https://github.com/dragonflyoss/dragonfly/pull/3994/files#diff-d9c3b15511ab73786700fed2b761b4e8ef1b73b60183deaab4f8aa5a8130cf8cR607))

Dependency Updates:

  • Updated d7y.io/api/v2 from v2.1.36 to v2.1.39 and go.uber.org/mock from v0.5.0 to v0.5.1 in go.mod. ([[1]](https://github.com/dragonflyoss/dragonfly/pull/3994/files#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6L7-R7), [[2]](https://github.com/dragonflyoss/dragonfly/pull/3994/files#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6L88-R88))

Test Updates:

  • Added new test cases for TaskIDV2ByContent and updated existing tests to reflect the changes in task ID generation. (pkg/idgen/task_id_test.go, [[1]](https://github.com/dragonflyoss/dragonfly/pull/3994/files#diff-71a602330f77e6d203f63a49a76e2de0e938d822e68fb1b1bec809fbf85b4c5eL109-R109), [[2]](https://github.com/dragonflyoss/dragonfly/pull/3994/files#diff-71a602330f77e6d203f63a49a76e2de0e938d822e68fb1b1bec809fbf85b4c5eL183-R206))

These changes improve the flexibility and functionality of task ID generation while ensuring backward compatibility and proper testing.

Related Issue

Motivation and Context

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

@gaius-qi gaius-qi added the enhancement New feature or request label Apr 24, 2025
@gaius-qi gaius-qi added this to the v2.3.0 milestone Apr 24, 2025
@gaius-qi gaius-qi self-assigned this Apr 24, 2025
@gaius-qi gaius-qi requested a review from a team as a code owner April 24, 2025 14:53
Copy link

codecov bot commented Apr 24, 2025

Codecov Report

Attention: Patch coverage is 6.25000% with 60 lines in your changes missing coverage. Please review.

Project coverage is 34.40%. Comparing base (2d331fc) to head (85ee518).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
scheduler/job/job.go 0.00% 41 Missing ⚠️
manager/job/preheat.go 7.14% 13 Missing ⚠️
manager/job/task.go 0.00% 4 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3994   +/-   ##
=======================================
  Coverage   34.40%   34.40%           
=======================================
  Files         341      341           
  Lines       40084    40101   +17     
=======================================
+ Hits        13789    13797    +8     
- Misses      25389    25396    +7     
- Partials      906      908    +2     
Flag Coverage Δ
unittests 34.40% <6.25%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
api/manager/docs.go 0.00% <ø> (ø)
pkg/idgen/task_id.go 81.63% <100.00%> (+0.78%) ⬆️
manager/job/task.go 66.99% <0.00%> (-2.71%) ⬇️
manager/job/preheat.go 45.78% <7.14%> (-0.14%) ⬇️
scheduler/job/job.go 0.00% <0.00%> (ø)

... and 3 files with indirect coverage changes

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

Signed-off-by: Gaius <gaius.qi@gmail.com>
Copy link

@Liam-Zhao Liam-Zhao left a comment

Choose a reason for hiding this comment

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

LGTM

@Liam-Zhao Liam-Zhao enabled auto-merge (squash) April 24, 2025 15:31
@Liam-Zhao Liam-Zhao merged commit 2c83f80 into main Apr 24, 2025
27 checks passed
@Liam-Zhao Liam-Zhao deleted the feature/content branch April 24, 2025 15:49
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.

3 participants