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
138 changes: 97 additions & 41 deletions common/protos/common.pb.go

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

9 changes: 9 additions & 0 deletions common/protos/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ message User {
string name = 3;
}

// Production and staging BKP recognizes these special user IDs.
// They are used to associate certain actions (e.g. EOR) with certain subsystem
// or AliECS component rather than a human user.
enum SpecialUserId {
INVALID = 0;
LHC = 60;
TIMER = 65;
}

message WorkflowTemplateInfo {
string name = 1;
string description = 2;
Expand Down
14 changes: 14 additions & 0 deletions common/protos/protoutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,17 @@ func WrapEvent(ce isEvent_Payload) *Event {
Payload: ce,
}
}

// SpecialUser returns a User populated from a SpecialUserId enum:
// - externalId = enum numeric value
// - id = enum numeric value
// - name = enum string name
func SpecialUser(enumId SpecialUserId) *User {
externalId := int32(enumId)
name := enumId.String()
return &User{
ExternalId: &externalId,
Id: nil,
Name: name,
}
}
1 change: 1 addition & 0 deletions core/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,7 @@ func (env *Environment) scheduleAutoStopTransition() (scheduled bool, expected t
log.WithField("partition", env.id).
WithField("run", env.currentRunNumber).
Infof("Executing scheduled auto stop transition following expiration of %s", autoStopDuration)
env.SetLastRequestUser(pb.SpecialUser(pb.SpecialUserId_TIMER))
err = env.TryTransition(NewStopActivityTransition(ManagerInstance().taskman))
if err != nil {
log.WithField("partition", env.id).
Expand Down
1 change: 1 addition & 0 deletions core/environment/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,7 @@ func (envs *Manager) handleLhcEvents(evt event.IntegratedServiceEvent) {
WithField("run", env.currentRunNumber).
Info("stopping the run due to beam dump")

env.SetLastRequestUser(evpb.SpecialUser(evpb.SpecialUserId_LHC))
err := env.TryTransition(NewStopActivityTransition(envs.taskman))
if err != nil {
log.WithPrefix("scheduler").
Expand Down