9 #ifndef __PDG_WORKITEM_H__
10 #define __PDG_WORKITEM_H__
70 bool is_static =
true,
87 bool inclusive)
const;
126 {
return &myCanCookDep; }
130 {
return &myIsCookedDep; }
138 {
return myExecutionType; }
142 {
return myCookType; }
154 bool hasCommand()
const;
158 bool hasPlatformCommand()
const;
170 bool shouldRunInShell()
const;
176 bool hasLabel()
const;
183 bool hasCustomState()
const;
192 {
return myContext; }
201 {
return myBatchParent; }
206 {
return myCloneTarget; }
222 {
return myInternalIndex; }
227 {
return myBatchIndex; }
231 {
return myPriority; }
236 {
return myCacheId; }
244 {
return myHasFrame; }
248 {
return myFrameStep; }
252 {
return myHasWarnings; }
256 {
return myIsStatic; }
259 bool isRegular()
const;
262 bool isPartition()
const;
265 bool isDynamic()
const;
268 bool isBatch()
const;
272 {
return myIsFrozen; }
276 {
return (myCookType ==
281 {
return (myCookType ==
286 {
return (myCookType ==
310 {
return myIsPostCook; }
315 {
return myIsNoGenerate; }
320 {
return myIsCloneOutputFiles; }
325 bool isMainThread()
const;
334 {
return myDepState; }
337 bool isCooked()
const;
340 bool isSuccessful()
const;
343 bool isUnsuccessful()
const;
346 bool isUncooked()
const;
349 bool isUnsuccessfulDep()
const;
352 bool isProcessing()
const;
355 bool isLongRunning()
const;
364 {
return myEdgeLock; }
383 int dependencySize()
const;
396 void visualDependencies(
402 void visualDependents(
411 requiredDependencies()
const;
421 void sortedDependencies(
423 bool only_upstream=
false)
const;
432 bool required =
false,
433 bool user_defined =
false);
437 void addRequiredDependency(
449 void pushLoopInfoStack(
453 void setLoopInfoStack(
460 int loopInfoIteration()
const;
463 int loopInfoNumber()
const;
466 int loopInfoSize()
const;
469 int loopInfoDepth()
const;
476 {
return myLoopInfoStack; }
481 bool compareLoopInfoStack(
485 void setIsPostCook(
bool postcook);
488 void setIsNoGenerate(
bool no_gen);
491 void setIsCloneOutputFiles(
bool clone);
499 void setIsFrozen(
bool is_frozen);
502 void setExecutionType(
510 {
return myWasModified; }
513 void setIndex(
int index);
517 { myInternalIndex =
index; }
520 void setPriority(
int priority,
bool emit=
true);
524 void boostPriority();
530 bool setFrame(
fpreal frame);
534 void setNode(
PDG_Node* node,
bool emit);
537 virtual void setPendingDirty(PendingDirty pending);
540 void startRegenerating();
544 PendingDirty doneRegenerating();
572 void setPlatformCommands(
589 void clearCustomState();
591 bool hasCookPercent()
const;
592 fpreal cookPercent()
const;
593 void setCookPercent(
const fpreal &cook_percent);
597 template <
typename... Args>
600 Args&&...
args)
const
607 std::forward<Args>(
args)...);
614 bool timestamp=
true)
const
625 template <
typename... Args>
628 Args&&...
args)
const
635 std::forward<Args>(
args)...);
636 myHasWarnings =
true;
644 int verbosity=0)
const
651 myHasWarnings =
true;
656 template <
typename... Args>
659 Args&&...
args)
const
666 std::forward<Args>(
args)...);
673 int verbosity=0)
const
687 int verbosity=0)
const;
691 {
return myLogMessages; }
699 void dirty(
bool should_delete,
bool remove_outputs);
713 void invalidateCache();
716 void syncData(
bool force_recursive);
722 bool compareDataType(
724 bool deep=
true)
const;
743 bool serializeDataToFile(
751 bool uiSelect(
bool select);
755 bool hasOutputFiles()
const;
765 bool localizedOutputFiles(
773 bool outputFilesForTag(
776 bool include_expected =
false)
const;
789 bool expectedOutputFiles(
793 void addExpectedOutputFile(
799 void addExpectedOutputFiles(
805 void addExpectedOutputFile(
const PDG_File& file);
835 void updateOutputFile(
845 bool include_expected)
const;
848 bool validateOutputFiles();
852 bool transferFiles(
bool update_cache);
855 void clearOutputFiles();
858 void clearExpectedOutputFiles();
862 void clearRuntimeOutputFiles();
866 void clearEnvironment();
869 bool addEnvironmentVar(
875 bool hasEnvironmentVar(
880 void globEnvironment(
884 bool envLookup(
const char* key,
900 bool startWorkItem();
915 void performanceEvent()
const;
930 void varReplace(
const char* input,
937 bool global_attributes)
const;
940 bool global_attributes)
const;
943 static bool saveArrayJSONFile(
947 bool global_attributes);
951 bool global_attributes);
976 bool is_dirty_data)
const;
981 bool remove_outputs);
987 bool remove_outputs);
992 bool include_expected)
const;
1019 bool upgradeExpectedOutputFiles(
1042 virtual void syncCacheId();
1048 virtual bool setFrame(
fpreal frame,
1061 void removeAllDependencies();
1064 void updateDependencyState(
1069 void upstreamDependencies(
1079 void appendLogPrefix(
1086 template <
typename... Args>
1092 Args&&...
args)
const
1096 fmt, std::forward<Args>(
args)...);
1152 mutable bool myHasWarnings:1;
1154 bool myAttributesDirty:1;
1155 bool myWasModified:1;
1158 bool myIsPostCook:1;
1160 bool myIsNoGenerate:1;
1161 bool myIsCloneOutputFiles:1;
1163 bool myIsBatchReady:1;
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.
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 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.
PDG_WorkItemCookType
Enumeration of work item cook types.
bool isCloneOutputFiles() const
PDG_WorkItemStats myStats
void addWarning(const UT_StringHolder &log, bool timestamp=true, int verbosity=0) const
PDG_WorkItemSet myDependencies
bool wasModified() const
Returns the work item's modified flag.
The work item cooks in process.
UT_SharedPtr< PDG_WorkItemData > PDG_WorkItemDataPtr
CompareResults OIIO_API compare(const ImageBuf &A, const ImageBuf &B, float failthresh, float warnthresh, ROI roi={}, int nthreads=0)
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.
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.
PDG_WorkItemLogType
Enumeration of work item log message types.
The work item cooks as a service.
PDG_WorkItemExecutionType
Enum of work item runtime types.
const UT_WorkBuffer & logMessages() const
Returns the current in process log buffer.
PDG_BatchWorkItem * batchParent() const
PDG_WorkItemConstBoolMap myRequiredDependencies
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.
fpreal frameStep() const
Returns the work item step size, primarily used with batch items.
virtual Filter & supportedEventTypes() const =0
Returns the list of supported event types for this emitter.
PDG_WorkItemState
Enum of possible work item states.
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.
void addError(const UT_StringHolder &log, bool timestamp=true) const
StatType
Enumeration of stats stored in this object.
PendingDirty
Enumeration of pending dirty states.
UT_TBBSpinLock myEdgeLock
Unspecified/automatic cook type.
**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
size_t format(const char *fmt, const Args &...args)
PDG_AttributeType
Enumeration of possible attribute types.
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.
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_WorkItemType
Enum of work item 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
int cacheId() const
Returns the cache id of the work item.
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.
exint PDG_WorkItemID
Type defs for unique work item IDs.
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)
PDG_WorkItemSet myDependents
bool isStatic() const
Returns true if the item is a static work item.
The work item cooks out of process.
Reader/Writer mutex class.
virtual void resetOwner()
Resets the owner.
PDG_WorkItemExecutionType executionType() const
Returns the work item execution type.
const PDG_WorkItem * myCloneTarget
virtual void attribUnlock() const
void prepareDirty(PDG_WorkItem *work_item)
Adds a work item and its dependencies to the dirty sets.
PendingDirty myPendingDirty
const PDG_WorkItem * cloneTarget() const
int internalIndex() const
Returns the work item's internal index.
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter