Inheritance |
|
A container object for construct new PDG work items, by passing a pdg.WorkItemOptions
object or a key/value arguments to the addWorkItem
method
Methods ¶
addWorkItem(options=None, **kwargs)
→ pdg.WorkItem
Constructs a new work item and adds it to the holder. This function can either take a pdg.WorkItemOptions object, or a keyword arguments matching the supported values in the work item options object.
For example:
# Using keyword arguments item_holder.addWorkItem(index=5, priority=3) # Using an options object options = pdg.WorkItemOptions() options.index = 10 options.priority = 4 options.cloneResultData = True item_holder.addWorkItem(options) # Combination item_holder.addWorkItem(options, batch=True, batchSize=4)
addWorkItemArrayFromDict(dict, parent=None, strategy=pdg.attribCollisionStrategy.Replace, preserve_type=False, preserve_index=True, add_attributes=True)
→ list
of pdg.WorkItem
Adds work items from the specified dict
, which is a pdg.Dictionary that contains an array of saved work items.
If parent
is not None
, the work items are added as dependencies of the specified work item. The work item should be one of the upstream items available during work item generation.
strategy
determines how conflicts should be resolved if the parent work item and work items in the JSON data have attributes with the same name. By default, the attributes in the JSON data replace attributes inherited from the parent.
If preserve_type
is True
, the work items will be created with the same custom datatype as the ones in the serialized JSON data. Otherwise, the work items will use the default data type for the node.
If preserve_index
is True
, the work item indices will be set to the value loaded from JSON. Otherwise, the work items will inherit their index from the parent
item.
If add_attributes
is True
, an the original work item name and state will be added to the new work item as attributes.
addWorkItemArrayFromJSONFile(file_path, parent=None, strategy=pdg.attribCollisionStrategy.Replace, preserve_type=False, preserve_index=True, add_attributes=True)
→ list
of pdg.WorkItem
Adds work items from the .json file saved at file_path
, which contains an array of saved work items.
If parent
is not None
, the work items are added as dependencies of the specified work item. The work item should be one of the upstream items available during work item generation.
strategy
determines how conflicts should be resolved if the parent work item and work items in the JSON data have attributes with the same name. By default, the attributes in the JSON data replace attributes inherited from the parent.
If preserve_type
is True
, the work items will be created with the same custom datatype as the ones in the serialized JSON data. Otherwise, the work items will use the default data type for the node.
If preserve_index
is True
, the work item indices will be set to the value loaded from JSON. Otherwise, the work items will inherit their index from the parent
item.
If add_attributes
is True
, an the original work item name and state will be added to the new work item as attributes.
addWorkItemArrayFromJSONString(json_data, parent=None, strategy=pdg.attribCollisionStrategy.Replace, preserve_type=False, preserve_index=True, add_attributes=True)
→ list
of pdg.WorkItem
Adds work items from the json_data
, which contains an array of saved work items.
If parent
is not None
, the work items are added as dependencies of the specified work item. The work item should be one of the upstream items available during work item generation.
strategy
determines how conflicts should be resolved if the parent work item and work items in the JSON data have attributes with the same name. By default, the attributes in the JSON data replace attributes inherited from the parent.
If preserve_type
is True
, the work items will be created with the same custom datatype as the ones in the serialized JSON data. Otherwise, the work items will use the default data type for the node.
If preserve_index
is True
, the work item indices will be set to the value loaded from JSON. Otherwise, the work items will inherit their index from the parent
item.
If add_attributes
is True
, an the original work item name and state will be added to the new work item as attributes.
addWorkItemFromDict(dict, parent=None, strategy=pdg.attribCollisionStrategy.Replace, preserve_type=False, preserve_index=True, add_attributes=True)
→ pdg.WorkItem
Adds a new work item to the holder, based on the key/value pairs in the specified pdg.Dictionary.
If parent
is not None
, the work items are added as dependencies of the specified work item. The work item should be one of the upstream items available during work item generation.
strategy
determines how conflicts should be resolved if the parent work item and work items in the JSON data have attributes with the same name. By default, the attributes in the JSON data replace attributes inherited from the parent.
If preserve_type
is True
, the work items will be created with the same custom datatype as the ones in the serialized JSON data. Otherwise, the work items will use the default data type for the node.
If preserve_index
is True
, the work item indices will be set to the value loaded from JSON. Otherwise, the work items will inherit their index from the parent
item.
If add_attributes
is True
, an the original work item name and state will be added to the new work item as attributes.
addWorkItemFromJSON(json_string, parent=None, strategy=pdg.attribCollisionStrategy.Replace, preserve_type=False, preserve_index=True, add_attributes=True)
→ pdg.WorkItem
This method is deprecated, used addWorkItemFromJSONFromString
or addWorkItemFromJSONFile
instead.
addWorkItemFromJSONFile(file_path, parent=None, strategy=pdg.attribCollisionStrategy.Replace, preserve_type=False, preserve_index=True, add_attributes=True)
→ pdg.WorkItem
Adds a new work item to the holder, based on the work item JSON data stored that the specified file path.
If parent
is not None
, the work items are added as dependencies of the specified work item. The work item should be one of the upstream items available during work item generation.
strategy
determines how conflicts should be resolved if the parent work item and work items in the JSON data have attributes with the same name. By default, the attributes in the JSON data replace attributes inherited from the parent.
If preserve_type
is True
, the work items will be created with the same custom datatype as the ones in the serialized JSON data. Otherwise, the work items will use the default data type for the node.
If preserve_index
is True
, the work item indices will be set to the value loaded from JSON. Otherwise, the work items will inherit their index from the parent
item.
If add_attributes
is True
, an the original work item name and state will be added to the new work item as attributes.
addWorkItemFromJSONString(json_data, parent=None, strategy=pdg.attribCollisionStrategy.Replace, preserve_type=False, preserve_index=True, add_attributes=True)
→ pdg.WorkItem
Adds a new work item to the holder, based on the work item JSON data.
If parent
is not None
, the work items are added as dependencies of the specified work item. The work item should be one of the upstream items available during work item generation.
strategy
determines how conflicts should be resolved if the parent work item and work items in the JSON data have attributes with the same name. By default, the attributes in the JSON data replace attributes inherited from the parent.
If preserve_type
is True
, the work items will be created with the same custom datatype as the ones in the serialized JSON data. Otherwise, the work items will use the default data type for the node.
If preserve_index
is True
, the work item indices will be set to the value loaded from JSON. Otherwise, the work items will inherit their index from the parent
item.
If add_attributes
is True
, an the original work item name and state will be added to the new work item as attributes.
addWorkItemFromWorkItem(work_item, parent=None, strategy=pdg.attribCollisionStrategy.Replace, preserve_type=False, preserve_index=True, add_attributes=True)
→ pdg.WorkItem
Adds a new work item to the holder, based on the fields on the specified work_item
. The work item is added as a dependency of parent
, if it’s specified.
If parent
is not None
, the work items are added as dependencies of the specified work item. The work item should be one of the upstream items available during work item generation.
strategy
determines how conflicts should be resolved if the parent work item and work items in the JSON data have attributes with the same name. By default, the attributes in the JSON data replace attributes inherited from the parent.
If preserve_type
is True
, the work items will be created with the same custom datatype as the ones in the serialized JSON data. Otherwise, the work items will use the default data type for the node.
If preserve_index
is True
, the work item indices will be set to the value loaded from JSON. Otherwise, the work items will inherit their index from the parent
item.
If add_attributes
is True
, an the original work item name and state will be added to the new work item as attributes.
commit()
Commits work items currently in this holder and moves them into the node. The holder is reset after calling this function.
setCommitCount(count)
#cppname PDG_WorkItemHolder::setCommitCount
Sets the commit count for this holder. Once that number of work items have been added, the list of pending items is moved from the holder to the PDG node and the holder is reset.
allBatches
: list
of pdg.BatchWorkItem
Property
The array of batch work items that have been processed by this holder. Unlike the batches
method, this list is not cleared when items are committed to the node.
allWorkItems
: list
of pdg.WorkItem
Property
The array of work items that have been processed by this holder. Unlike the workItems
method, this list is not cleared when items are committed to the node.
batches
: list
of pdg.BatchWorkItem
Property
The array of batch work items currently in the holder. This list is cleared each time work items are committed.
commitCount
: int
Property
The number of work items that can be added to the holder before it copies its contents into the PDG node. Once this this value is reached the pending work items are added to the node and the holder is reset.
isEmpty
: bool
Property
True
if the holder is empty, else False
.
workItems
: list
of pdg.WorkItem
Property
The array of work items currently in the holder. This list is cleared each time work items are committed.
Methods from pdg.DependencyHolder ¶
addDependency(child, parent)
Used when this object is passed to a mapping callback on a node. Makes the child
pdg.WorkItem object depend on the parent
work item object.
Tip
The order of the arguments only matters when you're creating a dependency between two work items in the same node. Otherwise, the code will notice if you try to make an upstream item dependent on a downstream item, and flip the order for you.