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; }
215 {
return myBatchParent; }
220 {
return myCloneTarget; }
236 {
return myInternalIndex; }
241 {
return myBatchIndex; }
245 {
return myPriority; }
250 {
return myCacheId; }
258 {
return myHasFrame; }
262 {
return myFrameStep; }
266 {
return myHasWarnings; }
270 {
return myIsStatic; }
273 bool isRegular()
const;
276 bool isPartition()
const;
279 bool isDynamic()
const;
282 bool isBatch()
const;
286 {
return myIsFrozen; }
290 {
return (myCookType ==
295 {
return (myCookType ==
300 {
return (myCookType ==
324 {
return myIsPostCook; }
329 {
return myIsNoGenerate; }
334 {
return myIsCloneOutputFiles; }
339 bool isMainThread()
const;
348 {
return myDepState; }
351 bool isCooked()
const;
354 bool isSuccessful()
const;
357 bool isUnsuccessful()
const;
360 bool isUncooked()
const;
363 bool isUnsuccessfulDep()
const;
366 bool isProcessing()
const;
369 bool isLongRunning()
const;
378 {
return myEdgeLock; }
397 int dependencySize()
const;
410 void failedDependencies(
416 void visualDependencies(
422 void visualDependents(
431 requiredDependencies()
const;
441 void sortedDependencies(
443 bool only_upstream=
false)
const;
452 bool required =
false,
453 bool user_defined =
false);
457 void addRequiredDependency(
470 void pushLoopInfoStack(
474 void setLoopInfoStack(
481 int loopInfoIteration()
const;
484 int loopInfoNumber()
const;
487 int loopInfoSize()
const;
490 int loopInfoDepth()
const;
497 {
return myLoopInfoStack; }
502 bool compareLoopInfoStack(
506 void setIsPostCook(
bool postcook);
509 void setIsNoGenerate(
bool no_gen);
512 void setIsCloneOutputFiles(
bool clone);
518 bool update_node=
true);
521 void setIsFrozen(
bool is_frozen);
524 void setExecutionType(
532 {
return myWasModified; }
535 void setIndex(
int index);
539 { myInternalIndex =
index; }
542 void setPriority(
int priority,
bool emit=
true);
546 void boostPriority();
552 bool setFrame(
fpreal frame);
556 void setNode(
PDG_Node* node,
bool emit);
559 virtual void setPendingDirty(PendingDirty pending);
562 void startRegenerating();
566 PendingDirty doneRegenerating();
589 virtual bool setCommand(
594 virtual bool setPlatformCommands(
611 void clearCustomState();
613 bool hasCookPercent()
const;
614 fpreal cookPercent()
const;
615 void setCookPercent(
const fpreal &cook_percent);
619 template <
typename... Args>
622 Args&&...
args)
const
629 std::forward<Args>(
args)...);
636 bool timestamp=
true)
const
647 template <
typename... Args>
650 Args&&...
args)
const
657 std::forward<Args>(
args)...);
658 myHasWarnings =
true;
666 int verbosity=0)
const
673 myHasWarnings =
true;
678 template <
typename... Args>
681 Args&&...
args)
const
688 std::forward<Args>(
args)...);
695 int verbosity=0)
const
709 int verbosity=0)
const;
713 {
return myLogMessages; }
721 void dirty(
bool should_delete,
bool remove_outputs);
735 void invalidateCache();
738 void syncData(
bool force_recursive);
744 bool compareDataType(
746 bool deep=
true)
const;
767 bool serializeDataToFile(
775 bool uiSelect(
bool select);
779 bool hasOutputFiles()
const;
783 outputCacheState()
const;
793 bool localizedOutputFiles(
801 bool outputFilesForTag(
804 bool include_expected =
false)
const;
817 bool expectedOutputFiles(
821 void addExpectedOutputFile(
827 void addExpectedOutputFiles(
833 void addExpectedOutputFile(
const PDG_File& file);
863 void updateOutputFile(
873 bool include_expected)
const;
876 bool inputFilesForTag(
879 bool include_expected =
false)
const;
882 bool validateOutputFiles();
886 bool transferFiles(
bool update_cache);
889 void clearOutputFiles();
892 void clearExpectedOutputFiles();
896 void clearRuntimeOutputFiles();
900 void clearEnvironment();
903 bool addEnvironmentVar(
909 bool hasEnvironmentVar(
914 void globEnvironment(
918 bool envLookup(
const char* key,
934 bool startWorkItem();
949 void performanceEvent()
const;
964 void varReplace(
const char* input,
971 bool global_attributes,
972 bool skip_defaults)
const;
975 bool global_attributes,
976 bool skip_defaults)
const;
980 bool global_attributes,
981 bool skip_defaults)
const;
984 static bool saveArrayJSONFile(
988 bool global_attributes,
993 bool global_attributes,
999 bool global_attributes,
1000 bool skip_defaults);
1025 bool is_dirty_data)
const;
1030 bool remove_outputs);
1036 bool remove_outputs);
1041 bool include_expected)
const;
1068 bool upgradeExpectedOutputFiles(
1091 virtual void syncCacheId();
1097 virtual bool setFrame(
fpreal frame,
1110 void removeAllDependencies();
1113 void updateDependencyState(
1118 void upstreamDependencies(
1122 void failedDependencies(
1133 void appendLogPrefix(
1140 template <
typename... Args>
1146 Args&&...
args)
const
1150 fmt, std::forward<Args>(
args)...);
1206 mutable bool myHasWarnings:1;
1208 bool myAttributesDirty:1;
1209 bool myWasModified:1;
1212 bool myIsPostCook:1;
1214 bool myIsNoGenerate:1;
1215 bool myIsCloneOutputFiles:1;
1217 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