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);
509 void setIsFrozen(
bool is_frozen);
512 void setExecutionType(
520 {
return myWasModified; }
523 void setIndex(
int index);
527 { myInternalIndex =
index; }
530 void setPriority(
int priority,
bool emit=
true);
534 void boostPriority();
540 bool setFrame(
fpreal frame);
544 void setNode(
PDG_Node* node,
bool emit);
547 virtual void setPendingDirty(PendingDirty pending);
550 void startRegenerating();
554 PendingDirty doneRegenerating();
577 virtual bool setCommand(
582 virtual bool setPlatformCommands(
599 void clearCustomState();
601 bool hasCookPercent()
const;
602 fpreal cookPercent()
const;
603 void setCookPercent(
const fpreal &cook_percent);
607 template <
typename... Args>
610 Args&&...
args)
const
617 std::forward<Args>(
args)...);
624 bool timestamp=
true)
const
635 template <
typename... Args>
638 Args&&...
args)
const
645 std::forward<Args>(
args)...);
646 myHasWarnings =
true;
654 int verbosity=0)
const
661 myHasWarnings =
true;
666 template <
typename... Args>
669 Args&&...
args)
const
676 std::forward<Args>(
args)...);
683 int verbosity=0)
const
697 int verbosity=0)
const;
701 {
return myLogMessages; }
709 void dirty(
bool should_delete,
bool remove_outputs);
723 void invalidateCache();
726 void syncData(
bool force_recursive);
732 bool compareDataType(
734 bool deep=
true)
const;
753 bool serializeDataToFile(
761 bool uiSelect(
bool select);
765 bool hasOutputFiles()
const;
769 outputCacheState()
const;
779 bool localizedOutputFiles(
787 bool outputFilesForTag(
790 bool include_expected =
false)
const;
803 bool expectedOutputFiles(
807 void addExpectedOutputFile(
813 void addExpectedOutputFiles(
819 void addExpectedOutputFile(
const PDG_File& file);
849 void updateOutputFile(
859 bool include_expected)
const;
862 bool inputFilesForTag(
865 bool include_expected =
false)
const;
868 bool validateOutputFiles();
872 bool transferFiles(
bool update_cache);
875 void clearOutputFiles();
878 void clearExpectedOutputFiles();
882 void clearRuntimeOutputFiles();
886 void clearEnvironment();
889 bool addEnvironmentVar(
895 bool hasEnvironmentVar(
900 void globEnvironment(
904 bool envLookup(
const char* key,
920 bool startWorkItem();
935 void performanceEvent()
const;
950 void varReplace(
const char* input,
957 bool global_attributes,
958 bool skip_defaults)
const;
961 bool global_attributes,
962 bool skip_defaults)
const;
966 bool global_attributes,
967 bool skip_defaults)
const;
970 static bool saveArrayJSONFile(
974 bool global_attributes,
979 bool global_attributes,
985 bool global_attributes,
1011 bool is_dirty_data)
const;
1016 bool remove_outputs);
1022 bool remove_outputs);
1027 bool include_expected)
const;
1054 bool upgradeExpectedOutputFiles(
1077 virtual void syncCacheId();
1083 virtual bool setFrame(
fpreal frame,
1096 void removeAllDependencies();
1099 void updateDependencyState(
1104 void upstreamDependencies(
1108 void failedDependencies(
1119 void appendLogPrefix(
1126 template <
typename... Args>
1132 Args&&...
args)
const
1136 fmt, std::forward<Args>(
args)...);
1192 mutable bool myHasWarnings:1;
1194 bool myAttributesDirty:1;
1195 bool myWasModified:1;
1198 bool myIsPostCook:1;
1200 bool myIsNoGenerate:1;
1201 bool myIsCloneOutputFiles:1;
1203 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