9 #ifndef __PDG_WORKITEM_H__
10 #define __PDG_WORKITEM_H__
73 bool is_static =
true,
90 bool inclusive)
const;
129 {
return &myCanCookDep; }
133 {
return &myIsCookedDep; }
141 {
return myExecutionType; }
145 {
return myCookType; }
157 bool hasCommand()
const;
161 bool hasPlatformCommand()
const;
173 bool shouldRunInShell()
const;
179 bool hasLabel()
const;
186 bool hasCustomState()
const;
195 {
return myContext; }
204 {
return myBatchParent; }
209 {
return myCloneTarget; }
225 {
return myInternalIndex; }
230 {
return myBatchIndex; }
234 {
return myPriority; }
239 {
return myCacheId; }
247 {
return myHasFrame; }
251 {
return myFrameStep; }
255 {
return myHasWarnings; }
259 {
return myIsStatic; }
262 bool isRegular()
const;
265 bool isPartition()
const;
268 bool isDynamic()
const;
271 bool isBatch()
const;
275 {
return myIsFrozen; }
279 {
return (myCookType ==
284 {
return (myCookType ==
289 {
return (myCookType ==
313 {
return myIsPostCook; }
318 {
return myIsNoGenerate; }
323 {
return myIsCloneOutputFiles; }
328 bool isMainThread()
const;
337 {
return myDepState; }
340 bool isCooked()
const;
343 bool isSuccessful()
const;
346 bool isUnsuccessful()
const;
349 bool isUncooked()
const;
352 bool isUnsuccessfulDep()
const;
355 bool isProcessing()
const;
358 bool isLongRunning()
const;
367 {
return myEdgeLock; }
386 int dependencySize()
const;
399 void failedDependencies(
405 void visualDependencies(
411 void visualDependents(
420 requiredDependencies()
const;
430 void sortedDependencies(
432 bool only_upstream=
false)
const;
441 bool required =
false,
442 bool user_defined =
false);
446 void addRequiredDependency(
459 void pushLoopInfoStack(
463 void setLoopInfoStack(
470 int loopInfoIteration()
const;
473 int loopInfoNumber()
const;
476 int loopInfoSize()
const;
479 int loopInfoDepth()
const;
486 {
return myLoopInfoStack; }
491 bool compareLoopInfoStack(
495 void setIsPostCook(
bool postcook);
498 void setIsNoGenerate(
bool no_gen);
501 void setIsCloneOutputFiles(
bool clone);
507 bool update_node=
true);
510 void setIsFrozen(
bool is_frozen);
513 void setExecutionType(
521 {
return myWasModified; }
524 void setIndex(
int index);
528 { myInternalIndex =
index; }
531 void setPriority(
int priority,
bool emit=
true);
535 void boostPriority();
541 bool setFrame(
fpreal frame);
545 void setNode(
PDG_Node* node,
bool emit);
548 virtual void setPendingDirty(PendingDirty pending);
551 void startRegenerating();
555 PendingDirty doneRegenerating();
578 virtual bool setCommand(
583 virtual bool setPlatformCommands(
600 void clearCustomState();
602 bool hasCookPercent()
const;
603 fpreal cookPercent()
const;
604 void setCookPercent(
const fpreal &cook_percent);
608 template <
typename... Args>
611 Args&&...
args)
const
618 std::forward<Args>(
args)...);
625 bool timestamp=
true)
const
636 template <
typename... Args>
639 Args&&...
args)
const
646 std::forward<Args>(
args)...);
647 myHasWarnings =
true;
655 int verbosity=0)
const
662 myHasWarnings =
true;
667 template <
typename... Args>
670 Args&&...
args)
const
677 std::forward<Args>(
args)...);
684 int verbosity=0)
const
698 int verbosity=0)
const;
702 {
return myLogMessages; }
710 void dirty(
bool should_delete,
bool remove_outputs);
724 void invalidateCache();
727 void syncData(
bool force_recursive);
733 bool compareDataType(
735 bool deep=
true)
const;
756 bool serializeDataToFile(
764 bool uiSelect(
bool select);
768 bool hasOutputFiles()
const;
772 outputCacheState()
const;
782 bool localizedOutputFiles(
790 bool outputFilesForTag(
793 bool include_expected =
false)
const;
806 bool expectedOutputFiles(
810 void addExpectedOutputFile(
816 void addExpectedOutputFiles(
822 void addExpectedOutputFile(
const PDG_File& file);
852 void updateOutputFile(
862 bool include_expected)
const;
865 bool inputFilesForTag(
868 bool include_expected =
false)
const;
871 bool validateOutputFiles();
875 bool transferFiles(
bool update_cache);
878 void clearOutputFiles();
881 void clearExpectedOutputFiles();
885 void clearRuntimeOutputFiles();
889 void clearEnvironment();
892 bool addEnvironmentVar(
898 bool hasEnvironmentVar(
903 void globEnvironment(
907 bool envLookup(
const char* key,
923 bool startWorkItem();
938 void performanceEvent()
const;
953 void varReplace(
const char* input,
960 bool global_attributes,
961 bool skip_defaults)
const;
964 bool global_attributes,
965 bool skip_defaults)
const;
969 bool global_attributes,
970 bool skip_defaults)
const;
973 static bool saveArrayJSONFile(
977 bool global_attributes,
982 bool global_attributes,
988 bool global_attributes,
1014 bool is_dirty_data)
const;
1019 bool remove_outputs);
1025 bool remove_outputs);
1030 bool include_expected)
const;
1057 bool upgradeExpectedOutputFiles(
1080 virtual void syncCacheId();
1086 virtual bool setFrame(
fpreal frame,
1099 void removeAllDependencies();
1102 void updateDependencyState(
1107 void upstreamDependencies(
1111 void failedDependencies(
1122 void appendLogPrefix(
1129 template <
typename... Args>
1135 Args&&...
args)
const
1139 fmt, std::forward<Args>(
args)...);
1195 mutable bool myHasWarnings:1;
1197 bool myAttributesDirty:1;
1198 bool myWasModified:1;
1201 bool myIsPostCook:1;
1203 bool myIsNoGenerate:1;
1204 bool myIsCloneOutputFiles:1;
1206 bool myIsBatchReady:1;
exint PDG_WorkItemID
Type defs for unique work item IDs.
bool isNoGenerate() const
const PDG_LoopInfo::Stack & loopInfoStack() const
Returns the loop stack for this work item.
GLuint GLsizei const GLchar * message
bool isPostCook() const
Returns true if the work item has post-cook logic.
PDG_WorkItemIDBoolMap myRequiredDependencies
bool isServiceMode() const
Returns true if the work item is marked as a service task.
GLuint GLsizei const GLchar * label
void addMessageFmt(const char *fmt, Args &&...args) const
PDG_Node * node() const
Returns the node that owns the work item.
bool hasFrame() const
Returns true if the frame has been set.
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.
void addErrorFmt(const char *fmt, Args &&...args) const
int index() const
Returns the work item index.
virtual UT_RWLock * attribGlobalLock() const
UT_StringHolder debugName() const override
GLsizei const GLchar *const * path
virtual void attribUnlock(bool modified) const
virtual UT_StringHolder attribOwnerName() const
SYS_FORCE_INLINE const char * buffer() const
std::size_t SYS_HashType
Define the type for hash values.
**But if you need a result
bool isOutOfProcess() const
Returns true if the work item is scheduled out of process.
bool isCloneOutputFiles() const
PDG_WorkItemStats myStats
void addWarning(const UT_StringHolder &log, bool timestamp=true, int verbosity=0) const
bool wasModified() const
Returns the work item's modified flag.
Unspecified/automatic cook type.
CompareResults OIIO_API compare(const ImageBuf &A, const ImageBuf &B, float failthresh, float warnthresh, ROI roi={}, int nthreads=0)
PDG_WorkItemType
Enum of work item types.
virtual bool attribCanWrite(const PDG_EvaluationContext *context) const
int64 Hash
The file hash/modtime type.
PDGE_Dependency myIsCookedDep
PDG_WorkItemState myState
PDGE_Dependency * isCookedDep()
Returns the is cooked dependency object for this work item.
vint4 select(const vbool4 &mask, const vint4 &a, const vint4 &b)
PDG_GraphContext * context() const
Returns the context that owns the work item.
PDG_WorkItemState
Enum of possible work item states.
fpreal frame() const
Returns the work item frame.
static const UT_StringHolder theEmptyString
virtual void attribModify(PDG_AttributeType attrib_type, const UT_StringHolder &attrib_name) const
PDG_AttributeCast
Enumeration of attribute cast results.
The work item cooks as a service.
The work item cooks out of process.
const UT_WorkBuffer & logMessages() const
Returns the current in process log buffer.
PDG_BatchWorkItem * batchParent() const
PDG_AttributeType
Enumeration of possible attribute types.
void applyDirty(bool remove_outputs)
Applies the stored dirty operation.
bool isFrozen() const
Returns true if the work item is frozen.
virtual int64 getMemoryUsage(bool inclusive) const
Returns the memory usage of this owner instance.
PDG_WorkItemCookType
Enumeration of work item cook types.
The work item cooks in process.
fpreal frameStep() const
Returns the work item step size, primarily used with batch items.
bool isInProcess() const
Returns true if the work item is in process.
PDG_WorkItemType type() const
Returns the work item type.
PDG_Platform
Enumeration of supported platforms, for work item command line array.
PDG_WorkItemIDMap myDependencies
void addError(const UT_StringHolder &log, bool timestamp=true) const
PDG_WorkItemLogType
Enumeration of work item log message types.
StatType
Enumeration of stats stored in this object.
PendingDirty
Enumeration of pending dirty states.
UT_TBBSpinLock myEdgeLock
**Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
PDG_BatchWorkItem * myBatchParent
UT_SharedPtr< PDG_WorkItemData > PDG_WorkItemDataPtr
Type def for registered type objects.
size_t format(const char *fmt, const Args &...args)
PDG_CacheID cacheId() const
Returns the cache id of the work item.
PDG_WorkItemExecutionType myExecutionType
The item needs to be dirtied, but not deleted.
UT_TBBSpinLock & edgeLock() const
Returns the edge lock for the work item.
PDG_WorkItemDataPtr myData
PDG_LoopInfo::Stack myLoopInfoStack
PDG_WorkItemID id() const
Returns the id of the work item, guaranteed to be unique.
PDG_WorkItemIDMap myDependents
PDGE_Dependency * canCookDep()
Returns the can cook dependency object for this work item.
PDG_WorkItemState dependencyState() const
PDGE_Dependency myCanCookDep
void addWarningFmt(const char *fmt, Args &&...args) const
virtual PDGE_Dependency::State evalResolve(PDGE_Resolutions &, const PDGE_Evaluator &, PDGE_Dependency *)
Called when a dependency owned by this object is resolved.
void setInternalIndex(int index)
Sets the work items internal index, used for dirtying.
PDG_WorkItemState myDepState
virtual UT_StringHolder debugGroup() const
bool hasWarnings() const
Returns true if the work item has any warning log messages.
**If you just want to fire and args
PDG_WorkItemStats & stats()
PDG_WorkItemExecutionType
Enum of work item runtime types.
void updateCacheId(const PDG_WorkItem *dependent, const PDG_WorkItem *dependency)
Updates the cache ID of the work item for a dependency.
PDG_WorkItemCookType myCookType
The item does not require any sort of dirtying.
virtual void attribWarn(const UT_StringHolder &msg) const
UT_WorkBuffer myLogMessages
const PDG_WorkItemStats & stats() const
Returns the perf stats object for the work item.
PDG_WorkItemState state() const
Returns the work item cook state.
PDG_GraphContext * myContext
int priority() const
Returns the work item priority.
PDG_WorkItemCookType cookType() const
Returns the work item cook type.
virtual int evalUnresolve(PDGE_Dependency::Array &, PDGE_Dependency *)
OIIO_FORCEINLINE T log(const T &v)
bool isStatic() const
Returns true if the item is a static work item.
Reader/Writer mutex class.
virtual void resetOwner()
Resets the owner.
PDG_WorkItemExecutionType executionType() const
Returns the work item execution type.
const PDG_WorkItem * myCloneTarget
void prepareDirty(PDG_WorkItem *work_item)
Adds a work item and its dependencies to the dirty sets.
PendingDirty myPendingDirty
const PDG_WorkItem * cloneTarget() const
virtual const PDG_EventFilter & supportedEventTypes() const =0
Returns the list of supported event types for this emitter.
int internalIndex() const
Returns the work item's internal index.
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter