Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement idempotent run v0 (#769)
## Description: This feature saves the current state of the enclave after each starlark run and tries to optimize the next execution to execute only the instructions that changed compare to previous run. For this V0, the optimisation is "append-only". I.e. the resolution of instructions will succeed only if what changed is at the end of the instruction queue ## Is this change user facing? NO <!-- If yes, please add the "user facing" label to the PR --> <!-- If yes, don't forget to include docs changes where relevant --> ## References (if applicable): <!-- Add relevant Github Issues, Discord threads, or other helpful information. -->
- Loading branch information
Guillaume Bouvignies
committed
Jun 27, 2023
1 parent
0858f56
commit 23b121f
Showing
17 changed files
with
708 additions
and
82 deletions.
There are no files selected for viewing
This file contains 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
43 changes: 43 additions & 0 deletions
43
...pi_container/server/startosis_engine/instructions_plan/resolver/instructions_plan_mask.go
This file contains 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,43 @@ | ||
package resolver | ||
|
||
import "github.com/kurtosis-tech/kurtosis/core/server/api_container/server/startosis_engine/instructions_plan" | ||
|
||
type InstructionsPlanMask struct { | ||
readIdx int | ||
scheduledInstructions []*instructions_plan.ScheduledInstruction | ||
isValid bool | ||
} | ||
|
||
func NewInstructionsPlanMask(size int) *InstructionsPlanMask { | ||
return &InstructionsPlanMask{ | ||
readIdx: 0, | ||
scheduledInstructions: make([]*instructions_plan.ScheduledInstruction, size), | ||
isValid: true, // the mask is considered valid until it's proven to be invalid | ||
} | ||
} | ||
|
||
func (mask *InstructionsPlanMask) InsertAt(idx int, instruction *instructions_plan.ScheduledInstruction) { | ||
mask.scheduledInstructions[idx] = instruction | ||
} | ||
|
||
func (mask *InstructionsPlanMask) HasNext() bool { | ||
return mask.readIdx < len(mask.scheduledInstructions) | ||
} | ||
|
||
func (mask *InstructionsPlanMask) Next() *instructions_plan.ScheduledInstruction { | ||
scheduledInstruction := mask.scheduledInstructions[mask.readIdx] | ||
mask.readIdx += 1 | ||
return scheduledInstruction | ||
} | ||
|
||
func (mask *InstructionsPlanMask) Size() int { | ||
return len(mask.scheduledInstructions) | ||
} | ||
|
||
func (mask *InstructionsPlanMask) MarkAsInvalid() { | ||
mask.isValid = false | ||
} | ||
|
||
func (mask *InstructionsPlanMask) IsValid() bool { | ||
return mask.isValid | ||
} |
This file contains 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 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 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 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 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 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
Oops, something went wrong.