Condition

Overview

Conditions are used to specify when nodes are allowed to execute. Conditions can be used to specify a variety of required conditions for execution, including the state of the node itself (e.g., how many times it has already executed, or the value of one of its attributes), the state of the Scheduler (e.g., how many CONSIDERATION_SET_EXECUTION s have occurred in the current ENVIRONMENT_STATE_UPDATE), or the state of other nodes in a graph (e.g., whether or how many times they have executed). This package provides a number of pre-specified Conditions that can be parametrized (e.g., how many times a node should be executed). Custom conditions can also be created, by assigning a function to a Condition that can reference any node or its attributes, thus providing considerable flexibility for scheduling. These Conditions may also be referred to as “basic” Conditions. Graph structure Conditions are distinct, and affect scheduling instead by modifying the base ordering in which nodes are considered for execution.

Creating Conditions

Pre-specified Conditions

Pre-specified Conditions can be instantiated and added to a Scheduler at any time, and take effect immediately for the execution of that Scheduler. Most pre-specified Conditions have one or more arguments that must be specified to achieve the desired behavior. Many Conditions are also associated with an owner attribute (a node to which the Condition belongs). Schedulers maintain the data used to test for satisfaction of Condition, independent in different execution contexts. The Scheduler is generally responsible for ensuring that Conditions have access to the necessary data. When pre-specified Conditions are instantiated within a call to the add_condition method of a Scheduler or ConditionSet, the Condition’s owner is determined through context and assigned automatically, as in the following example:

my_scheduler.add_condition(A, EveryNPasses(1))
my_scheduler.add_condition(B, EveryNCalls(A, 2))
my_scheduler.add_condition(C, EveryNCalls(B, 2))

Here, EveryNCalls(A, 2) for example, is assigned the owner B.

Custom Conditions

Custom Conditions can be created by calling the constructor for the base class (Condition()) or one of the generic classes, and assigning a function to the func argument and any arguments it requires to the args and/or kwargs arguments (for formal or keyword arguments, respectively). The function is called with args and kwargs by the Scheduler on each PASS through its consideration_queue, and the result is used to determine whether the associated node is allowed to execute on that PASS. Custom Conditions allow arbitrary schedules to be created, in which the execution of each node can depend on one or more attributes of any other node in the graph.

For example, the following script fragment creates a custom Condition in which node_A is scheduled to wait to execute until node_B has “converged” (that is, settled to the point that none of its elements has changed in value more than a specified amount since the previous CONSIDERATION_SET_EXECUTION):

def converge(node, thresh):
    for val in node.delta:
        if abs(val) >= thresh:
            return False
    return True
epsilon = 0.01
my_scheduler.add_condition(node_A, NWhen(Condition(converge, node_B, epsilon), 1))

In the example, a function converge is defined that references the delta attribute of a node (which reports the change in its value). The function is assigned to the standard Condition with node_A and epsilon as its arguments, and composite Condition NWhen (which is satisfied the first N times after its condition becomes true), The Condition is assigned to node_B, thus scheduling it to execute one time when all of the elements of node_A have changed by less than epsilon.

Graph Structure Conditions

Graph structure Conditions share the same interface as basic Conditions, but operate differently. Like basic Conditions, they are assigned to an owner, and like node-based Conditions, they also track other nodes. Each graph structure Condition represents a transformation that can be applied to a graph, adding and removing edges, which will result in modifying a Scheduler’s consideration queue. Some execution patterns that are difficult to create using basic Conditions can be achieved much more easily by making a simple change to the graph.

For example, consider a situation in which a node computes an initial value and provides feedback to one or more of its ancestors. A direct construction of the scheduling graph with D providing feedback to A and C may be represented by:

  D
 ↗ ↖
B   C
↑
A

{A: set(), B: {A}, C: set(), D: {B, C}}

Creating a scheduling pattern for D to compute its initial value first, like [{D}, {A, C}, {B}], would require several basic Conditions:

scheduler.add_condition(A, EveryNCalls(D, 1))
scheduler.add_condition(B, EveryNCalls(D, 1))
scheduler.add_condition(C, EveryNCalls(D, 1))
scheduler.add_condition(D, Always())

This can become especially burdensome or impossible in larger graphs containing nodes that also need other Conditions. The same pattern would only require a single graph structure Condition:

scheduler.add_condition(D, BeforeNodes(A, C))

which modifies the scheduler’s graph to behave as if it were originally the following graph:

B
↑
A   C
 ↖ ↗
  D

{A: {D}, B: {A}, C: {D}, D: set()}

Not only is this easier, but it also allows the simultaneous use of the full range of basic Conditions.

Of course, this is the same as if you created a scheduler using the second graph. What graph structure Conditions do is provide an interface that can be used to avoid manually producing and managing transformations of an existing, possibly complicated, graph.

Note

Default behavior of graph structure conditions should be considered in beta and subject to change.

Structure

The Scheduler associates every node with a single basic Condition and zero or more graph structure Conditions. If a node has not been explicitly assigned a Condition, it is assigned a Condition that causes it to be executed whenever it is under consideration and all its structural parents have been executed at least once since the node’s last execution. Condition subclasses (listed below) provide a standard set of Conditions that can be implemented simply by specifying their parameter(s). Along with graph structure Conditions, there are six types of basic Conditions:

List of Pre-specified Conditions

Note

The optional TimeScale argument in many Conditions specifies the unit of time over which the Condition operates; the default value is ENVIRONMENT_STATE_UPDATE for all Conditions except those with “EnvironmentStateUpdate” in their name, for which it is ENVIRONMENT_SEQUENCE.

Generic Conditions (used to construct custom Conditions):

  • While (func, *args, **kwargs) satisfied whenever the specified function (or callable) called with args and/or kwargs evaluates to True. Equivalent to Condition(func, *args, **kwargs)

  • WhileNot (func, *args, **kwargs) satisfied whenever the specified function (or callable) called with args and/or kwargs evaluates to False. Equivalent to Not(Condition(func, *args, **kwargs))

Static Conditions (independent of other Conditions, nodes or time):

Composite Conditions (based on one or more other Conditions):

  • All (*Conditions) satisfied whenever all of the specified Conditions are satisfied.

  • Any (*Conditions) satisfied whenever any of the specified Conditions are satisfied.

  • Not (Condition) satisfied whenever the specified Condition is not satisfied.

  • NWhen (Condition, int) satisfied the first specified number of times the specified Condition is satisfied.

Time-Based Conditions (based on the count of units of time at a specified TimeScale or Time):

Node-Based Conditions (based on the execution or state of other nodes):

  • BeforeNCalls (node, int[, TimeScale]) satisfied any time before the specified node has executed the specified number of times.

  • AtNCalls (node, int[, TimeScale]) satisfied when the specified node has executed the specified number of times.

  • AfterCall (node, int[, TimeScale]) satisfied any time after the node has executed the specified number of times.

  • AfterNCalls (node, int[, TimeScale]) satisfied when or any time after the node has executed the specified number of times.

  • AfterNCallsCombined (*nodes, int[, TimeScale]) satisfied when or any time after the specified nodes have executed the specified number of times among themselves, in total.

  • EveryNCalls (node, int[, TimeScale]) satisfied when the specified node has executed the specified number of times since the last time owner has run.

  • JustRan (node) satisfied if the specified node was assigned to run in the previous CONSIDERATION_SET_EXECUTION.

  • AllHaveRun (*nodes) satisfied when all of the specified nodes have executed at least once.

  • WhenFinished (node) satisfied when the is_finished method of the specified node, given execution_id returns True.

  • WhenFinishedAny (*nodes) satisfied when the is_finished method of any of the specified nodes, given execution_id returns True.

  • WhenFinishedAll (*nodes) satisfied when the is_finished method of all of the specified nodes, given execution_id returns True.

Convenience Conditions (based on other Conditions, condensed for convenience)

Graph Structure Conditions (used to make modifications to the Scheduler graph):

  • BeforeNodes (*nodes, **options)

    adds a dependency from the owner to each of the specified nodes and optionally modifies the senders and receivers of all affected nodes

  • BeforeNode (node, **options)

    adds a dependency from the owner to the specified node and optionally modifies the senders and receivers of both

  • WithNode (node, **options)

    adds a dependency from each of the senders of both the owner and the specified node to both the owner and the specified node, and optionally modifies the receivers of both

  • AfterNodes (*nodes, **options)

    adds a dependency from each of the specified nodes to the owner and optionally modifies the senders and receivers of all affected nodes

  • AfterNode (node, **options)

    adds a dependency from the specified node to the owner and optionally modifies the senders and receivers of both

  • AddEdgeTo (node)

    adds an edge from AddEdgeTo.owner to AddEdgeTo.node

  • RemoveEdgeFrom (node)

    removes an edge from RemoveEdgeFrom.node to RemoveEdgeFrom.owner

  • CustomGraphStructureCondition (callable, **kwargs)

    applies a user-defined function to a graph

Execution

When the Scheduler runs, it makes a sequential PASS through its consideration_queue, evaluating each consideration_set in the queue to determine which nodes should be assigned to execute. It evaluates the nodes in each set by calling the is_satisfied method of the basic Condition associated with each of those nodes. If it returns True, then the node is assigned to the execution set for the CONSIDERATION_SET_EXECUTION of execution generated by that PASS. Otherwise, the node is not executed.

Class Reference

class graph_scheduler.condition.Operation(value)

Used in conjunction with GraphStructureCondition to indicate how a set of source nodes (S below) should be combined with a set of comparison nodes (C below) to produce a result set. Many Operations correspond to standard set operations.

Each enum item can be called with a source set and comparison set as arguments to produce the result set.

KEEP

Returns S

REPLACE

Returns C

DISCARD

Returns the empty set

INTERSECTION

Returns the set of items that are in both S and C

UNION

Returns the set of items in either S or C

MERGE

Returns the set of items in either S or C

DIFFERENCE

Returns the set of items in S but not C

INVERSE_DIFFERENCE

Returns the set of items in C but not S

SYMMETRIC_DIFFERENCE

Returns the set of items that are in one of S or C but not both

class graph_scheduler.condition.ConditionSet(*condition_sets, conditions=None)

Used in conjunction with a Scheduler to store the Conditions associated with a node.

Parameters:
conditions

the key of each entry is a node, and its value is a condition associated with that node. Conditions can be added to the ConditionSet using the ConditionSet’s add_condition method.

Type:

Dict[Hashable: Union[ConditionBase, Iterable[ConditionBase]]]

conditions_basic

a dict mapping nodes to their single basic Conditions

Type:

Dict[Hashable: Condition]

conditions_structural

a dict mapping nodes to their graph structure Conditions

Type:

Dict[Hashable: List[GraphStructureCondition]]

structural_condition_order

a list storing all GraphStructureCondition s in this ConditionSet in the order in which they were added (and will be applied to a Scheduler)

Type:

List[GraphStructureCondition]

add_condition(owner, condition)

Adds a basic or graph structure Condition to the ConditionSet.

If condition is basic, it will overwrite the current basic Condition for owner, if present. If you want to add multiple basic Conditions to a single owner, instead add a single Composite Condition to accurately specify the desired behavior.

Parameters:
  • owner (node) – specifies the node with which the condition should be associated. condition will govern the execution behavior of owner

  • condition (ConditionBase) – specifies the condition associated with owner to be added to the ConditionSet.

remove_condition(owner_or_condition)

Removes the condition specified as or owned by owner_or_condition.

Parameters:

owner_or_condition (Union[Hashable, ConditionBase]) – Either a condition or the owner of a condition

Return type:

Optional[ConditionBase]

Returns:

The condition removed, or None if no condition removed

Raises:

ConditionError

  • when owner_or_condition is an owner and it owns multiple conditions - when owner_or_condition is a condition and its owner is None

add_condition_set(conditions)

Adds a set of basic or graph structure Conditions (in the form of a dict or another ConditionSet) to the ConditionSet.

Any basic Condition added here will overwrite the current basic Condition for a given owner, if present. If you want to add multiple basic Conditions to a single owner, instead add a single Composite Condition to accurately specify the desired behavior.

Parameters:

conditions (Union[ConditionSet, Dict[Hashable, Union[ConditionBase, Iterable[ConditionBase]]]]) –

specifies collection of Conditions to be added to this ConditionSet,

if a dict is provided:

each entry should map an owner node (the node whose execution behavior will be governed) to a Condition or GraphStructureCondition, or an iterable of them.

property conditions: Union[ConditionBase, List[ConditionBase]]

Returns the Conditions contained within this ConditionSet

Returns:

Union[ConditionBase, List[ConditionBase]]]: a dictionary mapping owners to their conditions. The value for an owner will be a list if there is more than one condition for an owner

Return type:

dict[node

Note

This property maintains compatibility for v1.x. Prefer the conditions_basic and conditions_structural attributes for new code.

class graph_scheduler.condition.ConditionBase(_owner=None, **kwargs)

Abstract base class for basic conditions and graph structure conditions

owner

the node with which the Condition is associated, and the execution of which it determines.

Type:

Hashable

class graph_scheduler.condition.Condition(func, *args, **kwargs)

Used in conjunction with a Scheduler to specify the condition under which a node should be allowed to execute.

Parameters:
  • func (callable) – specifies function to be called when the Condition is evaluated, to determine whether it is currently satisfied.

  • args (*args) – specifies formal arguments to pass to func when the Condition is evaluated.

  • kwargs (**kwargs) – specifies keyword arguments to pass to func when the Condition is evaluated.

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

class graph_scheduler.condition.AbsoluteCondition(func, *args, **kwargs)
property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

graph_scheduler.condition.While

alias of Condition

class graph_scheduler.condition.WhileNot(func, *args, **kwargs)
Parameters:
  • func – callable specifies function to be called when the Condition is evaluated, to determine whether it is currently satisfied.

  • args*args specifies formal arguments to pass to func when the Condition is evaluated.

  • kwargs**kwargs specifies keyword arguments to pass to func when the Condition is evaluated.

Satisfied when:

  • func is False

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.Always
Parameters:

none

Satisfied when:

  • always satisfied.

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.Never
Parameters:

none

Satisfied when:

  • never satisfied.

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.CompositeCondition(func, *args, **kwargs)
property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.All(*args, **dependencies)
Parameters:

args – one or more Conditions

Satisfied when:

  • all of the Conditions in args are satisfied.

Notes

  • To initialize with a list (for example):

    conditions = [AfterNCalls(node, 5) for node in node_list]
    

    unpack the list to supply its members as args:

    composite_condition = All(*conditions)
    
property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.Any(*args, **dependencies)
Parameters:

args – one or more Conditions

Satisfied when:

  • one or more of the Conditions in args is satisfied.

Notes

  • To initialize with a list (for example):

    conditions = [AfterNCalls(node, 5) for node in node_list]
    

    unpack the list to supply its members as args:

    composite_condition = Any(*conditions)
    
property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

graph_scheduler.condition.And

alias of All

graph_scheduler.condition.Or

alias of Any

class graph_scheduler.condition.Not(condition)
Parameters:

condition (Condition) – a Condition

Satisfied when:

  • condition is not satisfied.

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.NWhen(condition, n=1)
Parameters:
  • condition (Condition) – a Condition

  • n (int) – the maximum number of times this condition will be satisfied

Satisfied when:

  • the first n times condition is satisfied upon evaluation

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.TimeInterval(repeat=None, start=None, end=None, unit=<Unit('millisecond')>, start_inclusive=True, end_inclusive=True)
repeat

the interval between *unit*s where this condition can be satisfied

start

the time at/after which this condition can be satisfied

end

the time at/fter which this condition can be satisfied

unit

the pint.Unit to use for scalar values of repeat, start, and end

start_inclusive

if True, start allows satisfaction exactly at the time corresponding to start. if False, satisfaction can occur only after start

end_inclusive

if True, end allows satisfaction exactly until the time corresponding to end. if False, satisfaction can occur only before end

Satisfied when:

Every repeat units of time at/after start and before/through end

Notes

Using a TimeInterval as a termination Condition may result in unexpected behavior. The user may be inclined to create TimeInterval(end=x) to terminate at time x, but this will do the opposite and be true only and always until time x, terminating at any time before x. If in doubt, use TimeTermination instead.

If the scheduler is not set to exact_time_mode = True, start_inclusive and end_inclusive may not behave as expected. See Exact Time Mode for more info.

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.TimeTermination(t, inclusive=True, unit=<Unit('millisecond')>)
t

the time at/after which this condition is satisfied

unit

the pint.Unit to use for scalar values of t, start, and end

start_inclusive

if True, the condition is satisfied exactly at the time corresponding to t. if False, satisfaction can occur only after t

Satisfied when:

At/After time t

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.BeforeConsiderationSetExecution(n, time_scale=TimeScale.ENVIRONMENT_STATE_UPDATE)
Parameters:
  • n (int) – the ‘CONSIDERATION_SET_EXECUTION’ before which the Condition is satisfied

  • time_scale (TimeScale) – the TimeScale used as basis for counting CONSIDERATION_SET_EXECUTIONs (default: TimeScale.ENVIRONMENT_STATE_UPDATE)

Satisfied when:

Notes

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AtConsiderationSetExecution(n, time_scale=TimeScale.ENVIRONMENT_STATE_UPDATE)
Parameters:

Satisfied when:

Notes

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AfterConsiderationSetExecution(n, time_scale=TimeScale.ENVIRONMENT_STATE_UPDATE)
Parameters:

Satisfied when:

Notes

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AfterNConsiderationSetExecutions(n, time_scale=TimeScale.ENVIRONMENT_STATE_UPDATE)
Parameters:

Satisfied when:

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.BeforePass(n, time_scale=TimeScale.ENVIRONMENT_STATE_UPDATE)
Parameters:
  • n (int) – the ‘PASS’ before which the Condition is satisfied

  • time_scale (TimeScale) – the TimeScale used as basis for counting PASSes (default: TimeScale.ENVIRONMENT_STATE_UPDATE)

Satisfied when:

  • at most n-1 PASSes have occurred within one unit of time at the TimeScale specified by time_scale.

Notes

  • Counts of TimeScales are zero-indexed (that is, the first PASS is 0, the second PASS is 1, etc.); so, BeforePass(2) is satisfied at PASS 0 and PASS 1.

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AtPass(n, time_scale=TimeScale.ENVIRONMENT_STATE_UPDATE)
Parameters:
  • n (int) – the PASS at which the Condition is satisfied

  • time_scale (TimeScale) – the TimeScale used as basis for counting PASSes (default: TimeScale.ENVIRONMENT_STATE_UPDATE)

Satisfied when:

  • exactly n PASSes have occurred within one unit of time at the TimeScale specified by time_scale.

Notes

  • Counts of TimeScales are zero-indexed (that is, the first ‘PASS’ is pass 0, the second ‘PASS’ is 1, etc.); so, AtPass(1) is satisfied when a single PASS (PASS 0) has occurred, and AtPass(2) is satisfied when two PASSes have occurred (PASS 0 and PASS 1), etc..

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AfterPass(n, time_scale=TimeScale.ENVIRONMENT_STATE_UPDATE)
Parameters:
  • n (int) – the PASS after which the Condition is satisfied

  • time_scale (TimeScale) – the TimeScale used as basis for counting PASSes (default: TimeScale.ENVIRONMENT_STATE_UPDATE)

Satisfied when:

  • at least n+1 PASSes have occurred within one unit of time at the TimeScale specified by time_scale.

Notes

  • Counts of TimeScales are zero-indexed (that is, the first PASS is 0, the second PASS is 1, etc.); so, AfterPass(1) is satisfied after PASS 1 has occurred and thereafter (i.e., in PASSes 2, 3, 4, etc.).

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AfterNPasses(n, time_scale=TimeScale.ENVIRONMENT_STATE_UPDATE)
Parameters:
  • n (int) – the number of PASSes after which the Condition is satisfied

  • time_scale (TimeScale) – the TimeScale used as basis for counting PASSes (default: TimeScale.ENVIRONMENT_STATE_UPDATE)

Satisfied when:

  • at least n PASSes have occurred within one unit of time at the TimeScale specified by time_scale.

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.EveryNPasses(n, time_scale=TimeScale.ENVIRONMENT_STATE_UPDATE)
Parameters:
  • n (int) – the frequency of passes with which this condition is satisfied

  • time_scale (TimeScale) – the TimeScale used as basis for counting PASSes (default: TimeScale.ENVIRONMENT_STATE_UPDATE)

Satisfied when:

  • PASS 0

  • the specified number of PASSes that has occurred within a unit of time (at the TimeScale specified by time_scale) is evenly divisible by n.

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.BeforeEnvironmentStateUpdate(n, time_scale=TimeScale.ENVIRONMENT_SEQUENCE)
Parameters:

Satisfied when:

Notes

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AtEnvironmentStateUpdate(n, time_scale=TimeScale.ENVIRONMENT_SEQUENCE)
Parameters:

Satisfied when:

Notes

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AfterEnvironmentStateUpdate(n, time_scale=TimeScale.ENVIRONMENT_SEQUENCE)
Parameters:

Satisfied when:

Notes

ENVIRONMENT_STATE_UPDATE is 1, etc.); so, AfterPass(1) is satisfied after ENVIRONMENT_STATE_UPDATE 1 has occurred and thereafter (i.e., in ENVIRONMENT_STATE_UPDATEs 2, 3, 4, etc.).

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AfterNEnvironmentStateUpdates(n, time_scale=TimeScale.ENVIRONMENT_SEQUENCE)
Parameters:

Satisfied when:

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AtEnvironmentSequence(n)
Parameters:

n (int) – the ENVIRONMENT_SEQUENCE at which the Condition is satisfied

Satisfied when:

Notes

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AfterEnvironmentSequence(n)
Parameters:

n (int) – the ENVIRONMENT_SEQUENCE after which the Condition is satisfied

Satisfied when:

Notes

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AfterNEnvironmentSequences(n)
Parameters:

n (int) – the number of ENVIRONMENT_SEQUENCEs after which the Condition is satisfied

Satisfied when:

Notes

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.BeforeNCalls(dependency, n, time_scale=TimeScale.ENVIRONMENT_STATE_UPDATE)
Parameters:
  • dependency (node) – the node on which the Condition depends

  • n (int) – the number of executions of dependency before which the Condition is satisfied

  • time_scale (TimeScale) – the TimeScale used as basis for counting executions of dependency

  • (default – TimeScale.ENVIRONMENT_STATE_UPDATE)

Satisfied when:

  • the node specified in dependency has executed at most n-1 times within one unit of time at the TimeScale specified by time_scale.

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AtNCalls(dependency, n, time_scale=TimeScale.ENVIRONMENT_STATE_UPDATE)
Parameters:
  • dependency (node) – the node on which the Condition depends

  • n (int) – the number of executions of dependency at which the Condition is satisfied

  • time_scale (TimeScale) – the TimeScale used as basis for counting executions of dependency

  • (default – TimeScale.ENVIRONMENT_STATE_UPDATE)

Satisfied when:

  • the node specified in dependency has executed exactly n times within one unit of time at the TimeScale specified by time_scale.

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AfterCall(dependency, n, time_scale=TimeScale.ENVIRONMENT_STATE_UPDATE)
Parameters:
  • dependency (node) – the node on which the Condition depends

  • n (int) – the number of executions of dependency after which the Condition is satisfied

  • time_scale (TimeScale) – the TimeScale used as basis for counting executions of dependency

  • (default – TimeScale.ENVIRONMENT_STATE_UPDATE)

Satisfied when:

  • the node specified in dependency has executed at least n+1 times within one unit of time at the TimeScale specified by time_scale.

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AfterNCalls(dependency, n, time_scale=TimeScale.ENVIRONMENT_STATE_UPDATE)
Parameters:
  • dependency (node) – the node on which the Condition depends

  • n (int) – the number of executions of dependency after which the Condition is satisfied

  • time_scale (TimeScale) – the TimeScale used as basis for counting executions of dependency

  • (default – TimeScale.ENVIRONMENT_STATE_UPDATE)

Satisfied when:

  • the node specified in dependency has executed at least n times within one unit of time at the TimeScale specified by time_scale.

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AfterNCallsCombined(*dependencies, n=None, time_scale=TimeScale.ENVIRONMENT_STATE_UPDATE)
Parameters:
  • *nodes (nodes) – one or more nodes on which the Condition depends

  • n (int) – the number of combined executions of all nodes specified in dependencies after which the

  • (default (Condition is satisfied) – None)

  • time_scale (TimeScale) – the TimeScale used as basis for counting executions of dependency

  • (default – TimeScale.ENVIRONMENT_STATE_UPDATE)

Satisfied when:

  • there have been at least n+1 executions among all of the nodes specified in dependencies within one unit of time at the TimeScale specified by time_scale.

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.EveryNCalls(dependency, n)
Parameters:
  • dependency (node) – the node on which the Condition depends

  • n (int) – the frequency of executions of dependency at which the Condition is satisfied

Satisfied when:

  • the node specified in dependency has executed at least n times since the last time the Condition’s owner executed.

Notes

  • scheduler’s count of each other node that is “useable” by the node is reset to 0 when the node runs

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.JustRan(dependency)
Parameters:

dependency (node) – the node on which the Condition depends

Satisfied when:

Notes

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AllHaveRun(*dependencies, time_scale=TimeScale.ENVIRONMENT_STATE_UPDATE)
Parameters:
  • *nodes (nodes) – an iterable of nodes on which the Condition depends

  • time_scale (TimeScale) – the TimeScale used as basis for counting executions of dependency

  • (default – TimeScale.ENVIRONMENT_STATE_UPDATE)

Satisfied when:

  • all of the nodes specified in dependencies have executed at least once within one unit of time at the TimeScale specified by time_scale.

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.WhenFinished(dependency)
Parameters:

dependency (node) – the node on which the Condition depends

Satisfied when:

  • the is_finished methods of the node specified in dependencies returns True.

Notes

  • This is a dynamic Condition: Each node is responsible for managing its finished status on its own, which can occur independently of the execution of other nodes. Therefore the satisfaction of this Condition) can vary arbitrarily in time.

  • The is_finished method is called with execution_id as its sole positional argument

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.WhenFinishedAny(*dependencies)
Parameters:

*nodes (nodes) – zero or more nodes on which the Condition depends

Satisfied when:

  • the is_finished methods of any nodes specified in dependencies returns True.

Notes

  • This is a convenience class; WhenFinishedAny(A, B, C) is equivalent to Any(WhenFinished(A), WhenFinished(B), WhenFinished(C)). If no nodes are specified, the condition will default to checking all of scheduler’s nodes.

  • This is a dynamic Condition: Each node is responsible for managing its finished status on its own, which can occur independently of the execution of other nodes. Therefore the satisfaction of this Condition) can vary arbitrarily in time.

  • The is_finished method is called with execution_id as its sole positional argument

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.WhenFinishedAll(*dependencies)
Parameters:

*nodes (nodes) – zero or more nodes on which the Condition depends

Satisfied when:

  • the is_finished methods of all nodes specified in dependencies return True.

Notes

  • This is a convenience class; WhenFinishedAny(A, B, C) is equivalent to All(WhenFinished(A), WhenFinished(B), WhenFinished(C)). If no nodes are specified, the condition will default to checking all of scheduler’s nodes.

  • This is a dynamic Condition: Each node is responsible for managing its finished status on its own, which can occur independently of the execution of other nodes. Therefore the satisfaction of this Condition) can vary arbitrarily in time.

  • The is_finished method is called with execution_id as its sole positional argument

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AtEnvironmentStateUpdateStart

Satisfied when:

Notes

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AtEnvironmentStateUpdateNStart(n, time_scale=TimeScale.ENVIRONMENT_SEQUENCE)
Parameters:

Satisfied when:

Notes

  • identical to All(AtPass(0), AtEnvironmentStateUpdate(n, time_scale))

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AtEnvironmentSequenceStart

Satisfied when:

Notes

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.AtEnvironmentSequenceNStart(n)
Parameters:

n (int) – the ENVIRONMENT_SEQUENCE on which the Condition is satisfied

Satisfied when:

Notes

  • identical to All(AtEnvironmentStateUpdate(0), AtEnvironmentSequence(n))

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.Threshold(dependency, parameter, threshold, comparator, indices=None, atol=0, rtol=0, custom_parameter_getter=None, custom_parameter_validator=None)
dependency

the node on which the Condition depends

parameter

the name of the parameter of dependency whose value is to be compared to threshold

threshold

the fixed value compared to the value of the parameter

comparator

the string comparison operator determining the direction or type of comparison of the value of the parameter relative to threshold

indices

if specified, a series of indices that reach the desired number given an iterable value for parameter

atol

absolute tolerance for the comparison

rtol

relative tolerance (to threshold) for the comparison

custom_parameter_getter

if specified, a function that returns the value of parameter for dependency; to support class structures other than <dependency>.<parameter> without subclassing

custom_parameter_validator

if specified, a function that throws an exception if there is no parameter for dependency; to support class structures other than <dependency>.<parameter> without subclassing

Satisfied when:

The comparison between the value of the parameter and threshold using comparator is true. If comparator is an equality (==, !=), the comparison will be considered equal within tolerances atol and rtol.

Notes

The comparison must be done with scalars. If the value of parameter contains more than one item, indices must be specified.

property absolute_fixed_points

In absolute time, specific time points for satisfaction or unsatisfaction of this Condition or those it contains

property absolute_intervals

In absolute time, repeated intervals for satisfaction or unsatisfaction of this Condition or those it contains

is_satisfied(*args, execution_id=None, **kwargs)

the function called to determine satisfaction of this Condition.

Parameters:
  • args (*args) – specifies additional formal arguments to pass to func when the Condition is evaluated. these are appended to the args specified at instantiation of this Condition

  • kwargs (**kwargs) – specifies additional keyword arguments to pass to func when the Condition is evaluated. these are added to the kwargs specified at instantiation of this Condition

Returns:

True - if the Condition is satisfied False - if the Condition is not satisfied

class graph_scheduler.condition.GraphStructureCondition(_owner=None, **kwargs)

Abstract base class for graph structure conditions

Subclasses must implement:

_process

modify_graph(graph)

Modifies graph based on the transformation specified by this condition

Parameters:

graph (Dict[Hashable, Set[Hashable]]) – a graph dependency dictionary

Raises:

ConditionError

Return type:

Dict[Hashable, Set[Hashable]]

Returns:

A copy of graph with modifications applied

class graph_scheduler.condition.CustomGraphStructureCondition(process_graph_function, **kwargs)

Applies a user-defined function to a graph

Parameters:
  • process_graph_function (Callable) – a function taking an optional ‘self’ argument (as the first argument, if present), and a graph dependency dictionary

  • kwargs (**kwargs) – optional arguments to be stored as attributes

modify_graph(graph)

Modifies graph based on the transformation specified by this condition

Parameters:

graph (Dict[Hashable, Set[Hashable]]) – a graph dependency dictionary

Raises:

ConditionError

Return type:

Dict[Hashable, Set[Hashable]]

Returns:

A copy of graph with modifications applied

class graph_scheduler.condition.BeforeNodes(*nodes, owner_senders=Operation.MERGE, owner_receivers=Operation.KEEP, subject_senders=Operation.KEEP, subject_receivers=Operation.KEEP, reconnect_non_subject_receivers=True, remove_new_self_referential_edges=True, prune_cycles=True, ignore_conflicts=False)

Adds a dependency from the owner to each of the specified nodes and optionally modifies the senders and receivers of all affected nodes

Parameters:
  • owner_senders (Union[Operation, str]) – Operation that determines how the original senders of owner (the Operation source) combine with the union of all original senders of all subject nodes (the Operation comparison) to produce the new set of senders of owner after modify_graph

  • owner_receivers (Union[Operation, str]) – Operation that determines how the original receivers of owner (the Operation source) combine with the union of all original receivers of all subject nodes (the Operation comparison) to produce the new set of receivers of owner after modify_graph

  • subject_senders (Union[Operation, str, Dict[Hashable, Union[Operation, str]]]) – Operation that determines how the original senders for each of the subject nodes (the Operation source) combine with the original senders of owner (the Operation comparison) to produce the new set of senders for the subject nodes after modify_graph. Operations are applied individually to each subject node, and this argument may also be specified as a dictionary mapping nodes to separate operations.

  • subject_receivers (Union[Operation, str, Dict[Hashable, Union[Operation, str]]]) – Operation that determines how the original receivers for each of the subject nodes (the Operation source) combine with the original receivers of owner (the Operation comparison) to produce the new set of receivers for the subject nodes after modify_graph. Operations are applied individually to each subject node, and this argument may also be specified as a dictionary mapping nodes to separate operations.

  • reconnect_non_subject_receivers (bool) – If True, modify_graph will create an edge from all prior senders of owner to all receivers of owner that are not in nodes, if there is no longer a path from that sender to that receiver. Defaults to True.

  • remove_new_self_referential_edges (bool) – If True, modify_graph will remove any newly-created edges from a node to itself. Defaults to True.

  • prune_cycles (bool) – If True, modify_graph will attempt to prune any newly-created cycles, preferring to remove edges adjacent to owner that affect the placement of owner more than any subject node. Defaults to True.

  • ignore_conflicts (bool) – If True, when any two operations give different results for the new senders and receivers of a node in modify_graph, an error will not be raised. Defaults to False.

nodes

the subject nodes

modify_graph(graph)

Modifies graph based on the transformation specified by this condition

Parameters:

graph (Dict[Hashable, Set[Hashable]]) – a graph dependency dictionary

Raises:

ConditionError

Return type:

Dict[Hashable, Set[Hashable]]

Returns:

A copy of graph with modifications applied

class graph_scheduler.condition.BeforeNode(*nodes, owner_senders=Operation.MERGE, owner_receivers=Operation.KEEP, subject_senders=Operation.KEEP, subject_receivers=Operation.KEEP, reconnect_non_subject_receivers=True, remove_new_self_referential_edges=True, prune_cycles=True, ignore_conflicts=False)

Adds a dependency from the owner to the specified node and optionally modifies the senders and receivers of both

Parameters:
  • owner_senders (Union[Operation, str]) – Operation that determines how the original senders of owner (the Operation source) combine with the union of all original senders of all subject nodes (the Operation comparison) to produce the new set of senders of owner after modify_graph

  • owner_receivers (Union[Operation, str]) – Operation that determines how the original receivers of owner (the Operation source) combine with the union of all original receivers of all subject nodes (the Operation comparison) to produce the new set of receivers of owner after modify_graph

  • subject_senders (Union[Operation, str, Dict[Hashable, Union[Operation, str]]]) – Operation that determines how the original senders for each of the subject nodes (the Operation source) combine with the original senders of owner (the Operation comparison) to produce the new set of senders for the subject nodes after modify_graph. Operations are applied individually to each subject node, and this argument may also be specified as a dictionary mapping nodes to separate operations.

  • subject_receivers (Union[Operation, str, Dict[Hashable, Union[Operation, str]]]) – Operation that determines how the original receivers for each of the subject nodes (the Operation source) combine with the original receivers of owner (the Operation comparison) to produce the new set of receivers for the subject nodes after modify_graph. Operations are applied individually to each subject node, and this argument may also be specified as a dictionary mapping nodes to separate operations.

  • reconnect_non_subject_receivers (bool) – If True, modify_graph will create an edge from all prior senders of owner to all receivers of owner that are not in nodes, if there is no longer a path from that sender to that receiver. Defaults to True.

  • remove_new_self_referential_edges (bool) – If True, modify_graph will remove any newly-created edges from a node to itself. Defaults to True.

  • prune_cycles (bool) – If True, modify_graph will attempt to prune any newly-created cycles, preferring to remove edges adjacent to owner that affect the placement of owner more than any subject node. Defaults to True.

  • ignore_conflicts (bool) – If True, when any two operations give different results for the new senders and receivers of a node in modify_graph, an error will not be raised. Defaults to False.

nodes

the subject nodes

node

the subject node

modify_graph(graph)

Modifies graph based on the transformation specified by this condition

Parameters:

graph (Dict[Hashable, Set[Hashable]]) – a graph dependency dictionary

Raises:

ConditionError

Return type:

Dict[Hashable, Set[Hashable]]

Returns:

A copy of graph with modifications applied

class graph_scheduler.condition.WithNode(node, owner_receivers=Operation.KEEP, subject_receivers=Operation.KEEP, reconnect_non_subject_receivers=True, remove_new_self_referential_edges=True, prune_cycles=True, ignore_conflicts=False)

Adds a dependency from each of the senders of both the owner and the specified node to both the owner and the specified node, and optionally modifies the receivers of both

Parameters:
  • owner_sendersOperation that determines how the original senders of owner (the Operation source) combine with the union of all original senders of all subject nodes (the Operation comparison) to produce the new set of senders of owner after modify_graph

  • owner_receivers (Union[Operation, str]) – Operation that determines how the original receivers of owner (the Operation source) combine with the union of all original receivers of all subject nodes (the Operation comparison) to produce the new set of receivers of owner after modify_graph

  • subject_sendersOperation that determines how the original senders for each of the subject nodes (the Operation source) combine with the original senders of owner (the Operation comparison) to produce the new set of senders for the subject nodes after modify_graph. Operations are applied individually to each subject node, and this argument may also be specified as a dictionary mapping nodes to separate operations.

  • subject_receivers (Union[Operation, str, Dict[Hashable, Union[Operation, str]]]) – Operation that determines how the original receivers for each of the subject nodes (the Operation source) combine with the original receivers of owner (the Operation comparison) to produce the new set of receivers for the subject nodes after modify_graph. Operations are applied individually to each subject node, and this argument may also be specified as a dictionary mapping nodes to separate operations.

  • reconnect_non_subject_receivers (bool) – If True, modify_graph will create an edge from all prior senders of owner to all receivers of owner that are not in nodes, if there is no longer a path from that sender to that receiver. Defaults to True.

  • remove_new_self_referential_edges (bool) – If True, modify_graph will remove any newly-created edges from a node to itself. Defaults to True.

  • prune_cycles (bool) – If True, modify_graph will attempt to prune any newly-created cycles, preferring to remove edges adjacent to owner that affect the placement of owner more than any subject node. Defaults to True.

  • ignore_conflicts (bool) – If True, when any two operations give different results for the new senders and receivers of a node in modify_graph, an error will not be raised. Defaults to False.

nodes

the subject nodes

node

the subject node

modify_graph(graph)

Modifies graph based on the transformation specified by this condition

Parameters:

graph (Dict[Hashable, Set[Hashable]]) – a graph dependency dictionary

Raises:

ConditionError

Return type:

Dict[Hashable, Set[Hashable]]

Returns:

A copy of graph with modifications applied

class graph_scheduler.condition.AfterNodes(*nodes, owner_senders=Operation.KEEP, owner_receivers=Operation.MERGE, subject_senders=Operation.MERGE, subject_receivers=Operation.KEEP, reconnect_non_subject_receivers=True, remove_new_self_referential_edges=True, prune_cycles=True, ignore_conflicts=False)

Adds a dependency from each of the specified nodes to the owner and optionally modifies the senders and receivers of all affected nodes

Parameters:
  • owner_senders (Union[Operation, str]) – Operation that determines how the original senders of owner (the Operation source) combine with the union of all original senders of all subject nodes (the Operation comparison) to produce the new set of senders of owner after modify_graph

  • owner_receivers (Union[Operation, str]) – Operation that determines how the original receivers of owner (the Operation source) combine with the union of all original receivers of all subject nodes (the Operation comparison) to produce the new set of receivers of owner after modify_graph

  • subject_senders (Union[Operation, str, Dict[Hashable, Union[Operation, str]]]) – Operation that determines how the original senders for each of the subject nodes (the Operation source) combine with the original senders of owner (the Operation comparison) to produce the new set of senders for the subject nodes after modify_graph. Operations are applied individually to each subject node, and this argument may also be specified as a dictionary mapping nodes to separate operations.

  • subject_receivers (Union[Operation, str, Dict[Hashable, Union[Operation, str]]]) – Operation that determines how the original receivers for each of the subject nodes (the Operation source) combine with the original receivers of owner (the Operation comparison) to produce the new set of receivers for the subject nodes after modify_graph. Operations are applied individually to each subject node, and this argument may also be specified as a dictionary mapping nodes to separate operations.

  • reconnect_non_subject_receivers (bool) – If True, modify_graph will create an edge from all prior senders of owner to all receivers of owner that are not in nodes, if there is no longer a path from that sender to that receiver. Defaults to True.

  • remove_new_self_referential_edges (bool) – If True, modify_graph will remove any newly-created edges from a node to itself. Defaults to True.

  • prune_cycles (bool) – If True, modify_graph will attempt to prune any newly-created cycles, preferring to remove edges adjacent to owner that affect the placement of owner more than any subject node. Defaults to True.

  • ignore_conflicts (bool) – If True, when any two operations give different results for the new senders and receivers of a node in modify_graph, an error will not be raised. Defaults to False.

nodes

the subject nodes

modify_graph(graph)

Modifies graph based on the transformation specified by this condition

Parameters:

graph (Dict[Hashable, Set[Hashable]]) – a graph dependency dictionary

Raises:

ConditionError

Return type:

Dict[Hashable, Set[Hashable]]

Returns:

A copy of graph with modifications applied

class graph_scheduler.condition.AfterNode(*nodes, owner_senders=Operation.KEEP, owner_receivers=Operation.MERGE, subject_senders=Operation.MERGE, subject_receivers=Operation.KEEP, reconnect_non_subject_receivers=True, remove_new_self_referential_edges=True, prune_cycles=True, ignore_conflicts=False)

Adds a dependency from the specified node to the owner and optionally modifies the senders and receivers of both

Parameters:
  • owner_senders (Union[Operation, str]) – Operation that determines how the original senders of owner (the Operation source) combine with the union of all original senders of all subject nodes (the Operation comparison) to produce the new set of senders of owner after modify_graph

  • owner_receivers (Union[Operation, str]) – Operation that determines how the original receivers of owner (the Operation source) combine with the union of all original receivers of all subject nodes (the Operation comparison) to produce the new set of receivers of owner after modify_graph

  • subject_senders (Union[Operation, str, Dict[Hashable, Union[Operation, str]]]) – Operation that determines how the original senders for each of the subject nodes (the Operation source) combine with the original senders of owner (the Operation comparison) to produce the new set of senders for the subject nodes after modify_graph. Operations are applied individually to each subject node, and this argument may also be specified as a dictionary mapping nodes to separate operations.

  • subject_receivers (Union[Operation, str, Dict[Hashable, Union[Operation, str]]]) – Operation that determines how the original receivers for each of the subject nodes (the Operation source) combine with the original receivers of owner (the Operation comparison) to produce the new set of receivers for the subject nodes after modify_graph. Operations are applied individually to each subject node, and this argument may also be specified as a dictionary mapping nodes to separate operations.

  • reconnect_non_subject_receivers (bool) – If True, modify_graph will create an edge from all prior senders of owner to all receivers of owner that are not in nodes, if there is no longer a path from that sender to that receiver. Defaults to True.

  • remove_new_self_referential_edges (bool) – If True, modify_graph will remove any newly-created edges from a node to itself. Defaults to True.

  • prune_cycles (bool) – If True, modify_graph will attempt to prune any newly-created cycles, preferring to remove edges adjacent to owner that affect the placement of owner more than any subject node. Defaults to True.

  • ignore_conflicts (bool) – If True, when any two operations give different results for the new senders and receivers of a node in modify_graph, an error will not be raised. Defaults to False.

nodes

the subject nodes

node

the subject node

modify_graph(graph)

Modifies graph based on the transformation specified by this condition

Parameters:

graph (Dict[Hashable, Set[Hashable]]) – a graph dependency dictionary

Raises:

ConditionError

Return type:

Dict[Hashable, Set[Hashable]]

Returns:

A copy of graph with modifications applied

class graph_scheduler.condition.AddEdgeTo(*nodes, **kwargs)

Adds an edge from AddEdgeTo.owner to AddEdgeTo.node

node

the subject node

modify_graph(graph)

Modifies graph based on the transformation specified by this condition

Parameters:

graph (Dict[Hashable, Set[Hashable]]) – a graph dependency dictionary

Raises:

ConditionError

Return type:

Dict[Hashable, Set[Hashable]]

Returns:

A copy of graph with modifications applied

class graph_scheduler.condition.RemoveEdgeFrom(*nodes, **kwargs)

Removes an edge from RemoveEdgeFrom.node to RemoveEdgeFrom.owner

node

the subject node

modify_graph(graph)

Modifies graph based on the transformation specified by this condition

Parameters:

graph (Dict[Hashable, Set[Hashable]]) – a graph dependency dictionary

Raises:

ConditionError

Return type:

Dict[Hashable, Set[Hashable]]

Returns:

A copy of graph with modifications applied