HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_WorkItem Class Reference

#include <PDG_WorkItem.h>

+ Inheritance diagram for PDG_WorkItem:

Public Types

enum  PendingDirty : uint8 { ePendingNone, ePendingDirty, ePendingDelete }
 Enumeration of pending dirty states. More...
 
- Public Types inherited from PDGE_DependencyOwner
using Array = UT_Array< PDGE_DependencyOwner * >
 
using Set = UT_ArraySet< PDGE_DependencyOwner * >
 

Public Member Functions

 PDG_WorkItem (PDG_GraphContext *context, bool is_static=true, PDG_WorkItemType type=PDG_WorkItemType::eRegular, PDG_WorkItemID id=theInvalidId)
 
 ~PDG_WorkItem () override
 
const PDG_EventFiltersupportedEventTypes () const override
 Returns the list of supported event types. More...
 
int64 getMemoryUsage (bool inclusive) const override
 Returns memory usage for this work item. More...
 
virtual void memoryInfo (PDG_MemoryInfo &memory_info, bool inclusive) const
 Returns a break down of the memory used by the work item. More...
 
UT_RWLockattribGlobalLock () const override
 Returns the owning node's attribute lock. More...
 
bool attribCanWrite (const PDG_EvaluationContext *ctx) const override
 Returns true if the work item's attributes are writeable. More...
 
void attribUnlock (bool modified) const override
 Called when the attributes have been unlocked. More...
 
void attribModify (PDG_AttributeType attrib_type, const UT_StringHolder &attrib_name) const override
 Called when an attributed owned by the work item is modified. More...
 
void attribWarn (const UT_StringHolder &message) const override
 Called when an attribute operation produces a non-fatal warning. More...
 
UT_StringHolder attribOwnerName () const override
 Returns a descriptive name of the attribute owner. More...
 
void resetOwner () override
 Resets the work item's dependency objects. More...
 
UT_StringHolder debugName () const override
 
UT_StringHolder debugGroup () const override
 
PDGE_DependencycanCookDep ()
 Returns the can cook dependency object for this work item. More...
 
PDGE_DependencyisCookedDep ()
 Returns the is cooked dependency object for this work item. More...
 
PDG_WorkItemType type () const
 Returns the work item type. More...
 
PDG_WorkItemExecutionType executionType () const
 Returns the work item execution type. More...
 
PDG_WorkItemCookType cookType () const
 Returns the work item cook type. More...
 
PDG_WorkItemID id () const
 Returns the id of the work item, guaranteed to be unique. More...
 
UT_StringHolder name () const
 Returns the name of the work item, guaranteed to be unique. More...
 
bool hasCommand () const
 
bool hasPlatformCommand () const
 
const UT_StringHoldercommand () const
 Returns the generic command associated with the work item. More...
 
const UT_StringHolderplatformCommand (PDG_Platform platform=PDG_Platform::eUndefined)
 
bool shouldRunInShell () const
 Returns true if the command should run in the shell. More...
 
UT_StringHolder label () const
 Returns the label assocaited with the work item. More...
 
bool hasLabel () const
 Returns true if the work item has a custom label. More...
 
const UT_StringHoldercustomState () const
 
bool hasCustomState () const
 Returns true if the work item has a custom state string. More...
 
PDG_Nodenode () const
 Returns the node that owns the work item. More...
 
PDG_GraphContextcontext () const
 Returns the context that owns the work item. More...
 
PDG_Graphgraph () const
 Returns the graph that the work item belongs to. More...
 
PDG_BatchWorkItembatchParent () const
 
const PDG_WorkItemcloneTarget () const
 
const PDG_WorkItemparent () const
 Const acessor to the work item's parent. More...
 
const PDG_WorkItemattributeSource () const
 
int index () const
 Returns the work item index. More...
 
int internalIndex () const
 Returns the work item's internal index. More...
 
int batchIndex () const
 
int priority () const
 Returns the work item priority. More...
 
PDG_CacheID cacheId () const
 Returns the cache id of the work item. More...
 
fpreal frame () const
 Returns the work item frame. More...
 
bool hasFrame () const
 Returns true if the frame has been set. More...
 
fpreal frameStep () const
 Returns the work item step size, primarily used with batch items. More...
 
bool hasWarnings () const
 Returns true if the work item has any warning log messages. More...
 
bool isStatic () const
 Returns true if the item is a static work item. More...
 
bool isRegular () const
 Returns true if the work item is a regular item or batch item. More...
 
bool isPartition () const
 Returns true if the work item is a partition type. More...
 
bool isDynamic () const
 Returns true if the work item is a dynamic, regular work item. More...
 
bool isBatch () const
 Returns true if the work tiem is a batch. More...
 
bool isFrozen () const
 Returns true if the work item is frozen. More...
 
bool isInProcess () const
 Returns true if the work item is in process. More...
 
bool isServiceMode () const
 Returns true if the work item is marked as a service task. More...
 
bool isOutOfProcess () const
 Returns true if the work item is scheduled out of process. More...
 
bool isScheduled () const
 
bool isPostCook () const
 Returns true if the work item has post-cook logic. More...
 
bool isNoGenerate () const
 
bool isCloneOutputFiles () const
 
bool isMainThread () const
 
PDG_WorkItemState state () const
 Returns the work item cook state. More...
 
PDG_WorkItemState dependencyState () const
 
bool isCooked () const
 Returns true if the work item is in a cooked state. More...
 
bool isSuccessful () const
 Returns true if the work item is in a successful cooked state. More...
 
bool isUnsuccessful () const
 Returns true if the work item is in a unsucessful cooked state. More...
 
bool isUncooked () const
 Returns true if the work item is uncooked. More...
 
bool isUnsuccessfulDep () const
 Returns true if the work item has an unsucessful dependency. More...
 
bool isProcessing () const
 Returns true if the work item is an cooking/scheduled state. More...
 
bool isLongRunning () const
 Returns true if the work item is long running. More...
 
PDG_WorkItemEvalState evaluationState () const
 
UT_TBBSpinLockedgeLock () const
 Returns the edge lock for the work item. More...
 
const PDG_WorkItemIDMapdependenciesUnsafe () const
 
const PDG_WorkItemIDMapdependentsUnsafe () const
 
void dependencies (PDG_WorkItemConstArray &dependency_array) const
 Returns a copy of the dependencies in an array. More...
 
void dependencyIds (PDG_WorkItemIDSet &dependency_ids) const
 Returns the dependency ids in a set. More...
 
int dependencySize () const
 Returns the number of dependencies. More...
 
void dependents (PDG_WorkItemConstArray &dependent_array) const
 Returns a copy of the dependents in an array. More...
 
void dependentIds (PDG_WorkItemIDSet &dependent_ids) const
 Returns the dependent ids in a set. More...
 
void failedDependencies (PDG_WorkItemConstArray &dependecies) const
 
void visualDependencies (PDG_WorkItemSet &deps, bool expand, PDG_Scheduler *filter) const
 
void visualDependents (PDG_WorkItemSet &deps, bool expand, PDG_Scheduler *filter) const
 Inverse of the above. More...
 
const PDG_WorkItemIDBoolMaprequiredDependencies () const
 
bool partitionItems (PDG_WorkItemConstArray &components) const
 
void sortedDependencies (PDG_WorkItemConstArray &sorted_depencies, bool only_upstream=false) const
 
bool addDependency (PDG_WorkItem *work_item, bool required=false, bool user_defined=false)
 
void addRequiredDependency (const PDG_WorkItem *work_item, bool user_defined)
 
bool hasDependency (const PDG_WorkItem *work_item) const
 Checks if the work item has a given item as a dependency. More...
 
bool removeDependency (PDG_WorkItem *work_item)
 
void pushLoopInfoStack (const PDG_WorkItem *parent_item)
 Updates the loop stack, with the specified parent. More...
 
void setLoopInfoStack (const PDG_LoopInfo::Stack &loop_stack)
 Sets the loop stack contents. More...
 
PDG_WorkItemloopInfoStackEntry (int index) const
 Returns the loop stack entry at the specified index;. More...
 
int loopInfoIteration () const
 Returns the loop iteration of the work item. More...
 
int loopInfoNumber () const
 Returns the loop number of the work item. More...
 
int loopInfoSize () const
 Returns the size of the loop that contains the work item. More...
 
int loopInfoDepth () const
 Returns the loop depth of the work item. More...
 
PDG_WorkItemID loopInfoLock () const
 Returns the loop service lock ID of the work item. More...
 
const PDG_LoopInfo::StackloopInfoStack () const
 Returns the loop stack for this work item. More...
 
bool compareLoopInfoStack (const PDG_WorkItem *other) const
 
void setIsPostCook (bool postcook)
 Sets the is post cook flag. More...
 
void setIsNoGenerate (bool no_gen)
 Sets the work item no generate flag. More...
 
void setIsCloneOutputFiles (bool clone)
 Sets the work item's clone output files flag. More...
 
bool setState (PDG_WorkItemState state, bool emit=true)
 Sets the work item state. More...
 
void setIsFrozen (bool is_frozen)
 Sets the frozen flag on the work item. More...
 
void setExecutionType (PDG_WorkItemExecutionType execution_type)
 Sets the execution type of the work item. More...
 
void setCookType (PDG_WorkItemCookType cook_type)
 Sets the cook type for the work item. More...
 
bool wasModified () const
 Returns the work item's modified flag. More...
 
void setIndex (int index)
 Sets the work item index. More...
 
void setInternalIndex (int index)
 Sets the work items internal index, used for dirtying. More...
 
void setPriority (int priority, bool emit=true)
 Sets the work item priority. More...
 
void boostPriority ()
 
bool clearFrame ()
 
bool setFrame (fpreal frame)
 
bool setFrame (fpreal frame, fpreal frame_step)
 
void setNode (PDG_Node *node, bool emit)
 Sets the work item node. More...
 
virtual void setPendingDirty (PendingDirty pending)
 Sets the pending dirty flag on the work item, used for regeneration. More...
 
void startRegenerating ()
 Called when the work item should begin regenerating. More...
 
PendingDirty doneRegenerating ()
 
void setCloneTarget (const PDG_WorkItem *clone_target)
 
void setBatchInfo (PDG_BatchWorkItem *item, int index, int batch_index, int priority)
 
void setLoopInfo (int iteration, int number, int size, PDG_WorkItemID service_lock=theInvalidId)
 
void setCommand (const UT_StringHolder &command, bool shell=false)
 Sets the work item command directly. More...
 
void setPlatformCommands (const UT_StringHolder &linux, const UT_StringHolder &mac, const UT_StringHolder &windows, bool shell=false)
 Sets a per-platform work item command. More...
 
void setLabel (const UT_StringHolder &label)
 Sets the work item label. More...
 
void clearLabel ()
 Clears the work item label. More...
 
void setCustomState (const UT_StringHolder &state)
 
void clearCustomState ()
 Clears the custom state string. More...
 
bool hasCookPercent () const
 
fpreal cookPercent () const
 
void setCookPercent (const fpreal &cook_percent)
 
template<typename... Args>
void addErrorFmt (const char *fmt, Args &&...args) const
 
void addError (const UT_StringHolder &log, bool timestamp=true) const
 
template<typename... Args>
void addWarningFmt (const char *fmt, Args &&...args) const
 
void addWarning (const UT_StringHolder &log, bool timestamp=true, int verbosity=0) const
 
template<typename... Args>
void addMessageFmt (const char *fmt, Args &&...args) const
 
void addMessage (const UT_StringHolder &log, bool timestamp=true, int verbosity=0) const
 Appends a plain message to the work item's in process log buffer. More...
 
void addLog (PDG_WorkItemLogType type, const UT_StringHolder &log, bool timestamp=true, int verbosity=0) const
 Appends text data to the log with the given log type. More...
 
const UT_WorkBufferlogMessages () const
 Returns the current in process log buffer. More...
 
void appPath (UT_WorkBuffer &buffer) const
 Returns the application path to the work item, e.g. /node/workitem. More...
 
void dirty (bool should_delete, bool remove_outputs)
 
PDG_WorkItemDirty prepareDirty (bool should_delete)
 
void cancel ()
 Cancels the work item's execution, if it's running with a scheduler. More...
 
void freeze ()
 
void invalidateCache ()
 Invalidates the file cache of this work item. More...
 
void syncData (bool force_recursive)
 Syncs work item data with its parent. More...
 
PDG_WorkItemDatadata () const
 
void setData (PDG_WorkItemDataPtr data)
 
bool compareDataType (const PDG_BaseType *other_type, bool deep=true) const
 
SYS_HashType hash () const
 
PDG_AttributeCast numericData (fpreal &param, const PDG_AttributeEvaluator &evaluator, fpreal frame, int thread) const
 Does a numeric data lookup, for use with the @ operator. More...
 
PDG_AttributeCast stringData (UT_WorkBuffer &buffer, const PDG_AttributeEvaluator &evaluator, fpreal frame, int thread) const
 Does a string data lookup, for use with the @ operator. More...
 
UT_StringHolder serializeData () const
 Serialization of underlying PDG_WorkItemData object. More...
 
bool serializeDataToFile (const UT_StringHolder &file) const
 
bool compare (PDG_WorkItem *item) const
 Compares the work item with another item. More...
 
bool uiSelect (bool select)
 Runs selection logic from selecting a work item in TOPs. More...
 
bool hasOutputFiles () const
 Returns true if the work item has at least one output file. More...
 
virtual PDG_WorkItemCacheState outputCacheState () const
 Returns the output file cache state of this work item. More...
 
bool outputFiles (PDG_File::Array &files) const
 
bool localizedOutputFiles (PDG_File::Array &files) const
 
UT_StringHolder tempDir () const
 
bool outputFilesForTag (PDG_File::Array &files, const UT_StringHolder &tag, bool include_expected=false) const
 Returns all output files that are a substring-match for the given tag. More...
 
UT_StringHolder localizePath (const UT_StringHolder &path) const
 
UT_StringHolder firstOutputFileForTag (const UT_StringHolder &tag) const
 
bool expectedOutputFiles (PDG_File::Array &files) const
 Returns the list of expected output files. More...
 
void addExpectedOutputFile (const UT_StringHolder &path, const UT_StringHolder &tag, bool own)
 Adds an expected output file to the work item. More...
 
void addExpectedOutputFiles (const UT_StringArray &paths, const UT_StringHolder &tag, bool own)
 Adds an array of expected output file paths to the work item. More...
 
void addExpectedOutputFile (const PDG_File &file)
 Adds an expected output file to the work item. More...
 
void addOutputFile (const UT_StringHolder &path, const UT_StringHolder &tag, PDG_File::Hash hash_code, bool own)
 Appends the given output file to the work item. More...
 
void addOutputFiles (const UT_StringArray &paths, const UT_StringHolder &tag, const PDG_File::HashArray &hashes, bool own)
 
void addOutputFiles (const UT_StringArray &paths, const UT_StringArray &tags, const PDG_File::HashArray &hashes, bool own)
 
void updateOutputFile (int index, const UT_StringHolder &path, const UT_StringHolder &tag, PDG_File::Hash hash_code, bool owner)
 Replaces the output file at the given index, if that index is valid. More...
 
void inputFiles (PDG_File::Array &files, bool include_expected) const
 Returns the input files for immediate dependencies. More...
 
bool inputFilesForTag (PDG_File::Array &files, const UT_StringHolder &tag, bool include_expected=false) const
 Returns all input files that are a substring-match for the given tag. More...
 
bool validateOutputFiles ()
 Checks if the work items output files are valid, e.g. they exist. More...
 
bool transferFiles (bool update_cache)
 
void clearOutputFiles ()
 Clears all output files. More...
 
void clearExpectedOutputFiles ()
 Clears expected outputs. More...
 
void clearRuntimeOutputFiles ()
 
void clearEnvironment ()
 
bool addEnvironmentVar (const UT_StringHolder &var_name, const PDGT_Value &value, UT_WorkBuffer &errors)
 Adds an environment variable and value to this work items env var map. More...
 
bool hasEnvironmentVar (const UT_StringHolder &var_name) const
 Returns true if the work item has the specified env var. More...
 
void globEnvironment (PDGT_Value::Map &environment) const
 
bool envLookup (const char *key, PDGT_Value &value) const
 Looks up a key in the environment, returns true if the key exists. More...
 
void addNodeWarning (const UT_StringHolder &message) const
 Adds a warning to the owning node. More...
 
bool startSubItem (bool wait, UT_WorkBuffer &errors)
 
bool checkSubItem (UT_WorkBuffer &errors)
 Returns true if the sub item is ready. More...
 
bool startWorkItem ()
 
bool cookSubItem (PDG_WorkItemState state, fpreal duration)
 Marks the work item as cooked, if it is an in-process batch item. More...
 
PDG_Schedulerscheduler () const
 
bool isScheduledBy (PDG_Scheduler *scheduler) const
 Returns true if the work item is schduled by the specified schduler. More...
 
void performanceEvent () const
 Reports a performance monitor event for this work item. More...
 
virtual fpreal setTimeStat (PDG_WorkItemStats::StatType stat, bool batched)
 Sets a stat to the current time. More...
 
const PDG_WorkItemStatsstats () const
 Returns the perf stats object for the work item. More...
 
PDG_WorkItemStatsstats ()
 
void varReplace (const char *input, UT_WorkBuffer &output) const
 
bool saveJSONFile (const UT_StringHolder &path, bool pretty_print, bool global_attributes, bool skip_defaults) const
 Saves the work item to a .json file or string. More...
 
UT_StringHolder saveJSONString (bool pretty_print, bool global_attributes, bool skip_defaults) const
 
UT_OptionsHolder saveDict (bool global_attributes, bool skip_defaults) const
 Saves the work item to a UT_OptionsHolder. More...
 
UT_StringHolder createJSONPatch (bool pretty_print) const
 Creates a JSON patch from the work item as a string. More...
 
- Public Member Functions inherited from PDG_EventEmitter
 PDG_EventEmitter (PDG_EventQueue *event_queue, bool block_destruction)
 
virtual ~PDG_EventEmitter ()
 
int64 getMemoryUsage (bool inclusive) const
 Returns memory usage for this event emitter instance. More...
 
bool addEventHandler (PDG_EventHandler *handler)
 Adds an event handlers that listens for all types of events. More...
 
bool addEventHandler (PDG_EventHandler *handler, PDG_EventType event)
 Adds an event handlers that listens for a specific event. More...
 
bool addEventHandler (PDG_EventHandler *handler, const PDG_EventFilter &filter)
 
void removeEventHandler (PDG_EventHandler *handler)
 Removes an event handler from this emitter. More...
 
void removeAllEventHandlers (bool user_handler_only=false)
 
void emitEvent (const PDG_Event &event, bool immediate=false) const
 Emit an event to all handlers. More...
 
void eventHandlers (PDG_EventHandlerArray &handlers) const
 
void setEventQueue (PDG_EventQueue *event_queue)
 
void clearEventQueue ()
 
bool shouldEmit (const PDG_Event &event) const
 
- Public Member Functions inherited from PDG_AttributeOwner
 PDG_AttributeOwner (bool has_runtime)
 
virtual ~PDG_AttributeOwner ()
 
PDG_AttributeMapattributes ()
 
const PDG_AttributeMapattributes () const
 
bool attribSaveJSON (std::ostream &os, bool binary) const
 
bool attribSaveJSON (const UT_StringHolder &file_path) const
 
bool attribLoadJSON (UT_IStream &istream, PDG_AttributeCollision strategy)
 
bool attribLoadJSON (const UT_StringHolder &file_path, PDG_AttributeCollision strategy)
 
bool hasAttributes () const
 
virtual bool isAttribFlagValid (PDG_AttributeFlag flag) const
 
virtual bool areAttribFlagsValid (uint16 flags) const
 
- Public Member Functions inherited from PDGE_DependencyOwner
 PDGE_DependencyOwner ()
 Constructs a new dependency owner, which must have a string name. More...
 
virtual ~PDGE_DependencyOwner ()
 

Static Public Member Functions

static bool saveArrayJSONFile (const UT_StringHolder &path, const PDG_WorkItemArray &items, bool pretty_print, bool global_attributes, bool skip_defaults)
 Saves the array of work items to a .json file or string. More...
 
static UT_StringHolder saveArrayJSONString (const PDG_WorkItemArray &items, bool pretty_print, bool global_attributes, bool skip_defaults)
 
static UT_OptionsHolder saveArrayDict (const PDG_WorkItemArray &items, bool global_attributes, bool skip_defaults)
 Saves the list of work items to a UT_OptionsHolder. More...
 
static PDG_WorkItemloadJSONFile (const UT_StringHolder &path, bool make_active, UT_WorkBuffer &errors)
 Loads a work item from a .json file or string. More...
 
static PDG_WorkItemloadJSONString (const UT_StringHolder &data, bool make_active, UT_WorkBuffer &errors)
 
- Static Public Member Functions inherited from PDGE_DependencyOwner
template<typename T >
static void cast (UT_Array< T > &out, const Array &in)
 Converts an owner array to an array of the specified type. More...
 
template<typename T >
static void cast (Array &out, const UT_Array< T > &in)
 Converts an array of the specified type to an owner array. More...
 

Static Public Attributes

static constexpr PDG_WorkItemID theInvalidId = -1
 Default, invalid work item ID value. More...
 

Protected Member Functions

void prepareDirty (PDG_WorkItemDirty &dirty_state, bool is_delete, bool is_dirty_data) const
 
void applyDirty (const PDG_WorkItemDirty &dirty_state, bool remove_outputs)
 Applies a dirty operation that was stored to the dirty state. More...
 
void handleDirty (const UT_ArrayStringSet &keep_set, bool should_delete, bool remove_outputs)
 Runs custom dirty handlers and deletes output files. More...
 
void ownedFiles (PDG_File::Set &files, bool include_expected) const
 Returns the list of files owned by this work item. More...
 
void updateCacheId (PDG_CacheID cache_id)
 
PDGE_Dependency::State evalResolve (PDGE_Resolutions &resolutions, const PDGE_Evaluator &evaluator, PDGE_Dependency *dependency) override
 
int evalUnresolve (PDGE_Dependency::Array &extras, PDGE_Dependency *dependency) override
 
virtual PDG_WorkItemState checkCached (bool add_outputs)
 
bool upgradeExpectedOutputFiles (bool check_disk, bool clear)
 Upgrades expected outputs to runtime outputs for this work item. More...
 
void postCook (PDGE_Resolutions &resolutions, PDG_WorkItemState result, int batch_index, fpreal duration, bool notify_all, bool static_cook, bool unresolve)
 Called by the scheduler to mark out of process items as cooked. More...
 
virtual void notifyCook (PDGE_Resolutions &resolutions, PDG_WorkItemState result, int batch_index, fpreal duration, bool notify_all, bool static_cook, bool unresolve)
 Notifies this work item that is has cooked. More...
 
virtual void syncCacheId ()
 Syncs a work item's cache with its dependents. More...
 
bool cook ()
 Does an inprocess cook of the work item, returning true on success. More...
 
virtual bool setFrame (fpreal frame, fpreal frame_step, bool check_dirty)
 Internal method for setting the frame. More...
 
void inheritParent (const PDG_WorkItem *work_item)
 
- Protected Member Functions inherited from PDGE_DependencyOwner
virtual PDGE_Dependency::State evalPartial (PDGE_Resolutions &, const PDGE_Evaluator &, PDGE_Dependency *, const Array &)
 
const PDGE_Dependency::SetpropagateSet ()
 Returns the propagate set for this owner. More...
 
void addPropagate (PDGE_Dependency *dependency)
 Adds an entry to the propagate set. More...
 

Protected Attributes

PDGE_Dependency myCanCookDep
 
PDGE_Dependency myIsCookedDep
 
PDG_WorkItemStats myStats
 
PDG_WorkItemIDMap myDependencies
 
PDG_WorkItemIDMap myDependents
 
PDG_WorkItemIDBoolMap myRequiredDependencies
 
PDG_LoopInfo::Stack myLoopInfoStack
 
UT_WorkBuffer myLogMessages
 
PDG_NodemyNode
 
PDG_GraphContextmyContext
 
PDG_BatchWorkItemmyBatchParent
 
const PDG_WorkItemmyCloneTarget
 
PDG_WorkItemDataPtr myData
 
fpreal myFrame
 
fpreal myFrameStep
 
PDG_WorkItemID myId
 
int myIndex
 
int myBatchIndex
 
int myPriority
 
int myInternalIndex
 
PDG_CacheID myCacheId
 
PDG_WorkItemType myType
 
PDG_WorkItemExecutionType myExecutionType
 
PDG_WorkItemCookType myCookType
 
PendingDirty myPendingDirty
 
PDG_WorkItemState myState
 
PDG_WorkItemState myDepState
 
UT_TBBSpinLock myEdgeLock
 
bool myHasFrame:1
 
bool myHasWarnings:1
 
bool myAttributesDirty:1
 
bool myWasModified:1
 
bool myDidCook:1
 
bool myIsPostCook:1
 
bool myIsStatic:1
 
bool myIsNoGenerate:1
 
bool myIsCloneOutputFiles:1
 
bool myIsFrozen:1
 
bool myIsBatchReady:1
 
- Protected Attributes inherited from PDG_AttributeOwner
PDG_AttributeMap myAttributes
 

Friends

class PDG_BatchWorkItem
 
class PDG_Scheduler
 
class PDG_WorkItemHolder
 
class PDG_WorkItemDirty
 

Detailed Description

Member Enumeration Documentation

Enumeration of pending dirty states.

Enumerator
ePendingNone 

The item does not require any sort of dirtying.

ePendingDirty 

The item needs to be dirtied, but not deleted.

ePendingDelete 

the item needs to be deleted

Definition at line 55 of file PDG_WorkItem.h.

Constructor & Destructor Documentation

PDG_WorkItem::PDG_WorkItem ( PDG_GraphContext context,
bool  is_static = true,
PDG_WorkItemType  type = PDG_WorkItemType::eRegular,
PDG_WorkItemID  id = theInvalidId 
)

Constructs and initialize a new work item. This method will get a unique id for the item from the PDG_Graph, unless a valid id is passed in

PDG_WorkItem::~PDG_WorkItem ( )
override

Deletes this work item. Does not delete any dependencies or remove references in other items or node. The appropriate dirty method must be called first.

Member Function Documentation

bool PDG_WorkItem::addDependency ( PDG_WorkItem work_item,
bool  required = false,
bool  user_defined = false 
)

Adds a dependency to the work item, and a corresponding dependent back pointer to the incoming item.

Returns false if the dependency already exists, and returns true if the dependency does not

bool PDG_WorkItem::addEnvironmentVar ( const UT_StringHolder var_name,
const PDGT_Value value,
UT_WorkBuffer errors 
)

Adds an environment variable and value to this work items env var map.

void PDG_WorkItem::addError ( const UT_StringHolder log,
bool  timestamp = true 
) const
inline

Appends a plain error message to the work item's in process log buffer

Examples:
PDG/PDG_ProcessorRandom.C.

Definition at line 622 of file PDG_WorkItem.h.

template<typename... Args>
void PDG_WorkItem::addErrorFmt ( const char *  fmt,
Args &&...  args 
) const
inline

Appends a formatted error message to the work item's in process log buffer

Definition at line 608 of file PDG_WorkItem.h.

void PDG_WorkItem::addExpectedOutputFile ( const UT_StringHolder path,
const UT_StringHolder tag,
bool  own 
)

Adds an expected output file to the work item.

void PDG_WorkItem::addExpectedOutputFile ( const PDG_File file)

Adds an expected output file to the work item.

void PDG_WorkItem::addExpectedOutputFiles ( const UT_StringArray paths,
const UT_StringHolder tag,
bool  own 
)

Adds an array of expected output file paths to the work item.

void PDG_WorkItem::addLog ( PDG_WorkItemLogType  type,
const UT_StringHolder log,
bool  timestamp = true,
int  verbosity = 0 
) const

Appends text data to the log with the given log type.

void PDG_WorkItem::addMessage ( const UT_StringHolder log,
bool  timestamp = true,
int  verbosity = 0 
) const
inline

Appends a plain message to the work item's in process log buffer.

Definition at line 680 of file PDG_WorkItem.h.

template<typename... Args>
void PDG_WorkItem::addMessageFmt ( const char *  fmt,
Args &&...  args 
) const
inline

Appends a formatted message to the work item's in process log buffer

Definition at line 667 of file PDG_WorkItem.h.

void PDG_WorkItem::addNodeWarning ( const UT_StringHolder message) const

Adds a warning to the owning node.

void PDG_WorkItem::addOutputFile ( const UT_StringHolder path,
const UT_StringHolder tag,
PDG_File::Hash  hash_code,
bool  own 
)

Appends the given output file to the work item.

void PDG_WorkItem::addOutputFiles ( const UT_StringArray paths,
const UT_StringHolder tag,
const PDG_File::HashArray hashes,
bool  own 
)

Appends the given array of output files to the work item. If the length of the hashes array is less than the paths, a default value of 0 will be used for paths without a corresponding hash code. I.e an empty hash array can be passed in to use 0 for each file. Assumes that the same tag is used for all work items

void PDG_WorkItem::addOutputFiles ( const UT_StringArray paths,
const UT_StringArray tags,
const PDG_File::HashArray hashes,
bool  own 
)

Appends the given array of output files to the work item. If the length of the hashes or tags array is less than the paths, a default value of 0 and "" are used respectively.

void PDG_WorkItem::addRequiredDependency ( const PDG_WorkItem work_item,
bool  user_defined 
)

Marks an existing dependency as a required dep. The work item passed in must already be a dependency

void PDG_WorkItem::addWarning ( const UT_StringHolder log,
bool  timestamp = true,
int  verbosity = 0 
) const
inline

Appends a plain warning message to the work item's in process log buffer

Definition at line 651 of file PDG_WorkItem.h.

template<typename... Args>
void PDG_WorkItem::addWarningFmt ( const char *  fmt,
Args &&...  args 
) const
inline

Appends a formatted warning message to the work item's in process log buffer

Definition at line 636 of file PDG_WorkItem.h.

void PDG_WorkItem::applyDirty ( const PDG_WorkItemDirty dirty_state,
bool  remove_outputs 
)
protected

Applies a dirty operation that was stored to the dirty state.

void PDG_WorkItem::appPath ( UT_WorkBuffer buffer) const

Returns the application path to the work item, e.g. /node/workitem.

bool PDG_WorkItem::attribCanWrite ( const PDG_EvaluationContext ctx) const
overridevirtual

Returns true if the work item's attributes are writeable.

Reimplemented from PDG_AttributeOwner.

UT_RWLock* PDG_WorkItem::attribGlobalLock ( ) const
overridevirtual

Returns the owning node's attribute lock.

Reimplemented from PDG_AttributeOwner.

void PDG_WorkItem::attribModify ( PDG_AttributeType  attrib_type,
const UT_StringHolder attrib_name 
) const
overridevirtual

Called when an attributed owned by the work item is modified.

Reimplemented from PDG_AttributeOwner.

UT_StringHolder PDG_WorkItem::attribOwnerName ( ) const
overridevirtual

Returns a descriptive name of the attribute owner.

Reimplemented from PDG_AttributeOwner.

void PDG_WorkItem::attribUnlock ( bool  modified) const
overridevirtual

Called when the attributes have been unlocked.

Reimplemented from PDG_AttributeOwner.

const PDG_WorkItem* PDG_WorkItem::attributeSource ( ) const

Returns the work item that this work item copied its attributes from. If the work item is a partition, this method returns nullptr.

void PDG_WorkItem::attribWarn ( const UT_StringHolder message) const
overridevirtual

Called when an attribute operation produces a non-fatal warning.

Reimplemented from PDG_AttributeOwner.

int PDG_WorkItem::batchIndex ( ) const
inline

Returns the work items index within its batch, or -1 if the work item is not in a batch

Definition at line 229 of file PDG_WorkItem.h.

PDG_BatchWorkItem* PDG_WorkItem::batchParent ( ) const
inline

Returns the batch item that owns the work item, or nullptr if the item is not in a batch

Definition at line 203 of file PDG_WorkItem.h.

void PDG_WorkItem::boostPriority ( )

Boosts the priority of the work item and its dependencies, if they have not yet started to cook

PDG_CacheID PDG_WorkItem::cacheId ( ) const
inline

Returns the cache id of the work item.

Definition at line 238 of file PDG_WorkItem.h.

void PDG_WorkItem::cancel ( )

Cancels the work item's execution, if it's running with a scheduler.

PDGE_Dependency* PDG_WorkItem::canCookDep ( )
inline

Returns the can cook dependency object for this work item.

Definition at line 128 of file PDG_WorkItem.h.

virtual PDG_WorkItemState PDG_WorkItem::checkCached ( bool  add_outputs)
protectedvirtual

Called when an item is about to be scheduled, to check if it has cached outputs on disk. Returns Uncooked if the item is not cached and should cook, Failure if the read files mode fails, or CookedCache if the item is cooked from cache.

Reimplemented in PDG_BatchWorkItem.

bool PDG_WorkItem::checkSubItem ( UT_WorkBuffer errors)

Returns true if the sub item is ready.

void PDG_WorkItem::clearCustomState ( )

Clears the custom state string.

void PDG_WorkItem::clearEnvironment ( )

Sets the clear environment flagging, effectively stopping any upstream env vars from being considered beyond this work item

void PDG_WorkItem::clearExpectedOutputFiles ( )

Clears expected outputs.

bool PDG_WorkItem::clearFrame ( )

Sets the work item frame. This methods takes a step size since it gets overridden by batch work items to initialize the frame of each sub item as frame + index*step_size;

void PDG_WorkItem::clearLabel ( )

Clears the work item label.

void PDG_WorkItem::clearOutputFiles ( )

Clears all output files.

void PDG_WorkItem::clearRuntimeOutputFiles ( )

Clears output files added during the cook. Note that this method is only safe to call if the item has not yet been marked as cooked.

const PDG_WorkItem* PDG_WorkItem::cloneTarget ( ) const
inline

Returns the clone target for the work item, or nullptr if a specific target was not set

Definition at line 208 of file PDG_WorkItem.h.

const UT_StringHolder& PDG_WorkItem::command ( ) const

Returns the generic command associated with the work item.

bool PDG_WorkItem::compare ( PDG_WorkItem item) const

Compares the work item with another item.

bool PDG_WorkItem::compareDataType ( const PDG_BaseType other_type,
bool  deep = true 
) const
bool PDG_WorkItem::compareLoopInfoStack ( const PDG_WorkItem other) const

Compares the loop info stack of another work item with this one, returning true if they put in the same partition or false if they're from independent loops.

PDG_GraphContext* PDG_WorkItem::context ( ) const
inline

Returns the context that owns the work item.

Definition at line 194 of file PDG_WorkItem.h.

bool PDG_WorkItem::cook ( )
protected

Does an inprocess cook of the work item, returning true on success.

fpreal PDG_WorkItem::cookPercent ( ) const
bool PDG_WorkItem::cookSubItem ( PDG_WorkItemState  state,
fpreal  duration 
)

Marks the work item as cooked, if it is an in-process batch item.

PDG_WorkItemCookType PDG_WorkItem::cookType ( ) const
inline

Returns the work item cook type.

Definition at line 144 of file PDG_WorkItem.h.

UT_StringHolder PDG_WorkItem::createJSONPatch ( bool  pretty_print) const

Creates a JSON patch from the work item as a string.

const UT_StringHolder& PDG_WorkItem::customState ( ) const

Returns the custom state string associated with the work item, if one has be set.

PDG_WorkItemData* PDG_WorkItem::data ( ) const

Getter/setter for the backing work item data object, which might be a user defined class

UT_StringHolder PDG_WorkItem::debugGroup ( ) const
overridevirtual

Returns the debug group for this work item, used by PDGE for outputting a DOT graph.

Reimplemented from PDGE_DependencyOwner.

UT_StringHolder PDG_WorkItem::debugName ( ) const
inlineoverridevirtual

Returns the debug name for this work item, used by PDGE for logging and debuggin features

Implements PDGE_DependencyOwner.

Definition at line 119 of file PDG_WorkItem.h.

void PDG_WorkItem::dependencies ( PDG_WorkItemConstArray dependency_array) const

Returns a copy of the dependencies in an array.

const PDG_WorkItemIDMap& PDG_WorkItem::dependenciesUnsafe ( ) const

Returns the dependencies, e.g. work items that this item depends on. Not thread safe.

void PDG_WorkItem::dependencyIds ( PDG_WorkItemIDSet dependency_ids) const

Returns the dependency ids in a set.

int PDG_WorkItem::dependencySize ( ) const

Returns the number of dependencies.

PDG_WorkItemState PDG_WorkItem::dependencyState ( ) const
inline

Returns the worst dependency state, e.g. if any of the deps have failed or canceled.

Definition at line 336 of file PDG_WorkItem.h.

void PDG_WorkItem::dependentIds ( PDG_WorkItemIDSet dependent_ids) const

Returns the dependent ids in a set.

void PDG_WorkItem::dependents ( PDG_WorkItemConstArray dependent_array) const

Returns a copy of the dependents in an array.

const PDG_WorkItemIDMap& PDG_WorkItem::dependentsUnsafe ( ) const

Returns the dependents, e.g. work items that depend on this item. Not thread safe.

void PDG_WorkItem::dirty ( bool  should_delete,
bool  remove_outputs 
)

Dirties the work item by initiating a dirty operation from the graph. Probably the method you want to call to dirty the item if you aren't working in $PDG directly

PendingDirty PDG_WorkItem::doneRegenerating ( )

Called when the work item is finished regenerating, in order to determine if it needs to be deleted or dirtied

UT_TBBSpinLock& PDG_WorkItem::edgeLock ( ) const
inline

Returns the edge lock for the work item.

Definition at line 366 of file PDG_WorkItem.h.

bool PDG_WorkItem::envLookup ( const char *  key,
PDGT_Value value 
) const

Looks up a key in the environment, returns true if the key exists.

PDGE_Dependency::State PDG_WorkItem::evalResolve ( PDGE_Resolutions resolutions,
const PDGE_Evaluator evaluator,
PDGE_Dependency dependency 
)
overrideprotectedvirtual

Called when one of the dependencies owned by this work item is resolved.

Reimplemented from PDGE_DependencyOwner.

PDG_WorkItemEvalState PDG_WorkItem::evaluationState ( ) const

Returns an enum indicating if work item is ready to cook, blocked, or has failed dependencies

int PDG_WorkItem::evalUnresolve ( PDGE_Dependency::Array extras,
PDGE_Dependency dependency 
)
overrideprotectedvirtual

Called when one of the dependencies owned by this work item is unresolved;

Reimplemented from PDGE_DependencyOwner.

PDG_WorkItemExecutionType PDG_WorkItem::executionType ( ) const
inline

Returns the work item execution type.

Definition at line 140 of file PDG_WorkItem.h.

bool PDG_WorkItem::expectedOutputFiles ( PDG_File::Array files) const

Returns the list of expected output files.

void PDG_WorkItem::failedDependencies ( PDG_WorkItemConstArray dependecies) const

Returns the root failed dependencies for this work item. This doesn't include intermediate tasks in the dep chain that also failed because of the same upstream failure

UT_StringHolder PDG_WorkItem::firstOutputFileForTag ( const UT_StringHolder tag) const

Returns the first output file that is a substring-match for the given tag

fpreal PDG_WorkItem::frame ( ) const
inline

Returns the work item frame.

Definition at line 242 of file PDG_WorkItem.h.

fpreal PDG_WorkItem::frameStep ( ) const
inline

Returns the work item step size, primarily used with batch items.

Definition at line 250 of file PDG_WorkItem.h.

void PDG_WorkItem::freeze ( )

Freezes the attributes of the work item and clears out all references to upstream work items and data.

int64 PDG_WorkItem::getMemoryUsage ( bool  inclusive) const
overridevirtual

Returns memory usage for this work item.

Reimplemented from PDGE_DependencyOwner.

void PDG_WorkItem::globEnvironment ( PDGT_Value::Map environment) const

Globs the full set of environment variables for this work item by searching through it's parents.

PDG_Graph* PDG_WorkItem::graph ( ) const

Returns the graph that the work item belongs to.

void PDG_WorkItem::handleDirty ( const UT_ArrayStringSet keep_set,
bool  should_delete,
bool  remove_outputs 
)
protected

Runs custom dirty handlers and deletes output files.

bool PDG_WorkItem::hasCommand ( ) const

Returns true if the work item has a command line string set, for any platform

bool PDG_WorkItem::hasCookPercent ( ) const
bool PDG_WorkItem::hasCustomState ( ) const

Returns true if the work item has a custom state string.

bool PDG_WorkItem::hasDependency ( const PDG_WorkItem work_item) const

Checks if the work item has a given item as a dependency.

bool PDG_WorkItem::hasEnvironmentVar ( const UT_StringHolder var_name) const

Returns true if the work item has the specified env var.

bool PDG_WorkItem::hasFrame ( ) const
inline

Returns true if the frame has been set.

Definition at line 246 of file PDG_WorkItem.h.

SYS_HashType PDG_WorkItem::hash ( ) const
bool PDG_WorkItem::hasLabel ( ) const

Returns true if the work item has a custom label.

bool PDG_WorkItem::hasOutputFiles ( ) const

Returns true if the work item has at least one output file.

bool PDG_WorkItem::hasPlatformCommand ( ) const

Returns true if the work item has platform-specific command line strings

bool PDG_WorkItem::hasWarnings ( ) const
inline

Returns true if the work item has any warning log messages.

Definition at line 254 of file PDG_WorkItem.h.

PDG_WorkItemID PDG_WorkItem::id ( ) const
inline

Returns the id of the work item, guaranteed to be unique.

Definition at line 148 of file PDG_WorkItem.h.

int PDG_WorkItem::index ( ) const
inline

Returns the work item index.

Definition at line 220 of file PDG_WorkItem.h.

void PDG_WorkItem::inheritParent ( const PDG_WorkItem work_item)
protected

Adds a parent and copies attributes by inheriting them from the parent of another work item. This is used for generating dynamic sub items in a batch, and copying the parent information from the last batch item onto the new item

void PDG_WorkItem::inputFiles ( PDG_File::Array files,
bool  include_expected 
) const

Returns the input files for immediate dependencies.

bool PDG_WorkItem::inputFilesForTag ( PDG_File::Array files,
const UT_StringHolder tag,
bool  include_expected = false 
) const

Returns all input files that are a substring-match for the given tag.

int PDG_WorkItem::internalIndex ( ) const
inline

Returns the work item's internal index.

Definition at line 224 of file PDG_WorkItem.h.

void PDG_WorkItem::invalidateCache ( )

Invalidates the file cache of this work item.

bool PDG_WorkItem::isBatch ( ) const

Returns true if the work tiem is a batch.

bool PDG_WorkItem::isCloneOutputFiles ( ) const
inline

Returns true if the work item is marked as needing to clone output files from its parent

Definition at line 322 of file PDG_WorkItem.h.

bool PDG_WorkItem::isCooked ( ) const

Returns true if the work item is in a cooked state.

PDGE_Dependency* PDG_WorkItem::isCookedDep ( )
inline

Returns the is cooked dependency object for this work item.

Definition at line 132 of file PDG_WorkItem.h.

bool PDG_WorkItem::isDynamic ( ) const

Returns true if the work item is a dynamic, regular work item.

bool PDG_WorkItem::isFrozen ( ) const
inline

Returns true if the work item is frozen.

Definition at line 274 of file PDG_WorkItem.h.

bool PDG_WorkItem::isInProcess ( ) const
inline

Returns true if the work item is in process.

Definition at line 278 of file PDG_WorkItem.h.

bool PDG_WorkItem::isLongRunning ( ) const

Returns true if the work item is long running.

bool PDG_WorkItem::isMainThread ( ) const

Returns true if the work item has to cook on the main thread, when it cooks in process. This is determined by the script info from the owning node

bool PDG_WorkItem::isNoGenerate ( ) const
inline

Returns true if the work item is flagged as not being allowed to generate child items.

Definition at line 317 of file PDG_WorkItem.h.

bool PDG_WorkItem::isOutOfProcess ( ) const
inline

Returns true if the work item is scheduled out of process.

Definition at line 288 of file PDG_WorkItem.h.

bool PDG_WorkItem::isPartition ( ) const

Returns true if the work item is a partition type.

bool PDG_WorkItem::isPostCook ( ) const
inline

Returns true if the work item has post-cook logic.

Definition at line 312 of file PDG_WorkItem.h.

bool PDG_WorkItem::isProcessing ( ) const

Returns true if the work item is an cooking/scheduled state.

bool PDG_WorkItem::isRegular ( ) const

Returns true if the work item is a regular item or batch item.

bool PDG_WorkItem::isScheduled ( ) const
inline

Returns true if the work item is scheduled (either service, in, or out of process).

Definition at line 294 of file PDG_WorkItem.h.

bool PDG_WorkItem::isScheduledBy ( PDG_Scheduler scheduler) const

Returns true if the work item is schduled by the specified schduler.

bool PDG_WorkItem::isServiceMode ( ) const
inline

Returns true if the work item is marked as a service task.

Definition at line 283 of file PDG_WorkItem.h.

bool PDG_WorkItem::isStatic ( ) const
inline

Returns true if the item is a static work item.

Definition at line 258 of file PDG_WorkItem.h.

bool PDG_WorkItem::isSuccessful ( ) const

Returns true if the work item is in a successful cooked state.

bool PDG_WorkItem::isUncooked ( ) const

Returns true if the work item is uncooked.

bool PDG_WorkItem::isUnsuccessful ( ) const

Returns true if the work item is in a unsucessful cooked state.

bool PDG_WorkItem::isUnsuccessfulDep ( ) const

Returns true if the work item has an unsucessful dependency.

UT_StringHolder PDG_WorkItem::label ( ) const

Returns the label assocaited with the work item.

static PDG_WorkItem* PDG_WorkItem::loadJSONFile ( const UT_StringHolder path,
bool  make_active,
UT_WorkBuffer errors 
)
static

Loads a work item from a .json file or string.

static PDG_WorkItem* PDG_WorkItem::loadJSONString ( const UT_StringHolder data,
bool  make_active,
UT_WorkBuffer errors 
)
static
bool PDG_WorkItem::localizedOutputFiles ( PDG_File::Array files) const

Localizes output files and returns it back in the supplied array. Returns false if the work item has no node or the node has no scheduler.

UT_StringHolder PDG_WorkItem::localizePath ( const UT_StringHolder path) const

Localizes a file path with the scheduler associated with the work item

const UT_WorkBuffer& PDG_WorkItem::logMessages ( ) const
inline

Returns the current in process log buffer.

Definition at line 700 of file PDG_WorkItem.h.

int PDG_WorkItem::loopInfoDepth ( ) const

Returns the loop depth of the work item.

int PDG_WorkItem::loopInfoIteration ( ) const

Returns the loop iteration of the work item.

PDG_WorkItemID PDG_WorkItem::loopInfoLock ( ) const

Returns the loop service lock ID of the work item.

int PDG_WorkItem::loopInfoNumber ( ) const

Returns the loop number of the work item.

int PDG_WorkItem::loopInfoSize ( ) const

Returns the size of the loop that contains the work item.

const PDG_LoopInfo::Stack& PDG_WorkItem::loopInfoStack ( ) const
inline

Returns the loop stack for this work item.

Definition at line 485 of file PDG_WorkItem.h.

PDG_WorkItem* PDG_WorkItem::loopInfoStackEntry ( int  index) const

Returns the loop stack entry at the specified index;.

virtual void PDG_WorkItem::memoryInfo ( PDG_MemoryInfo memory_info,
bool  inclusive 
) const
virtual

Returns a break down of the memory used by the work item.

Reimplemented in PDG_BatchWorkItem.

UT_StringHolder PDG_WorkItem::name ( ) const

Returns the name of the work item, guaranteed to be unique.

PDG_Node* PDG_WorkItem::node ( ) const
inline

Returns the node that owns the work item.

Definition at line 190 of file PDG_WorkItem.h.

virtual void PDG_WorkItem::notifyCook ( PDGE_Resolutions resolutions,
PDG_WorkItemState  result,
int  batch_index,
fpreal  duration,
bool  notify_all,
bool  static_cook,
bool  unresolve 
)
protectedvirtual

Notifies this work item that is has cooked.

Reimplemented in PDG_BatchWorkItem.

PDG_AttributeCast PDG_WorkItem::numericData ( fpreal param,
const PDG_AttributeEvaluator evaluator,
fpreal  frame,
int  thread 
) const

Does a numeric data lookup, for use with the @ operator.

virtual PDG_WorkItemCacheState PDG_WorkItem::outputCacheState ( ) const
virtual

Returns the output file cache state of this work item.

Reimplemented in PDG_BatchWorkItem.

bool PDG_WorkItem::outputFiles ( PDG_File::Array files) const

Returns the raw output file array for the work item. The paths in this array are unlocalized, i.e. they may contain PDG_DIR

bool PDG_WorkItem::outputFilesForTag ( PDG_File::Array files,
const UT_StringHolder tag,
bool  include_expected = false 
) const

Returns all output files that are a substring-match for the given tag.

void PDG_WorkItem::ownedFiles ( PDG_File::Set files,
bool  include_expected 
) const
protected

Returns the list of files owned by this work item.

const PDG_WorkItem* PDG_WorkItem::parent ( ) const

Const acessor to the work item's parent.

bool PDG_WorkItem::partitionItems ( PDG_WorkItemConstArray components) const

Returns true if the item is a partition, and stores the partition components into the array passed in as a parameter

void PDG_WorkItem::performanceEvent ( ) const

Reports a performance monitor event for this work item.

const UT_StringHolder& PDG_WorkItem::platformCommand ( PDG_Platform  platform = PDG_Platform::eUndefined)

Returns the platform specific command associated with the work item, or the command for the current platform if no platform is specified

void PDG_WorkItem::postCook ( PDGE_Resolutions resolutions,
PDG_WorkItemState  result,
int  batch_index,
fpreal  duration,
bool  notify_all,
bool  static_cook,
bool  unresolve 
)
protected

Called by the scheduler to mark out of process items as cooked.

PDG_WorkItemDirty PDG_WorkItem::prepareDirty ( bool  should_delete)

Prepares the work item for dirtying, but does not actually modify the item or its dependencies in any way.

void PDG_WorkItem::prepareDirty ( PDG_WorkItemDirty dirty_state,
bool  is_delete,
bool  is_dirty_data 
) const
protected

Dirties or deletes the work item and propogates the necessary changes to downstream items and dependents.

int PDG_WorkItem::priority ( ) const
inline

Returns the work item priority.

Definition at line 233 of file PDG_WorkItem.h.

void PDG_WorkItem::pushLoopInfoStack ( const PDG_WorkItem parent_item)

Updates the loop stack, with the specified parent.

bool PDG_WorkItem::removeDependency ( PDG_WorkItem work_item)

Removes a dependency and the corresponding back pointer from the target work item.

const PDG_WorkItemIDBoolMap& PDG_WorkItem::requiredDependencies ( ) const

Returns the require dependencies, e.g. deps that own this item. This is used with partitioning to force the partition to by delete when one of it's required dependencies is deleted

void PDG_WorkItem::resetOwner ( )
overridevirtual

Resets the work item's dependency objects.

Reimplemented from PDGE_DependencyOwner.

static UT_OptionsHolder PDG_WorkItem::saveArrayDict ( const PDG_WorkItemArray items,
bool  global_attributes,
bool  skip_defaults 
)
static

Saves the list of work items to a UT_OptionsHolder.

static bool PDG_WorkItem::saveArrayJSONFile ( const UT_StringHolder path,
const PDG_WorkItemArray items,
bool  pretty_print,
bool  global_attributes,
bool  skip_defaults 
)
static

Saves the array of work items to a .json file or string.

static UT_StringHolder PDG_WorkItem::saveArrayJSONString ( const PDG_WorkItemArray items,
bool  pretty_print,
bool  global_attributes,
bool  skip_defaults 
)
static
UT_OptionsHolder PDG_WorkItem::saveDict ( bool  global_attributes,
bool  skip_defaults 
) const

Saves the work item to a UT_OptionsHolder.

bool PDG_WorkItem::saveJSONFile ( const UT_StringHolder path,
bool  pretty_print,
bool  global_attributes,
bool  skip_defaults 
) const

Saves the work item to a .json file or string.

UT_StringHolder PDG_WorkItem::saveJSONString ( bool  pretty_print,
bool  global_attributes,
bool  skip_defaults 
) const
PDG_Scheduler* PDG_WorkItem::scheduler ( ) const

Returns the scheduler associated with the work item, looked up from the work item's node.

UT_StringHolder PDG_WorkItem::serializeData ( ) const

Serialization of underlying PDG_WorkItemData object.

bool PDG_WorkItem::serializeDataToFile ( const UT_StringHolder file) const
void PDG_WorkItem::setBatchInfo ( PDG_BatchWorkItem item,
int  index,
int  batch_index,
int  priority 
)

Sets the batch item info, e.g. the batch item pointer and the index within the batch.

void PDG_WorkItem::setCloneTarget ( const PDG_WorkItem clone_target)

Sets the clone target, e.g. the item from which this item will clone attributes

void PDG_WorkItem::setCommand ( const UT_StringHolder command,
bool  shell = false 
)

Sets the work item command directly.

void PDG_WorkItem::setCookPercent ( const fpreal cook_percent)
void PDG_WorkItem::setCookType ( PDG_WorkItemCookType  cook_type)

Sets the cook type for the work item.

void PDG_WorkItem::setCustomState ( const UT_StringHolder state)

Sets the custom state string. Note that custom states are cleared any time the actual work item state changes.

void PDG_WorkItem::setData ( PDG_WorkItemDataPtr  data)
void PDG_WorkItem::setExecutionType ( PDG_WorkItemExecutionType  execution_type)

Sets the execution type of the work item.

bool PDG_WorkItem::setFrame ( fpreal  frame)
bool PDG_WorkItem::setFrame ( fpreal  frame,
fpreal  frame_step 
)
virtual bool PDG_WorkItem::setFrame ( fpreal  frame,
fpreal  frame_step,
bool  check_dirty 
)
protectedvirtual

Internal method for setting the frame.

Reimplemented in PDG_BatchWorkItem.

void PDG_WorkItem::setIndex ( int  index)

Sets the work item index.

void PDG_WorkItem::setInternalIndex ( int  index)
inline

Sets the work items internal index, used for dirtying.

Definition at line 526 of file PDG_WorkItem.h.

void PDG_WorkItem::setIsCloneOutputFiles ( bool  clone)

Sets the work item's clone output files flag.

void PDG_WorkItem::setIsFrozen ( bool  is_frozen)

Sets the frozen flag on the work item.

void PDG_WorkItem::setIsNoGenerate ( bool  no_gen)

Sets the work item no generate flag.

void PDG_WorkItem::setIsPostCook ( bool  postcook)

Sets the is post cook flag.

void PDG_WorkItem::setLabel ( const UT_StringHolder label)

Sets the work item label.

void PDG_WorkItem::setLoopInfo ( int  iteration,
int  number,
int  size,
PDG_WorkItemID  service_lock = theInvalidId 
)

Updates the loop iteration and number, at the head of the current loop stack

void PDG_WorkItem::setLoopInfoStack ( const PDG_LoopInfo::Stack loop_stack)

Sets the loop stack contents.

void PDG_WorkItem::setNode ( PDG_Node node,
bool  emit 
)

Sets the work item node.

virtual void PDG_WorkItem::setPendingDirty ( PendingDirty  pending)
virtual

Sets the pending dirty flag on the work item, used for regeneration.

Reimplemented in PDG_BatchWorkItem.

void PDG_WorkItem::setPlatformCommands ( const UT_StringHolder linux,
const UT_StringHolder mac,
const UT_StringHolder windows,
bool  shell = false 
)

Sets a per-platform work item command.

void PDG_WorkItem::setPriority ( int  priority,
bool  emit = true 
)

Sets the work item priority.

bool PDG_WorkItem::setState ( PDG_WorkItemState  state,
bool  emit = true 
)

Sets the work item state.

virtual fpreal PDG_WorkItem::setTimeStat ( PDG_WorkItemStats::StatType  stat,
bool  batched 
)
virtual

Sets a stat to the current time.

Reimplemented in PDG_BatchWorkItem.

bool PDG_WorkItem::shouldRunInShell ( ) const

Returns true if the command should run in the shell.

void PDG_WorkItem::sortedDependencies ( PDG_WorkItemConstArray sorted_depencies,
bool  only_upstream = false 
) const

Flattens dependencies by query all dependencies of the work item, and if the the dependency is a wrapper expands it into real items that the wrapper depends on.

void PDG_WorkItem::startRegenerating ( )

Called when the work item should begin regenerating.

bool PDG_WorkItem::startSubItem ( bool  wait,
UT_WorkBuffer errors 
)

Starts cooking a sub item in a batch, and optionally waits for it to be available. Returns false if the item cannot start due to a failure.

bool PDG_WorkItem::startWorkItem ( )

Marks a work item is cooking, updates it cook start time, and prints log messages.

PDG_WorkItemState PDG_WorkItem::state ( ) const
inline

Returns the work item cook state.

Definition at line 331 of file PDG_WorkItem.h.

const PDG_WorkItemStats& PDG_WorkItem::stats ( ) const
inline

Returns the perf stats object for the work item.

Definition at line 942 of file PDG_WorkItem.h.

PDG_WorkItemStats& PDG_WorkItem::stats ( )
inline

Definition at line 944 of file PDG_WorkItem.h.

PDG_AttributeCast PDG_WorkItem::stringData ( UT_WorkBuffer buffer,
const PDG_AttributeEvaluator evaluator,
fpreal  frame,
int  thread 
) const

Does a string data lookup, for use with the @ operator.

const PDG_EventFilter& PDG_WorkItem::supportedEventTypes ( ) const
overridevirtual

Returns the list of supported event types.

Implements PDG_EventEmitter.

virtual void PDG_WorkItem::syncCacheId ( )
protectedvirtual

Syncs a work item's cache with its dependents.

Reimplemented in PDG_BatchWorkItem.

void PDG_WorkItem::syncData ( bool  force_recursive)

Syncs work item data with its parent.

UT_StringHolder PDG_WorkItem::tempDir ( ) const

Returns the local temporary file directory from the sechduler associated with this work item.

bool PDG_WorkItem::transferFiles ( bool  update_cache)

Transfers all dependent files to the remote directory, using the supplied scheduler

PDG_WorkItemType PDG_WorkItem::type ( ) const
inline

Returns the work item type.

Definition at line 136 of file PDG_WorkItem.h.

bool PDG_WorkItem::uiSelect ( bool  select)

Runs selection logic from selecting a work item in TOPs.

void PDG_WorkItem::updateCacheId ( PDG_CacheID  cache_id)
protected

Updates the file cache of this work item so the ID is at least as large as the input ID

void PDG_WorkItem::updateOutputFile ( int  index,
const UT_StringHolder path,
const UT_StringHolder tag,
PDG_File::Hash  hash_code,
bool  owner 
)

Replaces the output file at the given index, if that index is valid.

bool PDG_WorkItem::upgradeExpectedOutputFiles ( bool  check_disk,
bool  clear 
)
protected

Upgrades expected outputs to runtime outputs for this work item.

bool PDG_WorkItem::validateOutputFiles ( )

Checks if the work items output files are valid, e.g. they exist.

void PDG_WorkItem::varReplace ( const char *  input,
UT_WorkBuffer output 
) const

Replaces env vars in the target string with respect to the environment and properties of this work item. If py_replace is true, replaces the env vars with a valid python token instead of

void PDG_WorkItem::visualDependencies ( PDG_WorkItemSet deps,
bool  expand,
PDG_Scheduler filter 
) const

Returns a copy of the "visual" dependencies, e.g. the ones the user would see if they used TOPs or wanted to print out the DAG itself. This strips out any intenal items/dependencies used by TOPs

void PDG_WorkItem::visualDependents ( PDG_WorkItemSet deps,
bool  expand,
PDG_Scheduler filter 
) const

Inverse of the above.

bool PDG_WorkItem::wasModified ( ) const
inline

Returns the work item's modified flag.

Definition at line 519 of file PDG_WorkItem.h.

Friends And Related Function Documentation

friend class PDG_BatchWorkItem
friend

Definition at line 1002 of file PDG_WorkItem.h.

friend class PDG_Scheduler
friend

Definition at line 1003 of file PDG_WorkItem.h.

friend class PDG_WorkItemDirty
friend

Definition at line 1005 of file PDG_WorkItem.h.

friend class PDG_WorkItemHolder
friend

Definition at line 1004 of file PDG_WorkItem.h.

Member Data Documentation

bool PDG_WorkItem::myAttributesDirty
protected

Definition at line 1194 of file PDG_WorkItem.h.

int PDG_WorkItem::myBatchIndex
protected

Definition at line 1177 of file PDG_WorkItem.h.

PDG_BatchWorkItem* PDG_WorkItem::myBatchParent
protected

Definition at line 1167 of file PDG_WorkItem.h.

PDG_CacheID PDG_WorkItem::myCacheId
protected

Definition at line 1180 of file PDG_WorkItem.h.

PDGE_Dependency PDG_WorkItem::myCanCookDep
protected

Definition at line 1151 of file PDG_WorkItem.h.

const PDG_WorkItem* PDG_WorkItem::myCloneTarget
protected

Definition at line 1168 of file PDG_WorkItem.h.

PDG_GraphContext* PDG_WorkItem::myContext
protected

Definition at line 1165 of file PDG_WorkItem.h.

PDG_WorkItemCookType PDG_WorkItem::myCookType
protected

Definition at line 1184 of file PDG_WorkItem.h.

PDG_WorkItemDataPtr PDG_WorkItem::myData
protected

Definition at line 1170 of file PDG_WorkItem.h.

PDG_WorkItemIDMap PDG_WorkItem::myDependencies
protected

Definition at line 1156 of file PDG_WorkItem.h.

PDG_WorkItemIDMap PDG_WorkItem::myDependents
protected

Definition at line 1157 of file PDG_WorkItem.h.

PDG_WorkItemState PDG_WorkItem::myDepState
protected

Definition at line 1187 of file PDG_WorkItem.h.

bool PDG_WorkItem::myDidCook
protected

Definition at line 1196 of file PDG_WorkItem.h.

UT_TBBSpinLock PDG_WorkItem::myEdgeLock
mutableprotected

Definition at line 1189 of file PDG_WorkItem.h.

PDG_WorkItemExecutionType PDG_WorkItem::myExecutionType
protected

Definition at line 1183 of file PDG_WorkItem.h.

fpreal PDG_WorkItem::myFrame
protected

Definition at line 1172 of file PDG_WorkItem.h.

fpreal PDG_WorkItem::myFrameStep
protected

Definition at line 1173 of file PDG_WorkItem.h.

bool PDG_WorkItem::myHasFrame
protected

Definition at line 1191 of file PDG_WorkItem.h.

bool PDG_WorkItem::myHasWarnings
mutableprotected

Definition at line 1192 of file PDG_WorkItem.h.

PDG_WorkItemID PDG_WorkItem::myId
protected

Definition at line 1175 of file PDG_WorkItem.h.

int PDG_WorkItem::myIndex
protected

Definition at line 1176 of file PDG_WorkItem.h.

int PDG_WorkItem::myInternalIndex
protected

Definition at line 1179 of file PDG_WorkItem.h.

bool PDG_WorkItem::myIsBatchReady
protected

Definition at line 1203 of file PDG_WorkItem.h.

bool PDG_WorkItem::myIsCloneOutputFiles
protected

Definition at line 1201 of file PDG_WorkItem.h.

PDGE_Dependency PDG_WorkItem::myIsCookedDep
protected

Definition at line 1152 of file PDG_WorkItem.h.

bool PDG_WorkItem::myIsFrozen
protected

Definition at line 1202 of file PDG_WorkItem.h.

bool PDG_WorkItem::myIsNoGenerate
protected

Definition at line 1200 of file PDG_WorkItem.h.

bool PDG_WorkItem::myIsPostCook
protected

Definition at line 1198 of file PDG_WorkItem.h.

bool PDG_WorkItem::myIsStatic
protected

Definition at line 1199 of file PDG_WorkItem.h.

UT_WorkBuffer PDG_WorkItem::myLogMessages
mutableprotected

Definition at line 1162 of file PDG_WorkItem.h.

PDG_LoopInfo::Stack PDG_WorkItem::myLoopInfoStack
protected

Definition at line 1160 of file PDG_WorkItem.h.

PDG_Node* PDG_WorkItem::myNode
protected

Definition at line 1164 of file PDG_WorkItem.h.

PendingDirty PDG_WorkItem::myPendingDirty
protected

Definition at line 1185 of file PDG_WorkItem.h.

int PDG_WorkItem::myPriority
protected

Definition at line 1178 of file PDG_WorkItem.h.

PDG_WorkItemIDBoolMap PDG_WorkItem::myRequiredDependencies
protected

Definition at line 1158 of file PDG_WorkItem.h.

PDG_WorkItemState PDG_WorkItem::myState
protected

Definition at line 1186 of file PDG_WorkItem.h.

PDG_WorkItemStats PDG_WorkItem::myStats
protected

Definition at line 1154 of file PDG_WorkItem.h.

PDG_WorkItemType PDG_WorkItem::myType
protected

Definition at line 1182 of file PDG_WorkItem.h.

bool PDG_WorkItem::myWasModified
protected

Definition at line 1195 of file PDG_WorkItem.h.

constexpr PDG_WorkItemID PDG_WorkItem::theInvalidId = -1
static

Default, invalid work item ID value.

Definition at line 52 of file PDG_WorkItem.h.


The documentation for this class was generated from the following file: