Base

Contains Strategy-related definitions.

class Strategy(strategy=None)[source]

Bases: object

A wrapper around a Strategy Protocol Buffer.

property id[source]

Strategy’s ID.

property path[source]

Strategy’s Path.

property node_config[source]

Strategy’s Node Config.

property graph_config[source]

Strategy’s Graph Config.

copy()[source]

Create a copy of this strategy.

serialize(path=None)[source]

Serialize this strategy and write it to disk.

classmethod deserialize(strategy_id=None, path=None)[source]

Deserialize the strategy.

class StrategyBuilder[source]

Bases: abc.ABC

A builder interface for strategies.

abstract build(graph_item: autodist.graph_item.GraphItem, resource_spec: autodist.resource_spec.ResourceSpec)autodist.strategy.base.Strategy[source]

Build strategy representation instance with a graph item and a resource spec.

Parameters
Returns

(Strategy) A strategy representation instance.

class StrategyCompiler(graph_item)[source]

Bases: object

Strategy Compiler.

Currently, this just entails resolving device attributes, but this can be easily modified to do more in the future.

set_device_resolver(resolver)[source]

Add a device resolver to resolve devices in the strategy.

compile(strategy)[source]

Compile the strategy.