Contexts and Executions — Renga 0.1.0.dev20170922 documentation

Join us on GitHub

# Contexts and Executions

Manage contexts and executions on the server.

Methods available on `client.contexts`:

class `renga.models.deployer.` `ContextCollection`(client=None)

  Represent a collection of contexts.

  Create a representation of objects on the server.

  class `Meta`

    Information about an individual context.

    `model`

      alias of `Context`

  `create`(spec=None, **kwargs)

    Create a new context.

  `list`()

    Return a list if the collection is iterable.

## Context objects

class `renga.models.deployer.` `Context`

  Represent a deployer context.

  Create a representation of an object on the server.

  `executions`

    Return the collection of context executions.

  `id`

    The identifier of the object.

  `image`

    Image used for the executions.

  `inputs`

    Return the context input objects.

  `labels`

    Return the context labels.

  `lineage`

    Return the lineage of this context.

  `outputs`

    Return the context output objects.

  `run`(inputs=None, outputs=None, **kwargs)

    Execute the context.

    Optionally provide new values for input and output slots. Following example shows how to create new execution from the current context with different files attached to input and output slots.

        execution = client.current_context.run(
            engine='docker',
            inputs={
                'notebook': client.buckets[1234].file[9876].clone(),
            },
            outputs={
                'plot': client.buckets[1234].create('plot.png'),
            },
        )
        print(execution.url)

  `spec`

    Specification of the execution context.

  `vertex_id`

    Graph vertex id.

## Executions

class `renga.models.deployer.` `ExecutionCollection`(context_id, **kwargs)

  Represent a collection of executions.

  Initialize the collection of context executions.

  class `Meta`

    Information about an individual execution.

    `model`

      alias of `Execution`

  `list`()

    Return a list if the collection is iterable.

## Execution objects

class `renga.models.deployer.` `Execution`

  Represent a context execution.

  Create a representation of an object on the server.

  `context`

    Return the related context.

  `context_id`

    Return the associated context id.

  `engine`

    Return the execution engine.

  `environment`

    Return the execution environment variables.

  `id`

    The identifier of the object.

  `logs`(**kwargs)

    Get logs from this execution.

  `ports`

    Return runtime port mapping.

  `stop`()

    Stop a running execution.

  `url`

    Return a URL for accessing the running container.