hyperstream package¶
Subpackages¶
- hyperstream.channels package
- Submodules
- hyperstream.channels.assets_channel module
- hyperstream.channels.assets_channel2 module
- hyperstream.channels.base_channel module
- hyperstream.channels.database_channel module
- hyperstream.channels.file_channel module
- hyperstream.channels.memory_channel module
- hyperstream.channels.module_channel module
- hyperstream.channels.tool_channel module
- Module contents
- hyperstream.itertools2 package
- hyperstream.models package
- hyperstream.stream package
- hyperstream.tool package
- hyperstream.utils package
- hyperstream.workflow package
Submodules¶
hyperstream.channel_manager module¶
hyperstream.client module¶
The main hyperstream client connection that is used for storing runtime information. Note that this is also used by the default database channel, although other database channels (connecting to different database types) can also be used.
-
class
hyperstream.client.
Client
(server_config, auto_connect=True)[source]¶ Bases:
hyperstream.utils.containers.Printable
The main mongo client
-
client
= None¶
-
connect
(server_config)[source]¶ Connect using the configuration given
Parameters: server_config – The server configuration
-
db
= None¶
-
get_config_value
(key, default=None)[source]¶ Get a specific value from the configuration
Parameters: - key – The of the item
- default – A default value if not found
Returns: The found value or the default
-
session
= None¶
-
hyperstream.config module¶
HyperStream configuration module.
hyperstream.hyperstream module¶
Main HyperStream class
-
class
hyperstream.hyperstream.
HyperStream
(loglevel=20, file_logger=True, console_logger=True, mqtt_logger=None, config_filename='hyperstream_config.json')[source]¶ Bases:
object
HyperStream class: can be instantiated simply with hyperstream = HyperStream() for default operation. Use in the following way to create a session (and store history of execution etc). >>> with Hyperstream(): >>> pass
- Note that HyperStream uses the singleton pattern described here:
- https://stackoverflow.com/a/33201/1038264
- For py2k/py3k compatability we use the six decorator add_metaclass:
- https://pythonhosted.org/six/#six.add_metaclass
-
add_workflow
(workflow)[source]¶ Add the workflow to the workflow manager
Parameters: workflow (Workflow) – The workflow Returns: None
-
clear_sessions
(inactive_only=True, clear_history=False)[source]¶ Clears all stored sessions, optionally excluding active sessions
Parameters: - inactive_only – Whether to clear inactive sessions only
- clear_history – Whether to also clear session history
Returns: None
-
create_workflow
(*args, **kwds)[source]¶ Create a new workflow. Simple wrapper for creating a workflow and adding it to the workflow manager.
Parameters: - workflow_id – The workflow id
- name – The workflow name
- owner – The owner/creator of the workflow
- description – A human readable description
- online – Whether this workflow should be executed by the online engine
- monitor – Whether the workflow computations should be monitored
- safe – If safe=True, will throw an error if the workflow already exists
Returns: The workflow
-
current_session
¶ Get the current session
Returns: the current session
-
new_session
()[source]¶ Start a new session to record computation history
Returns: the created session
-
populate_tools_and_factors
()[source]¶ Function to populate factory functions for the tools and factors for ease of access.
Returns: None
-
sessions
¶ Get the list of sessions
Returns: the sessions
hyperstream.online_engine module¶
Online Engine module. This will be used in the online execution mode.
hyperstream.plugin_manager module¶
Plugin manager module for additional user added channels and tools.
hyperstream.time_interval module¶
Module for dealing with time intervals containing TimeInterval, TimeIntervals, and RelativeTimeInterval
-
class
hyperstream.time_interval.
RelativeTimeInterval
(start, end)[source]¶ Bases:
hyperstream.time_interval.TimeInterval
Relative time interval object. Thin wrapper around a (start, end) tuple of timedelta objects that provides some validation
-
end
¶
-
start
¶
-
-
class
hyperstream.time_interval.
TimeInterval
(start, end)[source]¶ Bases:
hyperstream.time_interval.TimeInterval
Time interval object. Thin wrapper around a (start, end) tuple of datetime objects that provides some validation
-
end
¶
-
humanized
¶
-
start
¶
-
width
¶
-
-
class
hyperstream.time_interval.
TimeIntervals
(intervals=None)[source]¶ Bases:
hyperstream.utils.containers.Printable
Container class for time intervals, that manages splitting and joining Example object: (t1,t2] U (t3,t4] U …
-
end
¶
-
humanized
¶
-
is_empty
¶
-
span
¶
-
start
¶
-
-
hyperstream.time_interval.
parse_time_tuple
(start, end)[source]¶ - Parse a time tuple. These can be:
- relative in seconds, e.g. (-4, 0) relative in timedelta, e.g. (timedelta(seconds=-4), timedelta(0)) absolute in date/datetime, e.g. (datetime(2016, 4, 28, 20, 0, 0, 0, UTC), datetime(2016, 4, 28, 21, 0, 0, 0, UTC)) absolute in iso strings, e.g. (“2016-04-28T20:00:00.000Z”, “2016-04-28T20:01:00.000Z”) Mixtures of relative and absolute are not allowed
Parameters: - start (int | timedelta | datetime | str) – Start time
- end (int | timedelta | datetime | str) – End time
Returns: TimeInterval or RelativeTimeInterval object