9 #ifndef __PDG_WORKITEM_H__
10 #define __PDG_WORKITEM_H__
56 bool is_static =
true,
60 PDG_WorkItemInvalidID);
75 bool inclusive)
const;
114 {
return &myCanCookDep; }
118 {
return &myIsCookedDep; }
126 {
return myExecutionType; }
130 {
return myCookType; }
142 bool hasCommand()
const;
146 bool hasPlatformCommand()
const;
158 bool shouldRunInShell()
const;
164 bool hasLabel()
const;
171 bool hasCustomState()
const;
180 {
return myContext; }
200 {
return myBatchParent; }
205 {
return myCloneTarget; }
221 {
return myInternalIndex; }
226 {
return myBatchIndex; }
230 {
return myPriority; }
235 {
return myCacheId; }
243 {
return myHasFrame; }
247 {
return myFrameStep; }
251 {
return myHasWarnings; }
255 {
return myIsStatic; }
258 bool isRegular()
const;
261 bool isPartition()
const;
264 bool isDynamic()
const;
267 bool isBatch()
const;
271 {
return myIsFrozen; }
275 {
return (myCookType ==
280 {
return (myCookType ==
285 {
return (myCookType ==
309 {
return myIsPostCook; }
314 {
return myIsNoGenerate; }
319 {
return myIsCloneOutputFiles; }
324 bool isMainThread()
const;
333 {
return myDepState; }
336 bool isCooked()
const;
339 bool isSuccessful()
const;
342 bool isUnsuccessful()
const;
345 bool isUncooked()
const;
348 bool isUnsuccessfulDep()
const;
351 bool isProcessing()
const;
354 bool isLongRunning()
const;
363 {
return myEdgeLock; }
382 int dependencySize()
const;
395 void failedDependencies(
401 void visualDependencies(
407 void visualDependents(
416 requiredDependencies()
const;
426 void sortedDependencies(
428 bool only_upstream=
false)
const;
437 bool required =
false,
438 bool user_defined =
false);
442 void addRequiredDependency(
455 void pushLoopInfoStack(
459 void setLoopInfoStack(
466 int loopInfoIteration()
const;
469 int loopInfoNumber()
const;
472 int loopInfoSize()
const;
475 int loopInfoDepth()
const;
482 {
return myLoopInfoStack; }
487 bool compareLoopInfoStack(
491 void setIsPostCook(
bool postcook);
494 void setIsNoGenerate(
bool no_gen);
497 void setIsCloneOutputFiles(
bool clone);
503 bool update_node=
true);
506 void setIsFrozen(
bool is_frozen);
509 void setExecutionType(
517 {
return myWasModified; }
520 void setIndex(
int index);
524 { myInternalIndex =
index; }
527 void setPriority(
int priority,
bool emit=
true);
531 void boostPriority();
537 bool setFrame(
fpreal frame);
545 void setNode(
PDG_Node* node,
bool emit);
548 virtual void setPendingDirty(
552 void startRegenerating();
577 PDG_WorkItemInvalidID);
580 virtual bool setCommand(
585 virtual bool setPlatformCommands(
602 void clearCustomState();
604 bool hasCookPercent()
const;
605 fpreal cookPercent()
const;
606 void setCookPercent(
const fpreal &cook_percent);
610 template <
typename... Args>
613 Args&&...
args)
const
620 std::forward<Args>(
args)...);
627 bool timestamp=
true)
const
638 template <
typename... Args>
641 Args&&...
args)
const
648 std::forward<Args>(
args)...);
649 myHasWarnings =
true;
657 int verbosity=0)
const
664 myHasWarnings =
true;
669 template <
typename... Args>
672 Args&&...
args)
const
679 std::forward<Args>(
args)...);
686 int verbosity=0)
const
700 int verbosity=0)
const;
704 {
return myLogMessages; }
712 void dirty(
bool should_delete,
bool remove_outputs);
729 void invalidateCache();
732 void syncData(
bool force_recursive);
738 bool compareDataType(
740 bool deep=
true)
const;
761 bool serializeDataToFile(
769 bool uiSelect(
bool select);
773 bool hasOutputFiles()
const;
777 outputCacheState()
const;
787 bool localizedOutputFiles(
803 bool outputFilesForTag(
806 bool include_expected =
false)
const;
819 bool expectedOutputFiles(
823 void addExpectedOutputFile(
829 void addExpectedOutputFiles(
835 void addExpectedOutputFile(
const PDG_File& file);
865 void updateOutputFile(
875 bool include_expected)
const;
878 bool inputFilesForTag(
881 bool include_expected =
false)
const;
884 bool validateOutputFiles();
888 bool transferFiles(
bool update_cache);
891 void clearOutputFiles();
894 void clearExpectedOutputFiles();
898 void clearRuntimeOutputFiles();
902 void clearEnvironment();
905 bool addEnvironmentVar(
911 bool hasEnvironmentVar(
916 void globEnvironment(
920 bool envLookup(
const char* key,
936 bool startWorkItem();
951 void performanceEvent()
const;
966 void varReplace(
const char* input,
973 bool global_attributes,
974 bool skip_defaults)
const;
977 bool global_attributes,
978 bool skip_defaults)
const;
982 bool global_attributes,
983 bool skip_defaults)
const;
986 static bool saveArrayJSONFile(
990 bool global_attributes,
995 bool global_attributes,
1001 bool global_attributes,
1002 bool skip_defaults);
1027 bool is_dirty_data)
const;
1032 bool remove_outputs);
1038 bool remove_outputs);
1043 bool include_expected)
const;
1070 bool upgradeExpectedOutputFiles(
1093 virtual void syncCacheId();
1099 virtual bool setFrameInternal(
1114 void removeAllDependencies();
1117 void updateDependencyState(
1122 void upstreamDependencies(
1126 void failedDependencies(
1137 void appendLogPrefix(
1144 template <
typename... Args>
1150 Args&&...
args)
const
1154 fmt, std::forward<Args>(
args)...);
1210 mutable bool myHasWarnings:1;
1212 bool myAttributesDirty:1;
1213 bool myWasModified:1;
1216 bool myIsPostCook:1;
1218 bool myIsNoGenerate:1;
1219 bool myIsCloneOutputFiles:1;
1221 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
PDG_WorkItemPendingDirty
Enumeration of pending work item dirty states.
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.
PDG_WorkItemPendingDirty myPendingDirty
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.
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
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
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.
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