-
Notifications
You must be signed in to change notification settings - Fork 0
feat(entities) Adds speculation tree entity and sql schema #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+43
−0
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f117649
feat(entities) Adds speculation tree entity and sql schema
manjari25 91fd64e
gazelle
manjari25 9151ee0
add example for speculations
manjari25 e88964a
remove queue from entity and make speculaitons an explicit type
manjari25 ccd3c35
update state to action
manjari25 2e21de6
address comments
manjari25 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package entity | ||
|
|
||
| // SpeculationPathAction defines the possible actions for a speculation path. | ||
| type SpeculationPathAction string | ||
|
|
||
| const ( | ||
| // SpeculationPathActionUnknown is the default zero value for SpeculationPathAction. | ||
| SpeculationPathActionUnknown SpeculationPathAction = "" | ||
| // TODO: Add comprehensive list of actions | ||
| ) | ||
|
|
||
| // SpeculationInfo represents metadata about a single speculation path, including the path through the dependency graph, its current state, and the predicted build score. | ||
| type SpeculationInfo struct { | ||
| // Path represents the speculation path; which is an ordered list of batches. | ||
| Path []string | ||
| // Action is a state that this path is in. | ||
| Action SpeculationPathAction | ||
| // Score is score for this speculation path. | ||
| Score float32 | ||
| } | ||
|
|
||
| // SpeculationTree represents the set of speculation paths constructed for a batch based on its dependency graph. | ||
| type SpeculationTree struct { | ||
| // BatchID is the batch for which this speculation tree is constructed. | ||
| BatchID string | ||
| // Speculations is a list of speculation paths for this batch based on a graph of its | ||
| // dependents. | ||
|
manjari25 marked this conversation as resolved.
|
||
| // | ||
| // For e.g - Consider batches - queueA/batch/1, queueA/batch/2, queueA/batch/3 | ||
| // such that - queueA/batch/2 and queueA/batch/3 depend on queueA/batch/1 | ||
| // | ||
| // Speculations for queueA/batch/1 - [{Path: []string{"queueA/batch/1"}, State: "scheduled", Score: 0.1}] | ||
| // Speculations for queueA/batch/2 - [{Path: []string{"queueA/batch/2"}, State: "scheduled", Score: 0.9}, {Path: []string{"queueA/batch/1", "queueA/batch/2"}, State: "scheduled", Score: 0.3}] | ||
| // Speculations for queueA/batch/3 - [{Path: []string{"queueA/batch/3"}, State: "scheduled", Score: 0.9}, {Path: []string{"queueA/batch/1", "queueA/batch/3"}, State: "scheduled", Score: 0.3}] | ||
| // | ||
| Speculations []SpeculationInfo | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| CREATE TABLE IF NOT EXISTS speculation_tree ( | ||
| batch_id VARCHAR(255) NOT NULL, | ||
| speculations JSON NOT NULL, | ||
| PRIMARY KEY (batch_id) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
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.
Uh oh!
There was an error while loading. Please reload this page.