Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ volumes:
- name: data
durableDir: {}
snapshotConfig:
onPause: SNAPSHOT_CONTENT_SCOPE_FULL
onCommit: SNAPSHOT_CONTENT_SCOPE_DATA
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/glutton-durdir-data/
sandboxConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ volumes:
- name: data
durableDir: {}
snapshotConfig:
onPause: SNAPSHOT_CONTENT_SCOPE_FULL
onCommit: SNAPSHOT_CONTENT_SCOPE_FULL
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/glutton-durdir-full/
sandboxConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ resources:
- name: memory
quantity: ${ACTOR_MEMORY}
snapshotConfig:
onPause: SNAPSHOT_CONTENT_SCOPE_FULL
onCommit: SNAPSHOT_CONTENT_SCOPE_FULL
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/glutton/
sandboxConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ containers:
image: containerstack/alpine-stress:latest
command: ["sh", "-c", "find /; for i in $(seq 50000); do sleep 10000 & done; sleep 10000"]
snapshotConfig:
onPause: SNAPSHOT_CONTENT_SCOPE_FULL
onCommit: SNAPSHOT_CONTENT_SCOPE_FULL
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/kernelmem/
sandboxConfig:
Expand Down
1 change: 0 additions & 1 deletion benchmarking/workloads/manifests/sleep-template.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ resources:
- name: memory
quantity: ${ACTOR_MEMORY}
snapshotConfig:
onPause: SNAPSHOT_CONTENT_SCOPE_FULL
onCommit: SNAPSHOT_CONTENT_SCOPE_FULL
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/sleep/
sandboxConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,5 @@ sandboxConfig:
sandboxClass: ${SANDBOX_CLASS_ENUM}
configName: ${SANDBOX_CONFIG_NAME}
snapshotConfig:
onPause: SNAPSHOT_CONTENT_SCOPE_FULL
onCommit: SNAPSHOT_CONTENT_SCOPE_FULL
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/swebench-astropy-7336/
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ containers:
image: containerstack/alpine-stress:latest
command: ["stress", "--vm", "1", "--vm-bytes", "1G", "--vm-keep", "--vm-hang", "0"]
snapshotConfig:
onPause: SNAPSHOT_CONTENT_SCOPE_FULL
onCommit: SNAPSHOT_CONTENT_SCOPE_FULL
storageLocation: gs://${BUCKET_NAME}/benchmark-workloads/usermem/
sandboxConfig:
Expand Down
9 changes: 0 additions & 9 deletions cmd/ateapi/internal/apivalidation/actor_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,6 @@ func ValidateCustom_SnapshotConfig_StorageLocation(_ context.Context, _ operatio
return nil
}

// ValidateCustom_SnapshotConfig requires on_commit to be a subset of on_pause.
func ValidateCustom_SnapshotConfig(_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *ateapipb.SnapshotConfig) field.ErrorList {
if value.GetOnPause() == ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_DATA &&
value.GetOnCommit() != ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_DATA {
return field.ErrorList{field.Invalid(fldPath.Child("on_commit"), value.GetOnCommit().String(), "must be a subset of on_pause")}
}
return nil
}

// envVarNameRE constrains env var names to any printable ASCII character
// except '='.
var envVarNameRE = regexp.MustCompile(`^[ -<>-~]+$`)
Expand Down
28 changes: 7 additions & 21 deletions cmd/ateapi/internal/apivalidation/actor_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func TestValidateCreateActorTemplateRequest(t *testing.T) {
}, {
"valid data-scoped snapshots",
&ateapipb.CreateActorTemplateRequest{ActorTemplate: validActorTemplate(func(tmpl *ateapipb.ActorTemplate) {
tmpl.SnapshotConfig.OnPause = ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_DATA
tmpl.SnapshotConfig.OnCommit = ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_DATA
})},
nil,
Expand Down Expand Up @@ -137,24 +136,14 @@ func TestValidateCreateActorTemplateRequest(t *testing.T) {
})},
field.ErrorList{field.Invalid(field.NewPath("actor_template", "snapshot_config", "storage_location"), "gs://my-bucket/snapshots?versions=true", "")},
}, {
"on_commit broader than on_pause",
// on_commit has no default of its own at this layer, so leaving it
// unset is a required violation.
"on_commit unset",
&ateapipb.CreateActorTemplateRequest{ActorTemplate: validActorTemplate(func(tmpl *ateapipb.ActorTemplate) {
tmpl.SnapshotConfig.OnPause = ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_DATA
tmpl.SnapshotConfig.OnCommit = ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_FULL
})},
field.ErrorList{field.Invalid(field.NewPath("actor_template", "snapshot_config", "on_commit"), "SNAPSHOT_CONTENT_SCOPE_FULL", "")},
}, {
// Leaving on_commit unset over a DATA on_pause is both a required
// violation (on_commit has no default of its own) and a subset
// violation (UNSPECIFIED is not DATA).
"on_commit unset with data on_pause",
&ateapipb.CreateActorTemplateRequest{ActorTemplate: validActorTemplate(func(tmpl *ateapipb.ActorTemplate) {
tmpl.SnapshotConfig.OnPause = ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_DATA
tmpl.SnapshotConfig.OnCommit = ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_UNSPECIFIED
})},
field.ErrorList{
field.Required(field.NewPath("actor_template", "snapshot_config", "on_commit"), ""),
field.Invalid(field.NewPath("actor_template", "snapshot_config", "on_commit"), "SNAPSHOT_CONTENT_SCOPE_UNSPECIFIED", ""),
},
}, {
"missing sandbox_config",
Expand Down Expand Up @@ -346,13 +335,11 @@ func TestValidateActorTemplate(t *testing.T) {
mutate: func(tmpl *ateapipb.ActorTemplate) { tmpl.SnapshotConfig.StorageLocation = "" },
want: field.ErrorList{field.Required(field.NewPath("snapshot_config", "storage_location"), "")},
}, {
name: "unspecified snapshot scopes",
name: "unspecified snapshot scope",
mutate: func(tmpl *ateapipb.ActorTemplate) {
tmpl.SnapshotConfig.OnPause = ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_UNSPECIFIED
tmpl.SnapshotConfig.OnCommit = ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_UNSPECIFIED
},
want: field.ErrorList{
field.Required(field.NewPath("snapshot_config", "on_pause"), ""),
field.Required(field.NewPath("snapshot_config", "on_commit"), ""),
},
}, {
Expand All @@ -362,11 +349,11 @@ func TestValidateActorTemplate(t *testing.T) {
},
want: field.ErrorList{field.Invalid(field.NewPath("snapshot_config", "on_commit"), nil, "").WithOrigin("maximum")},
}, {
name: "negative on_pause",
name: "negative on_commit",
mutate: func(tmpl *ateapipb.ActorTemplate) {
tmpl.SnapshotConfig.OnPause = ateapipb.SnapshotContentScope(-1)
tmpl.SnapshotConfig.OnCommit = ateapipb.SnapshotContentScope(-1)
},
want: field.ErrorList{field.Invalid(field.NewPath("snapshot_config", "on_pause"), nil, "").WithOrigin("minimum")},
want: field.ErrorList{field.Invalid(field.NewPath("snapshot_config", "on_commit"), nil, "").WithOrigin("minimum")},
}, {
name: "no containers",
mutate: func(tmpl *ateapipb.ActorTemplate) { tmpl.Containers = nil },
Expand Down Expand Up @@ -996,7 +983,6 @@ func validActorTemplate(mutations ...func(*ateapipb.ActorTemplate)) *ateapipb.Ac
Containers: []*ateapipb.Container{{Name: "main", Image: "example.com/app:v1@sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}},
SnapshotConfig: &ateapipb.SnapshotConfig{
StorageLocation: "gs://my-bucket/snapshots",
OnPause: ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_FULL,
OnCommit: ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_FULL,
},
SandboxConfig: &ateapipb.SandboxConfig{SandboxClass: ateapipb.SandboxClass_SANDBOX_CLASS_GVISOR, ConfigName: "gvisor-default"},
Expand Down
40 changes: 0 additions & 40 deletions cmd/ateapi/internal/apivalidation/zz_generated.validation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion cmd/ateapi/internal/controlapi/actor_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func validActorTemplate(mutations ...func(*ateapipb.ActorTemplate)) *ateapipb.Ac
Containers: []*ateapipb.Container{{Name: "main", Image: "example.com/app:v1@sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}},
SnapshotConfig: &ateapipb.SnapshotConfig{
StorageLocation: "gs://my-bucket/snapshots",
OnPause: ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_FULL,
OnCommit: ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_FULL,
},
SandboxConfig: &ateapipb.SandboxConfig{SandboxClass: ateapipb.SandboxClass_SANDBOX_CLASS_GVISOR, ConfigName: "gvisor-default"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ func TestActorTemplateCRUD(t *testing.T) {
Containers: []*ateapipb.Container{{Name: "main", Image: "example.com/app:v1@sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}},
SnapshotConfig: &ateapipb.SnapshotConfig{
StorageLocation: "gs://my-bucket/snapshots",
OnPause: ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_FULL,
OnCommit: ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_FULL,
},
SandboxConfig: &ateapipb.SandboxConfig{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2959,7 +2959,6 @@ func createDataCommitTemplate(t *testing.T, tc *testContext, ns string) *ateapip
},
SnapshotConfig: &ateapipb.SnapshotConfig{
StorageLocation: testStorageLocation,
OnPause: ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_FULL,
OnCommit: ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_DATA,
},
SandboxConfig: &ateapipb.SandboxConfig{
Expand Down
4 changes: 2 additions & 2 deletions cmd/ateapi/internal/controlapi/workflow_pause.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (w *ActorWorkflow) ensureAteletPaused(ctx context.Context, actorRef resourc
SnapshotName: actor.GetStatus().GetInProgressLocalSnapshotName(),
},
},
Scope: actorSnapshotContentScopeToAtelet(actorTemplate.GetSnapshotConfig().GetOnPause()),
Scope: actorSnapshotContentScopeToAtelet(actorTemplate.GetSnapshotConfig().GetOnCommit()),
ActorUid: actor.GetMetadata().Uid,
}
wireSnapshotScope = ateattr.SnapshotScopeValue(req.Scope)
Expand Down Expand Up @@ -257,7 +257,7 @@ func (w *ActorWorkflow) ensurePausedFinalized(ctx context.Context, actorRef reso
newState = ateapipb.ActorState_ACTOR_STATE_CRASHED
crashStatus = newActorCrash(ateattr.OperationPause, crashMessageLocalSnapshotNodeUnknown)
}
contentScope := actorTemplate.GetSnapshotConfig().GetOnPause()
contentScope := actorTemplate.GetSnapshotConfig().GetOnCommit()
sandboxClass := ""
if worker != nil {
sandboxClass = worker.GetSandboxClass()
Expand Down
15 changes: 7 additions & 8 deletions cmd/ateapi/internal/controlapi/workflow_pause_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,14 @@ func TestEnsurePausedFinalized_AlreadyCrashed(t *testing.T) {
}

// TestEnsurePausedFinalized_RecordsContentScope verifies pause finalization
// records the scope the pause checkpoint captured (the template's onPause) in
// LocalSnapshot, so a later suspend of the PAUSED actor knows what the
// local snapshot contains even if the template's onPause changes while the
// actor sits PAUSED.
// records the scope the pause checkpoint captured (the template's onCommit)
// in LocalSnapshot, so a later suspend or resume of the PAUSED actor knows
// what the local snapshot contains.
func TestEnsurePausedFinalized_RecordsContentScope(t *testing.T) {
tests := []struct {
name string
onPause ateapipb.SnapshotContentScope
want ateapipb.SnapshotContentScope
name string
onCommit ateapipb.SnapshotContentScope
want ateapipb.SnapshotContentScope
}{
{"data", ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_DATA, ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_DATA},
{"full", ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_FULL, ateapipb.SnapshotContentScope_SNAPSHOT_CONTENT_SCOPE_FULL},
Expand Down Expand Up @@ -199,7 +198,7 @@ func TestEnsurePausedFinalized_RecordsContentScope(t *testing.T) {

w := &ActorWorkflow{store: st}
tmpl := &ateapipb.ActorTemplate{
SnapshotConfig: &ateapipb.SnapshotConfig{OnPause: tc.onPause},
SnapshotConfig: &ateapipb.SnapshotConfig{OnCommit: tc.onCommit},
}
got, err := w.ensurePausedFinalized(ctx, actorRef, tmpl)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/ateapi/internal/controlapi/workflow_resume.go
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ func (w *ActorWorkflow) ensureAteletRestored(ctx context.Context, actorRef resou
req.Config = &ateletpb.RestoreRequest_LocalConfig{
LocalConfig: &ateletpb.LocalCheckpointConfiguration{SnapshotName: local.GetSnapshotName()},
}
req.Scope = actorSnapshotContentScopeToAtelet(actorTemplate.GetSnapshotConfig().GetOnPause())
req.Scope = actorSnapshotContentScopeToAtelet(local.GetContentScope())
tele.WireSnapshotScope = ateattr.SnapshotScopeValue(req.Scope)

if _, err = client.Restore(ctx, req); err != nil {
Expand Down
29 changes: 10 additions & 19 deletions cmd/ateapi/internal/controlapi/workflow_resume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1199,8 +1199,6 @@ func TestResumeActor_AteletWireRequest(t *testing.T) {
}
// templateSeed is the ActorTemplate configuration a row persists.
type templateSeed struct {
// onPause is the template's pause scope.
onPause ateapipb.SnapshotContentScope
// golden seeds the template's golden tag snapshot.
golden *ateapipb.ExternalSnapshot
// configName is the SandboxConfig the template names; "" means the
Expand Down Expand Up @@ -1336,9 +1334,8 @@ func TestResumeActor_AteletWireRequest(t *testing.T) {
{
name: "13 Full pause snapshot restores locally as Full",
actor: actorSeed{
localSnapshot: &ateapipb.LocalSnapshot{SnapshotName: localSnapshotName},
localSnapshot: &ateapipb.LocalSnapshot{SnapshotName: localSnapshotName, ContentScope: fullScope},
},
tmpl: templateSeed{onPause: fullScope},
want: restoreWant{
checkpointType: ateletpb.CheckpointType_CHECKPOINT_TYPE_LOCAL,
snapshotName: localSnapshotName,
Expand All @@ -1351,10 +1348,9 @@ func TestResumeActor_AteletWireRequest(t *testing.T) {
// resume-source resolution is being reworked.
name: "14 local snapshot built on the current template stays Full",
actor: actorSeed{
localSnapshot: &ateapipb.LocalSnapshot{SnapshotName: localSnapshotName},
localSnapshot: &ateapipb.LocalSnapshot{SnapshotName: localSnapshotName, ContentScope: fullScope},
tmplUID: "current",
},
tmpl: templateSeed{onPause: fullScope},
want: restoreWant{
checkpointType: ateletpb.CheckpointType_CHECKPOINT_TYPE_LOCAL,
snapshotName: localSnapshotName,
Expand All @@ -1364,9 +1360,8 @@ func TestResumeActor_AteletWireRequest(t *testing.T) {
{
name: "15 Data pause snapshot restores locally as Data",
actor: actorSeed{
localSnapshot: &ateapipb.LocalSnapshot{SnapshotName: localSnapshotName},
localSnapshot: &ateapipb.LocalSnapshot{SnapshotName: localSnapshotName, ContentScope: dataScope},
},
tmpl: templateSeed{onPause: dataScope},
want: restoreWant{
checkpointType: ateletpb.CheckpointType_CHECKPOINT_TYPE_LOCAL,
snapshotName: localSnapshotName,
Expand All @@ -1376,11 +1371,10 @@ func TestResumeActor_AteletWireRequest(t *testing.T) {
{
name: "16 Data pause snapshot ignores the template's golden",
actor: actorSeed{
localSnapshot: &ateapipb.LocalSnapshot{SnapshotName: localSnapshotName},
localSnapshot: &ateapipb.LocalSnapshot{SnapshotName: localSnapshotName, ContentScope: dataScope},
},
tmpl: templateSeed{
onPause: dataScope,
golden: &ateapipb.ExternalSnapshot{SnapshotUri: goldenURI, ContentScope: fullScope},
golden: &ateapipb.ExternalSnapshot{SnapshotUri: goldenURI, ContentScope: fullScope},
},
want: restoreWant{
checkpointType: ateletpb.CheckpointType_CHECKPOINT_TYPE_LOCAL,
Expand All @@ -1389,14 +1383,13 @@ func TestResumeActor_AteletWireRequest(t *testing.T) {
},
},
{
// The local snapshot takes precedence at restore, and its scope
// comes from the pause scope, not the durable snapshot's.
// The local snapshot takes precedence at restore, and its recorded
// scope wins over the durable snapshot's.
name: "17 local snapshot wins over a Full durable snapshot",
actor: actorSeed{
localSnapshot: &ateapipb.LocalSnapshot{SnapshotName: localSnapshotName},
localSnapshot: &ateapipb.LocalSnapshot{SnapshotName: localSnapshotName, ContentScope: dataScope},
externalSnapshot: &ateapipb.ExternalSnapshot{SnapshotUri: actorURI, ContentScope: fullScope},
},
tmpl: templateSeed{onPause: dataScope},
want: restoreWant{
checkpointType: ateletpb.CheckpointType_CHECKPOINT_TYPE_LOCAL,
snapshotName: localSnapshotName,
Expand All @@ -1410,11 +1403,10 @@ func TestResumeActor_AteletWireRequest(t *testing.T) {
// template.
name: "18 local snapshot ignores an older external snapshot's template mismatch",
actor: actorSeed{
localSnapshot: &ateapipb.LocalSnapshot{SnapshotName: localSnapshotName},
localSnapshot: &ateapipb.LocalSnapshot{SnapshotName: localSnapshotName, ContentScope: fullScope},
externalSnapshot: &ateapipb.ExternalSnapshot{SnapshotUri: actorURI, ContentScope: fullScope},
tmplUID: "mismatch",
},
tmpl: templateSeed{onPause: fullScope},
want: restoreWant{
checkpointType: ateletpb.CheckpointType_CHECKPOINT_TYPE_LOCAL,
snapshotName: localSnapshotName,
Expand All @@ -1432,7 +1424,7 @@ func TestResumeActor_AteletWireRequest(t *testing.T) {
{
name: "20 local snapshot restore with a missing SandboxConfig is rejected",
actor: actorSeed{localSnapshot: &ateapipb.LocalSnapshot{SnapshotName: localSnapshotName}},
tmpl: templateSeed{onPause: fullScope, configName: "missing"},
tmpl: templateSeed{configName: "missing"},
want: restoreWant{code: codes.FailedPrecondition},
},
}
Expand Down Expand Up @@ -1460,7 +1452,6 @@ func TestResumeActor_AteletWireRequest(t *testing.T) {
Metadata: &ateapipb.ResourceMetadata{Atespace: "ns", Name: "tmpl1"},
SnapshotConfig: &ateapipb.SnapshotConfig{
StorageLocation: testStorageLocation,
OnPause: tt.tmpl.onPause,
},
SandboxConfig: &ateapipb.SandboxConfig{
SandboxClass: ateapipb.SandboxClass_SANDBOX_CLASS_GVISOR,
Expand Down
Loading
Loading