def ParseSessionIdAndStartTime(sessionId): # NOTE: If the session ID looks too much like a serialized json date/time then the deserializer will # deserialize it into a date/time object, which is undesirable in this case. # Hence the addition of the surrounding angle brackets to thwart this behaviour. haveSessionId = (sessionId is not None and (sessionId.StartsWith("<") and sessionId.EndsWith(">"))) if haveSessionId: sessionStartTime = time_util.GetDateTimeUtcFromISO8601FormattedDate(sessionId[1:-1]) else: sessionStartTime = time_util.GetDateTimeUtcNow() sessionId = "<" + time_util.GetISO8601FormattedUtcDate(sessionStartTime) + ">" return sessionId, sessionStartTime
def GetUniqueIdForProcess(process): return str.Join(PROCESS_UNIQUE_ID_DELIMITER, process.Id.ToString(), time_util.GetISO8601FormattedUtcDate(process.StartTime))