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);
560 void setNode(
PDG_Node* node,
bool emit);
563 virtual void setPendingDirty(PendingDirty pending);
566 void startRegenerating();
570 PendingDirty doneRegenerating();
593 virtual bool setCommand(
598 virtual bool setPlatformCommands(
615 void clearCustomState();
617 bool hasCookPercent()
const;
618 fpreal cookPercent()
const;
619 void setCookPercent(
const fpreal &cook_percent);
623 template <
typename... Args>
626 Args&&...
args)
const
633 std::forward<Args>(
args)...);
640 bool timestamp=
true)
const
651 template <
typename... Args>
654 Args&&...
args)
const
661 std::forward<Args>(
args)...);
662 myHasWarnings =
true;
670 int verbosity=0)
const
677 myHasWarnings =
true;
682 template <
typename... Args>
685 Args&&...
args)
const
692 std::forward<Args>(
args)...);
699 int verbosity=0)
const
713 int verbosity=0)
const;
717 {
return myLogMessages; }
725 void dirty(
bool should_delete,
bool remove_outputs);
742 void invalidateCache();
745 void syncData(
bool force_recursive);
751 bool compareDataType(
753 bool deep=
true)
const;
774 bool serializeDataToFile(
782 bool uiSelect(
bool select);
786 bool hasOutputFiles()
const;
790 outputCacheState()
const;
800 bool localizedOutputFiles(
808 bool outputFilesForTag(
811 bool include_expected =
false)
const;
824 bool expectedOutputFiles(
828 void addExpectedOutputFile(
834 void addExpectedOutputFiles(
840 void addExpectedOutputFile(
const PDG_File& file);
870 void updateOutputFile(
880 bool include_expected)
const;
883 bool inputFilesForTag(
886 bool include_expected =
false)
const;
889 bool validateOutputFiles();
893 bool transferFiles(
bool update_cache);
896 void clearOutputFiles();
899 void clearExpectedOutputFiles();
903 void clearRuntimeOutputFiles();
907 void clearEnvironment();
910 bool addEnvironmentVar(
916 bool hasEnvironmentVar(
921 void globEnvironment(
925 bool envLookup(
const char* key,
941 bool startWorkItem();
956 void performanceEvent()
const;
971 void varReplace(
const char* input,
978 bool global_attributes,
979 bool skip_defaults)
const;
982 bool global_attributes,
983 bool skip_defaults)
const;
987 bool global_attributes,
988 bool skip_defaults)
const;
991 static bool saveArrayJSONFile(
995 bool global_attributes,
1000 bool global_attributes,
1001 bool skip_defaults);
1006 bool global_attributes,
1007 bool skip_defaults);
1032 bool is_dirty_data)
const;
1037 bool remove_outputs);
1043 bool remove_outputs);
1048 bool include_expected)
const;
1075 bool upgradeExpectedOutputFiles(
1098 virtual void syncCacheId();
1104 virtual bool setFrameInternal(
1119 void removeAllDependencies();
1122 void updateDependencyState(
1127 void upstreamDependencies(
1131 void failedDependencies(
1142 void appendLogPrefix(
1149 template <
typename... Args>
1155 Args&&...
args)
const
1159 fmt, std::forward<Args>(
args)...);
1215 mutable bool myHasWarnings:1;
1217 bool myAttributesDirty:1;
1218 bool myWasModified:1;
1221 bool myIsPostCook:1;
1223 bool myIsNoGenerate:1;
1224 bool myIsCloneOutputFiles:1;
1226 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
GLsizei const GLfloat * value
int index() const
Returns the work item index.
CompareResults OIIO_API compare(const ImageBuf &A, const ImageBuf &B, float failthresh, float warnthresh, float failrelative, float warnrelative, ROI roi={}, int nthreads=0)
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.
PDG_WorkItemType
Enum of work item types.
GLint GLint GLsizei GLint GLenum GLenum type
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.
GLuint const GLchar * name
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