Swap Event Module¶
SwapEvent class and helper functions.
SwapEvent(m1, m2, time)¶
Represents a timestamped name tag swap between two minions.
__init__(m1, m2, time)¶
- m1 (str) – The ID of minion 1
- m2 (str) – The ID of minion 2
- time (
datetime.datetime) – The time the swap occurred
TypeError – if time is not an instance of
SwapEvents according to time stamp.
If we have two
ais less than
a‘s time stamp occurs before
b‘s time stamp.
Parameters: other (SwapEvent) – the other
Raises: TypeError – if other is not a
Convert items from an iterable to
Returns an iterable that attempts to convert items yielded from iterable into
SwapEventobjects and yields the results. In other words, this generator iterates through iterable, converts each item to a
SwapEvent, and yields the resulting
iterable should yield strings with the following format:
ID1 swapped with ID2 at TIME
ID1is an integer
ID2is an integer
TIMEis a date/time formatted as
%Y-%m-%dT%H:%M:%Sper Python’s datetime.strptime documentation.
Fields must be separated by a single space.
Parameters: iterable – An iterable that yields