genvid.toolbox.ClusterTool

Warning

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='local', **kwargs)

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

This class allows the configuration of a cluster.

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

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

Regexp matching for bitrate conversion.

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_dict(source, destination)

Merge 2 dictionaries.

Parameters:
  • source – The source dictionary.
  • destination – The destination dictionary.
merge_config(*paths: typing.List[str]) → dict

Merge configuration from file

Parameters:paths – The path of the files
load_project_logs()

Load project logs into Consul.

Load project links into Consul.

load_project_jobs()

Load project jobs into Consul.

load_project_map_reduce(events)

Load the project map/reduce definitions into the configuration.

Parameters:events – The events definition.
is_jobs_running()

Return True if a job is configured to be running.

start_project_jobs(*jobs)

Starts an array of jobs.

Parameters:jobs – The list of jobs.
stop_project_jobs(*jobs)

Stops an array of jobs.

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

Implementation of genvid.toolbox.ClusterTool