hyperstream package

Subpackages

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.

class hyperstream.config.HyperStreamConfig[source]

Bases: hyperstream.utils.containers.Printable

Wrapper around the hyperstream configuration file (hyperstream_config.json)

class hyperstream.config.OnlineEngineConfig(interval, sleep=5, iterations=100, alarm=None)[source]

Bases: hyperstream.utils.containers.Printable

hyperstream.hyperstream module

Main HyperStream class

class hyperstream.hyperstream.HyperStream(loglevel=20, file_logger=True, console_logger=True, mqtt_logger=None)[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.

class hyperstream.online_engine.OnlineEngine(hyperstream)[source]

Bases: object

OnlineEngine class.

execute(*args, **kwargs)[source]

Execute the engine - currently simple executes all workflows.

hyperstream.plugin_manager module

Plugin manager module for additional user added channels and tools.

class hyperstream.plugin_manager.Plugin[source]

Bases: hyperstream.plugin_manager.PluginBase, hyperstream.utils.containers.Printable

Plugin class - simple wrapper over namedtuple

load_channels()[source]

Loads the channels and tools given the plugin path specified

Returns:The loaded channels, including a tool channel, for the tools found.

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

absolute(dt)[source]
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

classmethod all_time()[source]
end
humanized
classmethod now_minus(weeks=0, days=0, hours=0, minutes=0, seconds=0, milliseconds=0)[source]
start
to_json()[source]
to_tuple()[source]
classmethod up_to_now()[source]
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 ...

compress()[source]
end
humanized
is_empty
parse(intervals)[source]
span
split(points)[source]
start
to_json()[source]
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

hyperstream.time_interval.profile(ob)[source]

Comment out this function to be able to use the line_profiler module. e.g. call: kernprof -l scripts/deploy_summariser.py –loglevel=10 python -m line_profiler deploy_summariser.py.lprof > deploy_summariser.py.summary :param ob: object :return: object

hyperstream.version module

Module contents