def get_events(i): client = KronosClient(node._host, blocking=True) start_time = node.start_time + (i * delta) if i == executor.parallelism - 1: end_time = node.end_time else: end_time = start_time + delta - 1 return list(client.get(node.stream, start_time, end_time, namespace=node._namespace))
optional_time = datetime_to_kronos_time(start + timedelta(seconds=5)) kc.put({'yourproduct.website.clicks': [ {'user': 35, 'num_clicks': 10, TIMESTAMP_FIELD: optional_time}]}) # Retrieving data """ Retrieving data requires a stream name, a start datetime, and an end datetime. Note that an `ID_FIELD` and `@TIMESTAMP_FIELD` field are attached to each event. The `ID_FIELD` is a UUID1-style identifier with its time bits derived from the timestamp. This allows event IDs to be roughly sortable by the time that they happened while providing a deterministic tiebreaker when two events happened at the same time. """ events = kc.get('yourproduct.website.clicks', start, start + timedelta(minutes=10)) for event in events: print 'Received event', event last_event_id = event[ID_FIELD] ## Event order """ By default, events are returned in ascending order of their `ID_FIELD`. Pass in an`order=ResultOrder.DESCENDING` argument to change this behavior to be in descending order of `ID_FIELD`. """ events = kc.get('yourproduct.website.clicks', start, start + timedelta(minutes=10), order=ResultOrder.DESCENDING)
def execute(self, node, executor): client = KronosClient(node._host, blocking=True) return client.get(node.stream, node.start_time, node.end_time, namespace=node._namespace)
kc.put({'yourproduct.website.clicks': [ {'user': 35, 'num_clicks': 10, TIMESTAMP_FIELD: optional_time}]}) """ ## Retrieving Events Retrieving events requires a stream name, a start datetime, and an end datetime. Note that an `ID_FIELD` and `@TIMESTAMP_FIELD` field are attached to each event. The `ID_FIELD` is a UUID1-style identifier with its time bits derived from the timestamp. This allows event IDs to be roughly sortable by the time that they happened while providing a deterministic tiebreaker when two events happened at the same time. """ events = kc.get('yourproduct.website.clicks', start, start + timedelta(minutes=10)) for event in events: print 'Received event', event last_event_id = event[ID_FIELD] """ ### Event Order By default, events are returned in ascending order of their `ID_FIELD`. Pass in an`order=ResultOrder.DESCENDING` argument to change this behavior to be in descending order of `ID_FIELD`. """ events = kc.get('yourproduct.website.clicks', start, start + timedelta(minutes=10),