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 tool.

class genvid.toolbox.ClusterTool(*args, **kwargs)

Bases: ClusterAPI, 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 = {'command': {'job': 'services', 'loglevel': True, 'stdout': False, 'task': 'command'}, 'compose': {'job': 'services', 'loglevel': True, 'stdout': False, 'task': 'compose'}, 'disco': {'job': 'services', 'loglevel': True, 'stdout': False, 'task': 'disco'}, 'events': {'job': 'services', 'loglevel': True, 'stdout': False, 'task': 'events'}, 'gvencode': {'job': 'services', 'loglevel': True, 'stdout': False, 'task': 'gvencode'}, 'leaf': {'job': 'services', 'loglevel': True, 'stdout': False, 'task': 'leaf'}, 'root': {'job': 'services', 'loglevel': True, 'stdout': False, 'task': 'root'}}

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: List[str]) dict

Merge configuration from file


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.


events – The events definition.


Return True if a job is configured to be running.


Starts an array of jobs.


jobs – The list of jobs.


Stops an array of jobs.


jobs – The list of jobs.

class cluster_tool.ClusterTool

Implementation of genvid.toolbox.ClusterTool