datawork.api.invocation

Module implementing Tool and Invocation.

class datawork.api.invocation.Invocation(tool, args)[source]

Called tool connecting input data to output data.

This class represents a Tool with fully or partially specified inputs, ready for computation and caching. It is responsible for providing cache identifiers for all its outputs.

__init__(tool, args)[source]

Construct invocation object.

Parameters:
  • tool – the Tool object being invoked
  • args – tuple of arguments, which are either Data objects or None, in which case a new placeholder type will be instantiated.
cache_identifier(o)[source]

Return identifier for cache which combines name of output with hash.

cache_outputs()[source]

Write outputs to cache.

get_hash()[source]

Compute a hash of this invocation.

get_outputs()[source]

Implement a getter for evaluating outputs on demand.

invoke(*args)[source]

Handle partial evaluation by invoking with more arguments.

The result of this method is another Invocation.

If the same arguments (meaning the same objects, identified by python id) are provided, the same invocation object is returned.

missing_args()[source]

Count number of missing arguments.

o

Implement a getter for evaluating outputs on demand.

parents()[source]

Invocations depend on tool and all arguments.

populate()[source]

Compute the outputs by calling a tool’s ‘.run()’ method.

This method organizes all of the input data.Data and config.Option parameters and passes them to the static tool.Tool.run() method.

set_output(name, value, cache=True)[source]

Set output, caching if requested.