9 #ifndef __PDG_SCHEDULER_H__
10 #define __PDG_SCHEDULER_H__
53 class PDGN_PollingClientNNG;
179 {
return &myIsCookedDep; }
183 {
return &myIsSetupDep; }
205 virtual void onScheduleStatic(
212 virtual ScheduleResult onSchedule(
PDG_WorkItem* work_item) = 0;
215 virtual void onCancelWorkItems(
221 virtual bool onStart() = 0;
225 virtual bool onStop() = 0;
228 virtual bool onStartCook(
233 virtual bool onStopCook(
bool cancel) = 0;
237 virtual void onConfigureCook(
242 virtual bool onSetupCook() = 0;
245 virtual TickResult onTick() = 0;
249 virtual AcceptResult onAcceptWorkItem(
253 virtual bool onTransferFile(
291 bool check_type)
const;
302 bool check_type)
const;
342 void setAcceptInProcess(
bool in_process);
389 virtual bool endSharedServer(
392 virtual void clearSharedServerInfo(
405 virtual void cleanTempDirectory();
408 void stop(
bool exiting);
417 void cancelCook(
bool pause);
444 void onWorkItemPriorityChanged(
446 void process(
bool skip_ready_items);
448 bool isRunning(
int count=0);
452 bool isWaitForFailures()
const;
453 bool isValidateOutputFiles()
const;
454 bool isCheckExpectedOutputFiles()
const;
455 bool isCompressWorkItemData()
const;
456 virtual PDGN::PDGN_PollingClientNNG*
459 WorkItemDataSource workItemDataSource()
const;
461 int numRunningItems()
const;
462 int numFailedItems()
const;
463 int numQueuedItems()
const;
468 void dependencyGraph(
501 template <
typename T,
typename D=T>
508 const D& default_value,
517 parm_name.
format(
"{}_{}", prefix, parm);
527 if (work_item && work_item->
isBatch())
531 if (batch_item->batchSize() > 0)
532 eval_work_item = batch_item->batchItems()[0];
535 result = default_value;
539 if (!port->
evaluate(0, result, eval_work_item, errors))
551 port->
evaluate(0, toggle_result, eval_work_item, errors);
553 if (toggle_result < 1)
560 if (!port->
evaluate(0, result, eval_work_item, errors))
568 void onWorkItemSetStringArray(
573 void onWorkItemSetFloatArray(
578 void onWorkItemSetIntArray(
583 void onWorkItemSetFileArray(
588 void onWorkItemSetDictArray(
594 void onWorkItemSetPyObject(
599 void onWorkItemSetString(
605 void onWorkItemSetFloat(
611 void onWorkItemSetInt(
617 void onWorkItemSetFile(
623 void onWorkItemSetDict(
630 void onWorkItemAddOutput(
637 void onWorkItemAddOutputs(
644 void onWorkItemAddOutputs(
651 void onWorkItemInvalidateCache(
655 void onWorkItemSucceeded(
659 void onWorkItemFailed(
662 void onWorkItemCanceled(
665 void onWorkItemStartCook(
670 void onWorkItemSetCustomState(
674 void onWorkItemSetCookPercent(
678 void onWorkItemAppendLog(
698 bool skip_defaults)
const;
706 virtual fpreal tickPeriod()
const;
707 virtual int maxItemsPerTick()
const;
708 virtual int maxConcurrentTasks()
const;
737 using ResultQueue = UT_ConcurrentQueue<Result>;
739 using PriorityQueue =
744 using SharedServerInfoMap =
757 ScheduleResult schedule(
766 void updateDefaultDirectories();
772 PriorityQueue myScheduleQueue;
773 ResultQueue myScheduleResults;
774 ResultMap myPauseResults;
775 SharedServerInfoMap mySharedServerInfo;
778 WorkItemSet myRunningItems;
779 WorkItemSet myFailedItems;
780 WorkItemSet myLongRunningItems;
782 WorkItemSet myCanceledItems;
783 NodeSet myCanceledNodes;
797 WorkItemDataSource myDataSource;
798 TempDirCleanup myTempDirCleanup;
802 bool myCancelingFlag;
807 bool myIsWaitForFailures;
808 bool myIsValidateOutputFiles;
809 bool myIsCheckExpectedOutputFiles;
810 bool myIsCompressWorkItemData;
exint PDG_WorkItemID
Type defs for unique work item IDs.
The work item was cooked, and should be marked as succeeded.
GLuint GLsizei const GLchar * message
bool isDefault(const cgltf_texture_view &tv)
const UT_StringHolder & name() const
Returns the name of the shceudler.
virtual bool startService(UT_WorkBuffer &errors, PDG_Service *service)
Starts a service using this scheduler.
The scheduler is able to handle the specified work item.
GLsizei const GLfloat * value
PDGE_Dependency * isSetupDep()
Returns the is cooked dep for this scheduler.
Comparator< PriorityComparator, Reverse > Priority
Functor that compares two work item references or pointers by priority.
GLsizei const GLchar *const * path
The scheduler is not able to handle the specified work item.
SYS_FORCE_INLINE const char * buffer() const
The call to schedule the work item succeeded.
The temp file dir is not cleaned up automatically.
The work item was cooked, and should be marked as failed.
Class which writes ASCII or binary JSON streams.
**But if you need a result
bool evaluateOverride(T &result, PDG_NodeInterface *node, const UT_StringHolder &prefix, const UT_StringHolder &parm, PDG_WorkItem *work_item, const D &default_value, UT_WorkBuffer &errors) const
virtual void addWarning(const UT_StringHolder &message) const
Adds a warning to the node interface – implemented in subclasses.
virtual bool reloadInstance(UT_WorkBuffer &errors)
The call to schedule the work item failed.
virtual PDGN::PDGN_PollingClientNNG * getPollingClient()
GLint GLint GLsizei GLint GLenum GLenum type
int64 Hash
The file hash/modtime type.
The work item was cooked, and should be marked as canceled.
bool isBatch() const
Returns true if the work tiem is a batch.
PDG_WorkItemState
Enum of possible work item states.
virtual bool stopServiceClient(UT_WorkBuffer &errors, PDG_Service *service, PDG_ServiceClient *client)
Stops the job associated with a specific client process.
const UT_StringHolder & templateName() const
virtual void addError(const UT_StringHolder &message) const
Adds an error to the node interface – implemented in subclasses.
tbb::concurrent_hash_map< K, T, H, A > UT_ConcurrentHashMap
virtual int64 getMemoryUsage(bool inclusive) const
Returns the memory usage of this owner instance.
PDG_PathMappingMode
Enumeration of path mapping modes available on the scheduler.
GLuint const GLchar * name
virtual const PDG_NodeInterface * templateInterface() const
virtual bool startServiceClient(UT_WorkBuffer &errors, PDG_Service *service, PDG_ServiceClient *client)
Starts a job for the specified service client.
PDG_WorkItemLogType
Enumeration of work item log message types.
size_t format(const char *fmt, const Args &...args)
TransferType
Enumeration of file transfer destination paths.
PDG_Port * parameter(const UT_StringHolder &name, int multi=-1) const
The scheduler cannot handle the work item at this time.
The scheduler is busy, and cannot process additional work items.
SYS_FORCE_INLINE void append(char character)
UT_StringHolder debugName() const override
Debug name method, required by PDGE_DependencyOwner.
The scheduler is ready to accept work items.
virtual PDGE_Dependency::State evalResolve(PDGE_Resolutions &, const PDGE_Evaluator &, PDGE_Dependency *)
Called when a dependency owned by this object is resolved.
Class to store JSON objects as C++ objects.
void pause(int delay) noexcept
bool process(T &func, UT_WorkBuffer &fullpath, exint fullpath_len, const UT_StringArray &paths, const UT_Array< FS_Stat > &stats)
Utility function to process the contents of the traverse() function.
#define UT_ConcurrentPriorityQueue
bool evaluate(int index, fpreal &result, const PDG_WorkItem *work_item, UT_WorkBuffer &errors) const
virtual bool stopService(UT_WorkBuffer &errors, PDG_Service *service, bool cancel)
Stops a service that was started with this scheduler.
PDGE_Dependency * isCookedDep()
Returns the is cooked dep for this scheduler.
virtual void resetOwner()
Resets the owner.
tbb::concurrent_unordered_set< K, H, P, A > UT_ConcurrentSet
SYS_FORCE_INLINE bool isstring() const
virtual const PDG_EventFilter & supportedEventTypes() const =0
Returns the list of supported event types for this emitter.