Skip to content

Commit 7249ace

Browse files
committed
add comment for extractActorIDFromTaskID
Signed-off-by: AndySung320 <andysung0320@gmail.com>
1 parent 0439a98 commit 7249ace

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

historyserver/pkg/eventserver/eventserver.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ func (h *EventHandler) storeEvent(eventMap map[string]any) error {
789789
StartTime int64
790790
EndTime int64
791791
}
792-
existingKeys := make(map[eventKey]struct{})
792+
existingKeys := make(map[eventKey]struct{}, len(t.ProfileData.Events)+len(rawEvents))
793793
for _, e := range t.ProfileData.Events {
794794
existingKeys[eventKey{e.EventName, e.StartTime, e.EndTime}] = struct{}{}
795795
}
@@ -1260,6 +1260,16 @@ func getChromeTraceColor(eventName string) string {
12601260
}
12611261
}
12621262

1263+
// extractActorIDFromTaskID extracts the ActorID from a TaskID following Ray's ID specification.
1264+
//
1265+
// Design doc: src/ray/design_docs/id_specification.md
1266+
// - TaskID: 8B unique + 16B ActorID (total 24 bytes = 48 hex chars)
1267+
// - ActorID: 12B unique + 4B JobID (total 16 bytes = 32 hex chars)
1268+
//
1269+
// For a 48-character hex TaskID, the last 32 hex characters (bytes 16–48)
1270+
// correspond to the ActorID. This function further checks the "unique" portion
1271+
// of the ActorID (first 24 hex chars) and returns an empty string if it is all Fs,
1272+
// which indicates normal/driver tasks with no associated actor.
12631273
func extractActorIDFromTaskID(taskIDHex string) string {
12641274
if len(taskIDHex) != 48 {
12651275
return "" // can't process if encoded in base64

0 commit comments

Comments
 (0)