guidellm.data.deserializers.trace_session_timing
Rewrite trace conversation timestamps to clamp waits, pack sessions, and scale time.
Applied in the dataset path after each conversation graph is built. Wait and pack caps run in original trace seconds, then remaining relative_timestamp values are multiplied by time_scale.
TraceSessionTiming
Compress intra-session gaps, inter-session idle, pack overlap, then scale.
max_wait is applied independently inside each conversation. max_session_wait then clamps idle time from the previous session's last request to this session's first request. min_concurrent_sessions then shifts this session earlier if needed so at least that many sessions overlap. Instantaneous sessions are left at their wait-capped start. time_scale multiplies the resulting timestamps.
Caps are in unscaled trace seconds. Dataset copies apply wait caps per copy, place the copy, then pack with shared state, then scale. Callers should construct a new instance per dataset iteration so packing state does not leak across epochs.
Source code in src/guidellm/data/deserializers/trace_session_timing.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |
apply(graph)
Rewrite relative_timestamp values on graph in place.
Wait caps, then packing, then time_scale. Dataset copies split these steps so packing can run after copies are placed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph | ConversationGraphData | Conversation whose turn timestamps may be compressed | required |
Returns:
| Type | Description |
|---|---|
ConversationGraphData | The same graph, after any timestamp rewrites |
Source code in src/guidellm/data/deserializers/trace_session_timing.py
apply_pack(graph)
Pack graph so at least min_concurrent_sessions overlap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph | ConversationGraphData | Conversation whose timestamps may be shifted earlier | required |
Returns:
| Type | Description |
|---|---|
ConversationGraphData | The same graph, after any packing shift |
Source code in src/guidellm/data/deserializers/trace_session_timing.py
apply_scale(graph)
Multiply remaining timestamps after wait and pack caps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph | ConversationGraphData | Conversation whose timestamps may be scaled | required |
Returns:
| Type | Description |
|---|---|
ConversationGraphData | The same graph, after any time-scale rewrite |
Source code in src/guidellm/data/deserializers/trace_session_timing.py
apply_wait_caps(graph)
Clamp intra-session and inter-session waits on graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph | ConversationGraphData | Conversation whose turn timestamps may be compressed | required |
Returns:
| Type | Description |
|---|---|
ConversationGraphData | The same graph, after any wait-cap rewrites |
Source code in src/guidellm/data/deserializers/trace_session_timing.py
graph_max_timestamp(graph)
Return the latest relative timestamp on graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph | ConversationGraphData | Conversation to inspect | required |
Returns:
| Type | Description |
|---|---|
float | Maximum relative timestamp among timed turns |
Source code in src/guidellm/data/deserializers/trace_session_timing.py
graph_min_timestamp(graph)
Return the earliest relative timestamp on graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph | ConversationGraphData | Conversation to inspect | required |
Returns:
| Type | Description |
|---|---|
float | Minimum relative timestamp among timed turns |
Source code in src/guidellm/data/deserializers/trace_session_timing.py
shift_graph_timestamps(graph, offset)
Add offset to every turn that has a relative timestamp.
Used to place dataset copies on the shared timeline. offset == 0 is a no-op.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph | ConversationGraphData | Conversation whose timestamps may be shifted later | required |
offset | float | Seconds to add to each present relative timestamp | required |