SchedulingHints#

class omni.graph.tools.ogn.SchedulingHints(scheduling_hints: List[str] | str)#

Bases: object

Class managing the scheduling hints. The keywords are case-independent during parsing, specified in lower case here for easy checking.

When there is a -read and -write variant only one of them should be specified at a time:

no suffix: The item in question is accessed for both read and write -read suffix: The item in question is accessed only for reading -write suffix: The item in question is accessed only for writing

These class static values list the possible values for the “scheduling” lists in the .ogn file.

# Set when the node accesses other global data, i.e. data stored outside of the node, including the data # on other nodes. GLOBAL_DATA = “global” GLOBAL_DATA_READ = “global-read” GLOBAL_DATA_WRITE = “global-write”

# Set when a node accesses static data, i.e. data shared among all nodes of the same type STATIC_DATA = “static” STATIC_DATA_READ = “static-read” STATIC_DATA_WRITE = “static-write”

# Set when the node is a threadsafe function, i.e. it can be scheduled in parallel with any other nodes, including # nodes of the same type. This flag is not compatible with the topology hints that aren’t read-only. THREADSAFE = “threadsafe”

# Set when the node accesses the graph topology, e.g. connections, attributes, or nodes TOPOLOGY = “topology” TOPOLOGY_READ = “topology-read” TOPOLOGY_WRITE = “topology-write”

# Set when the node accesses the USD stage data (for read-only, write-only, or both read and write) USD = “usd” USD_READ = “usd-read” USD_WRITE = “usd-write”

# Set when the scheduling of the node compute may be modified from the evaluator default. COMPUTERULE_DEFAULT = “compute-default” COMPUTERULE_ON_REQUEST = “compute-on-request”

# Set when the node author wishes to specify the purity of the computations that a node does. # A “pure” node is one that has no side effects in its initialize, compute, and/or release # methods (no mutation of data that is shared/can be accessed outside of the node scope, no # dependencies on external data apart from its inputs that could influence execution results). # In other words, pure nodes are deterministic in that they will always produce the same output # attribute values for a given set of input attribute values, and do not access, rely on, or # otherwise mutate data external to the node’s scope. PURE = “pure”

Methods

__init__(scheduling_hints)

Initialize the scheduling hints from the .ogn description

compare(other)

Compare this object against another of the same type to see if their flag configurations match.

cpp_includes_required()

Returns a list of files required to be included for the generated C++ code to work

emit_cpp(out)

Write the C++ initialization code to the given output stream, writing nothing if no flags were set.

emit_python(out)

Write the Python initialization code to the given output stream, writing nothing if no flags were set.

flags_set()

Returns the list of flags currently set as flag names

has_values_set()

Returns True if any of the scheduling hints values have been set

illegal_configurations()

Returns a list of illegal parsing configurations for testing purposes.

legal_configurations()

Returns a list of legal parsing configurations and expected results for testing purposes.

parse_error(message)

Raises a parse error with common information attached to the given message

set_flag(flag_to_set)

Tries to enable the named flag.

Attributes

COMPUTERULE_DEFAULT

COMPUTERULE_ON_REQUEST

GLOBAL_DATA

GLOBAL_DATA_READ

GLOBAL_DATA_WRITE

PURE

STATIC_DATA

STATIC_DATA_READ

STATIC_DATA_WRITE

THREADSAFE

TOPOLOGY

TOPOLOGY_READ

TOPOLOGY_WRITE

USD

USD_READ

USD_WRITE

__init__(scheduling_hints: List[str] | str)#

Initialize the scheduling hints from the .ogn description

compare(
other: SchedulingHints,
) List[str]#

Compare this object against another of the same type to see if their flag configurations match. If they don’t match then a list of differences is returned, otherwise an empty list

cpp_includes_required() List[str]#

Returns a list of files required to be included for the generated C++ code to work

emit_cpp(
out: IndentedOutput,
) bool#

Write the C++ initialization code to the given output stream, writing nothing if no flags were set. Assumes there is a local variable called nodeTypeObj that contains the NodeTypeObj definition. Returns True if anything was written.

emit_python(
out: IndentedOutput,
) bool#

Write the Python initialization code to the given output stream, writing nothing if no flags were set. Assumes there is a local variable called node_type that contains the Py_NodeType definition. Returns True if anything was written.

flags_set() list[str]#

Returns the list of flags currently set as flag names

has_values_set() bool#

Returns True if any of the scheduling hints values have been set

classmethod illegal_configurations() List[str]#

Returns a list of illegal parsing configurations for testing purposes. Keeps the data local

classmethod legal_configurations() List[str]#

Returns a list of legal parsing configurations and expected results for testing purposes. The data is a list of pairs where the first element is the flags to be set on the scheduling hints in the .ogn file (possibly with extra information as needed) and the second element is a SchedulingHints object configured with the expected results. It has a compare operation so the test will use that to confirm results

parse_error(message: str)#

Raises a parse error with common information attached to the given message

set_flag(flag_to_set: str)#

Tries to enable the named flag. Raises ParseError if the flag is not legal or not compatible with current flags