feat: add content for calculating task id when preheat file and handle task #3994
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
TaskIDV2ByContent
to generate task IDs based on specific content, and renamedTaskIDV2
toTaskIDV2ByURLBased
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)
)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:
ContentForCalculatingTaskID
to thePreheatRequest
,PreheatArgs
,GetTaskArgs
, andDeleteTaskArgs
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)
)preheat
and related methods to handle the newContentForCalculatingTaskID
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:
d7y.io/api/v2
fromv2.1.36
tov2.1.39
andgo.uber.org/mock
fromv0.5.0
tov0.5.1
ingo.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:
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
Checklist