smttask.task_types.MemoizedTask#

class smttask.task_types.MemoizedTask(arg0=None, *, reason=None, **taskinputs)#

Behaves like a Task, in particular with regards to computing descriptions and digests of composited tasks. However the output is not saved to disk and a sumatra record is not created. The intention is for tasks which are cheap to compute, and thus for which it does not make sense to store the output. A prime example would be the output of a random number generator, for which it is much more efficient to store a function, a random seed and some parameters.

__init__(arg0=None, *, reason=None, **taskinputs)#
Parameters:
  • arg0 (ParameterSet-like) – ParameterSet, or something which can be cast to a ParameterSet (like a dict or filename). The result will be parsed for task arguments defined in self.inputs.

  • **taskinputs – Task parameters can also be specified as keyword arguments, and will override those in :param:arg0.

  • reason (None | str) – Ignored because we aren’t recording into a Sumatra db. Included for compability with Task.

Methods

__init__([arg0, reason])

bind(**kwargs)

Bind task parameters to given values.

clear()

If the result of a previous run was cached, deallocate it.

describe([indent, type_join_str, ...])

A more human-friendly representation of the Task parameters.

draw(*args, **kwargs)

Draw the dependency graph.

from_desc(desc[, on_fail])

Instantiate a class from the description returned by 'desc'.

get_desc(taskinputs[, reason])

get_output([name])

Return the value of the output associated with name name; if the Task has only one unnamed output, specifying the name is not necessary.

load_inputs()

Return a copy of self.taskinputs, with all lazy inputs resolved:

parse_result(result)

Parse the task result as an object of type cls.Outputs.

partial(**kwargs)

Bind task parameters to given values.

run([cache, recompute, record, reason, ...])

save(path[, allow_overwrite])

Save a task description.

schematic()

Display an ascii-art schematic of the task inputs and outputs.

taskname()

validate(value)

Attributes

cache

desc

digest

graph

Return a dependency graph.

has_run

Returns True if a cached result (either in memory or on disk) exists and would be used on a call to run().

hashed_digest

input_files

inroot

Root of the input datastore.

logger

name

orig_taskinputs

outputpaths

Permanent paths to which task results are saved.

outroot

Root of the output datastore.

relative_outputpaths

resultpaths

Paths from which task results are retrieved.

saved_to_datastore

Return True if the outputs are saved to the _output_ data store.

saved_to_input_datastore

Return True if links matching the outputs exist the _input_ data store.

taskinputs

unhashed_digests