API Docs

Deployer

Deployer sub-module.

class renga_deployer.deployer.Deployer(engines=None, **kwargs)[source]

Handling the executions of contexts.

Create a Deployer instance.

Parameters:engines – dict of engine name:uri pairs
create(spec)[source]

Create a context with a given specification.

classmethod from_env(prefix='DEPLOYER_')[source]

Create a Deployer from environment variables.

get_host_ports(execution)[source]

Fetch hostname and ports for the running execution.

get_logs(execution)[source]

Ask engine to extract logs.

launch(context=None, engine=None, **kwargs)[source]

Create new execution for a given context.

stop(execution, remove=False)[source]

Stop a running execution, optionally removing it from engine.

Engines

Engine sub-module.

class renga_deployer.engines.DockerEngine[source]

Class for deploying contexts on docker.

Initialize the docker engine.

class EXECUTION_STATE_MAPPING[source]

State mappings for the Docker engine.

client[source]

Create a docker client from local environment.

get_execution_environment(execution) → dict[source]

Retrieve the environment specified for an execution container.

get_host_ports(execution)[source]

Return host ip and port bindings for the running execution.

get_logs(execution)[source]

Extract logs for a container.

get_state(execution)[source]

Return the status of an execution.

launch(execution, **kwargs)[source]

Launch a docker container with the context image.

logger[source]

Create a logger instance.

stop(execution, remove=False)[source]

Stop a running container, optionally removing it.

class renga_deployer.engines.Engine[source]

Base engine class.

get_execution_environment(execution) → dict[source]

Retrieve the environment specified for an execution container.

get_host_port(execution)[source]

Retrieve the host/port where the application can be reached.

get_logs(execution)[source]

Extract logs for a container.

get_state(execution)[source]

Check the state of an execution.

launch(context, **kwargs)[source]

Create new execution environment for a given context.

stop(execution, remove=False)[source]

Stop an execution.

class renga_deployer.engines.K8SEngine(config=None, timeout=10)[source]

Class for deploying contexts on Kubernetes.

Create a K8SNode instance.

class EXECUTION_STATE_MAPPING[source]

State mappings for the K8S engine.

get_execution_environment(execution) → dict[source]

Retrieve the environment specified for an execution container.

get_host_ports(execution)[source]

Return host ip and port bindings for the running execution.

get_logs(execution, timeout=None, **kwargs)[source]

Extract logs for the Job from the Pod.

get_state(execution)[source]

Get status of a running job.

launch(execution, engine=None, **kwargs)[source]

Launch a Kubernetes Job with the context spec.

logger[source]

Create a logger instance.

stop(execution, remove=False)[source]

Stop a running job.

Extension

Renga Deployer Service.

class renga_deployer.ext.RengaDeployer(app=None)[source]

Renga-Deployer extension.

Extension initialization.

deployer

Returns a local app Deployer.

init_app(app)[source]

Flask application initialization.

init_config(app)[source]

Initialize configuration.

Models

Models sub-module.

class renga_deployer.models.Context(**kwargs)[source]

Execution context.

Additionally it contains two columns created and updated with automatically managed timestamps.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

classmethod create(spec=None)[source]

Create a new context.

creator

Creator of the context.

id

Context identifier.

jwt

JWT with which the context has been created.

spec

Context specification.

class renga_deployer.models.Execution(**kwargs)[source]

Represent an execution of a context.

Additionally it contains two columns created and updated with automatically managed timestamps.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

check_state(states, engine)[source]

Check whether the execution is in one of the specified states.

context_id

Context identifier from which the execution started.

engine

Engine name.

engine_id

Internal identifier returned by an engine.

classmethod from_context(context, **kwargs)[source]

Create a new execution for a given context.

id

Execution identifier.

jwt

JWT with which the execution has been created.

namespace

Namespace name.

class renga_deployer.models.ExecutionStates[source]

Valid execution states.

renga_deployer.models.db = <SQLAlchemy engine=None>

Core database object.

renga_deployer.models.load_jwt()[source]

Load JWT from a context.

Utils

Utility functions.

renga_deployer.utils.decode_bytes(func)[source]

Function wrapper that always returns string.

renga_deployer.utils.dict_from_labels(labels, separator='=')[source]

Create a multidict from label string.

renga_deployer.utils.join_url(*args)[source]

Join together url strings.

renga_deployer.utils.resource_available(func)[source]

Function wrapper to catch that something is not available.

Example:

while not resource_available(get_logs()):
# this loop continues until the logs are available pass

logs = get_logs()

renga_deployer.utils.validate_uuid(s, version=4)[source]

Check that a string is a valid UUID.

renga_deployer.utils.validate_uuid_args(*names)[source]

Check that input arguments are valid UUIDs.

Views

Renga Deployer Service.

renga_deployer.views.index()[source]

Basic view.