This module has been deprecated. Although the code is still working for our oldest model, it is not expected to work with the new Bastion API. Please use the new genvid-bastion and genvid-sdk tools.

class genvid.toolbox.ClusterTool(cluster_id='', **kwargs)

Bases: genvid.toolbox.cluster_api.ClusterAPI, genvid.toolbox.project.ProjectTool

This class allows the configuration of a cluster.

Changed in version 1.29.0: Moved merge_dict() to base class BaseTool.

Deprecated since version 1.29.0: Class no longer used internally

SETUP_JOBS = ('bastion-api',)

Jobs run on setup.

SETUP_LOGS = ('hashi-ui', 'bastion-api')

Logs available on setup.

START_JOBS = ('services',)

Jobs run on start.

List of links.

JOBS = {}

The list of available jobs

LOGS = {'root': {'stdout': False, 'loglevel': True, 'job': 'services', 'task': 'root'}, 'leaf': {'stdout': False, 'loglevel': True, 'job': 'services', 'task': 'leaf'}, 'events': {'stdout': False, 'loglevel': True, 'job': 'services', 'task': 'events'}, 'command': {'stdout': False, 'loglevel': True, 'job': 'services', 'task': 'command'}, 'disco': {'stdout': False, 'loglevel': True, 'job': 'services', 'task': 'disco'}, 'gvencode': {'stdout': False, 'loglevel': True, 'job': 'services', 'task': 'gvencode'}, 'compose': {'stdout': False, 'loglevel': True, 'job': 'services', 'task': 'compose'}}

The default list of logs.

Changed in version 1.30.0: Moved up to ClusterTool.

RE_BITRATE = re.compile('(?P<number>\\d+)(?P<prefix>[kmg]i?)?(?P<byte>b)?')

Regexp matching for bitrate conversion.

classmethod as_bitrate(bitrate: str) → int

This method converts a string representing a bitrate into a number.

It follows the FFmpeg convention and accepts a string representing a number as input. It may be followed by one of the SI unit prefixes, such as ’K’, ’M’, or ’G’.

If ’i’ is appended to the SI unit prefix the complete prefix is interpreted as a unit prefix for binary multiples, which are based on powers of 1024 instead of powers of 1000.

Appending ’B’ to the SI unit prefix multiplies the value by 8. This allows using suffixes like ’KB’, ’MiB’, ’G’ and ’B’.

New in version 1.33.0.

add_job(name, dependencies=None)

Add a new Nomad job to run. :param name: The name of the job. :param dependencies: A list of service name which the job depends on.

merge_config(*paths: typing.List[str]) → dict

Merge configuration from file

Parameters:paths – The path of the files

Load project logs into Consul.

Load project links into Consul.


Load project jobs into Consul.


Load the project map/reduce definitions into the configuration.

Parameters:events – The events definition.

Return True if a job is configured to be running.


Starts an array of jobs.

Parameters:jobs – The list of jobs.

Stops an array of jobs.

Parameters:jobs – The list of jobs.
class cluster_tool.ClusterTool

Implementation of genvid.toolbox.ClusterTool