hyperstream.stream package¶
Submodules¶
hyperstream.stream.stream module¶
-
class
hyperstream.stream.stream.
AssetStream
(channel, stream_id, calculated_intervals, last_accessed, last_updated, sandbox, mongo_model=None)[source]¶ Bases:
hyperstream.stream.stream.DatabaseStream
Simple subclass that overrides the calculated intervals property
-
calculated_intervals
¶
-
-
class
hyperstream.stream.stream.
DatabaseStream
(channel, stream_id, calculated_intervals, last_accessed, last_updated, sandbox, mongo_model=None)[source]¶ Bases:
hyperstream.stream.stream.Stream
Simple subclass that overrides the calculated intervals property
-
calculated_intervals
¶ Gets the calculated intervals from the database
Returns: The calculated intervals
-
last_accessed
¶ Gets the last accessed time from the database
Returns: The last accessed time
-
last_updated
¶ Gets the last updated time from the database
Returns: The last updated time
-
-
class
hyperstream.stream.stream.
Stream
(channel, stream_id, calculated_intervals, sandbox)[source]¶ Bases:
hyperstream.utils.containers.Hashable
Stream reference class
-
calculated_intervals
¶ Get the calculated intervals This will be read from the stream_status collection if it’s in the database channel
Returns: The calculated intervals
-
parent_node
¶
-
purge
()[source]¶ Purge the stream. This removes all data and clears the calculated intervals
Returns: None
-
set_tool_reference
(tool_reference)[source]¶ Set the back reference to the tool that populates this stream. This is needed to traverse the graph outside of workflows
Parameters: tool_reference – The toool Returns: None
-
window
(time_interval=None, force_calculation=False)[source]¶ Gets a view on this stream for the time interval given
Parameters: - time_interval (None | Iterable | TimeInterval) – either a TimeInterval object or (start, end) tuple of type str or datetime
- force_calculation (bool) – Whether we should force calculation for this stream view if data does not exist
Returns: a stream view object
-
writer
¶
-
hyperstream.stream.stream_collections module¶
hyperstream.stream.stream_id module¶
-
class
hyperstream.stream.stream_id.
StreamId
(name, meta_data=None)[source]¶ Bases:
hyperstream.utils.containers.Hashable
Helper class for stream identifiers. A stream identifier contains the stream name and any meta-data
-
as_raw
()[source]¶ Return a representation of this object that can be used with mongoengine Document.objects(__raw__=x) Example:
>>> stream_id = StreamId(name='test', meta_data=((u'house', u'1'), (u'resident', u'1'))) >>> stream_id.as_raw() {'stream_id.meta_data': [(u'house', u'1'), (u'resident', u'1')], 'stream_id.name': 'test'}
Returns: The raw representation of this object.
-
hyperstream.stream.stream_instance module¶
-
class
hyperstream.stream.stream_instance.
StreamInstance
[source]¶ Bases:
hyperstream.stream.stream_instance.StreamInstance
Simple helper class for storing data instances that’s a bit neater than simple tuples
-
class
hyperstream.stream.stream_instance.
StreamMetaInstance
[source]¶ Bases:
hyperstream.stream.stream_instance.StreamMetaInstance
StreamInstance that also contains meta data
hyperstream.stream.stream_view module¶
-
class
hyperstream.stream.stream_view.
StreamView
(stream, time_interval, force_calculation=False)[source]¶ Bases:
hyperstream.utils.containers.Printable
Simple helper class for storing streams with a time interval (i.e. a “view” on a stream) :param stream: The stream upon which this is a view :param time_interval: The time interval over which this view is defined :param force_calculation: Whether we should force calculation for this stream view if data does not exist :type stream: Stream :type time_interval: TimeInterval