|On this page|
This node can be used to write custom partitioner logic using the Python API. PDG will call the script hooks on this node to partition upstream work items. The Partitioner node API reference has a detailed explanation for each of the callback functions that you can implement.
For use cases that can expressed as a single line Python or HScript expression, the Partition by Expression is a simpler alternative.
Save to Python Script
Saves the callbacks defined on this node to a Python script, which can be imported and registered with PDG. The parameter template associated with the node is also saved and embedded into the Python script. After saving the script is automatically imported and the node type is made available in the TAB menu.
Save to Digital Asset
Saves the callbacks defined on this node to a standalone Houdini Digital asset. The callbacks are stored inside the .hda itself and are registered with PDG as an embedded PDG node type.
This script is run in order to partition the upstream items.
If this is a static partitioner it is run once during the static cook with the full list of upstream static items as input. If this is a dynamic partitioner it is run once during the cook based on the value of the Partition When parameter.
Several variables are available in the script:
Refers to the underlying PDG node associated with the TOP node. Note that this is different than TOP node itself, which is a standard Houdini operator.
Spare parameters added to the TOP node’s parameter interface will automatically be added to the PDG node.
The partition holder used to add work items to partitions. Partitions will be committed to the node once the script completes. If there are any errors during the script, the contents of the partition holder is discarded.
The list of work items to partition.
These parameters control how attributes from input work items are merged onto the partitions produced by the node.
Defines the number of attribute merge operations to perform on the partitioner node. The operations are used to merge attributes from work items in the partition onto the partition itself. Operations are performed in descending order. Attributes are merged using the first operation with a pattern that matches the attribute.
Specifies the operation to perform to merge incoming attributes onto the partition. Each operation only applies only to the subset of attributes matched using the corresponding To Attributes parameter.
The following operations are available:
Matching attributes are ignored and will not appear on the partition.
The value of each matching attribute on the first work item in the partition is kept, and values on subsequent work items are ignored
The value of each matching attribute on the last work item in the partition is kept.
The unique values for each matching attribute are merged into an array. Duplicate values are discarded.
Append to Array
The values for each matching attribute are appended to an array for that attribute. All attribute values from all work items are kept.
The minimum value for each matching attribute is kept.
The maximum value for each matching attribute is kept.
The sum of the values in each matching attribute is stored on the partition.
The average value of each matching attribute is stored on the partition.
The most common value in each matching attribute is kept.
The middle value in each matching attribute is kept.
Specifies which attributes the corresponding Apply Operation parameter should apply to. This field can use the Attribute Pattern Syntax to specify multiple attributes.
By default the partitioner will flatten incoming array attributes into a single sequence of values and perform the merge operation over all values. However, when this toggle is enabled, the merge operation will preserve the original array size of the incoming attributes. The merged array size is determined by the first value found across the input work items.
These are advanced parameters that provide finer control over the behavior of the partitioner.
Determines when the partitioning step is performed on the input work items.
Input Items are Generated
Upstream work items are partitioned once all of them have been generated
Input Items Are Cooked
Upstream work items are partitioned once all of them are cooked. This may be required when the partitioning scheme is based on the results of the work items' execution.
This makes this partitioner behave like a Wait for All node except that it may create multiple partitions.A
Determines which node or nodes(s) should target. Work items in the target nodes are partitioned as soon as they're generated even if the target nodes are not a direct input to this node. The descendants of the target work items are added to the partitions when they become available.
Direct Input Nodes
The partitioner uses work items from its direct input nodes. This is the default behavior
Upstream Static Nodes
The partitioner will skip over dynamic input nodes and partition work items from the nearest upstream static nodes.
Custom Target Node
The partitioner will use the node specified using the Custom Target Node parameter.
Custom Target Node
Specifies the target TOP node for the partition when Partition Targets is set to Custom Target Node. The partition scheme is applied to the work items in the target TOP node instead of this node’s input work items. The target TOP node must be in the same graph and above this node.
Split by Attribute
When on, the node splits input work items by the specified attribute(s) before partitioning them. The partitioning logic is evaluated on the list of work items for each distinct attribute value. Work items with different attribute values are always put into different partitions. Multiple attribute names can be specified as a space-separated list.
Determines how the node handles work items that are missing the split attribute.
This parameter is only available when Split by Attribute is on.
See also Split by Attribute.
Ignore Work Item
Work items that are missing the split attribute are not put into any of the partitions.
Handle Work Item in Python Code
The partitioner node determines what happens to work items that are missing the split attribute. This parameter option invokes the onPartition Partitioner callback.
Add Work Item to All Partitions
Work items that are missing the split attribute are put into all of the partitions.
Use Default Value
Work items that are missing the split attribute will use the value set by the Default Value parameter.
Specifies the value to use for the split attribute for work items that are missing the attribute.
This parameter is only available when Missing Attribute is set to Use Default Value.
Allow Partial Matches
When Split by Attribute is set to a list of attribute names, this parameter determines how work items with only some of the attributes should be processed. If partial matches are enabled then work items will be added to split groups based on the attributes that do exist. Otherwise, work items with only a subset of the attributes will be excluded from the partitioning step.
Sort Contents By
Determines the order that work items are sorted in when accessing the partitions on this node. This also affects the sort order of output files on the partition.
No sorting is applied. The work items in the partition are handled in no particular order.
Work Item Index
Work items in the partition are sorted based on their index.
Input Node Order
Work items in the partition are sorted based on the order of input nodes wired into this node. If two work items are from the same input, they are then sorted by index.
Work items in the partition are sorted based on the attribute specified in the Sort Attribute field parameter.
Determines whether the work items in this node’s partitions are sorted in ascending or descending order.
Specifies the name of the attribute to sort by.
This parameter is only available when Sort Contents By is set to Attribute.
Prioritize Required Work Items
When on, work items that were added to partitions with the
required flag set to
True will always be sorted to the front of the partition items list. Within that set of work items, the regular sorting logic is used for relative ordering. For example, if multiple work items are required, then they are sorted using the regular sorting options. This parameter has no effect if Sort Contents By is set to None.
Store Items to Attrib
When on, the list of IDs corresponding to the work items in the partition are written to the specified attribute. The work item IDs are stored as an integer array. This makes it easier to recover the list of partitioned work items downstream of the partitioner node.