HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_Scheduler.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  */
8 
9 #ifndef __PDG_SCHEDULER_H__
10 #define __PDG_SCHEDULER_H__
11 
12 #include "PDG_API.h"
13 
14 #include "PDG_AttributeFile.h"
15 #include "PDG_AttributePrimitive.h"
16 #include "PDG_BatchWorkItem.h"
17 #include "PDG_CookOptions.h"
18 #include "PDG_EventEmitter.h"
19 #include "PDG_EventTypes.h"
20 #include "PDG_File.h"
21 #include "PDG_FileUtils.h"
22 #include "PDG_NodeInterface.h"
23 #include "PDG_WorkItemSort.h"
24 
25 #include <PDGT/PDGT_ValueArgs.h>
26 
27 #include <UT/UT_Array.h>
30 #include <UT/UT_ConcurrentQueue.h>
31 #include <UT/UT_ConcurrentSet.h>
32 #include <UT/UT_Map.h>
33 #include <UT/UT_Options.h>
34 #include <UT/UT_StringArray.h>
35 #include <UT/UT_StringHolder.h>
36 #include <UT/UT_TBBSpinLock.h>
37 
38 #include <time.h>
39 
40 class PDG_CookState;
41 class PDG_GraphContext;
42 class PDG_Node;
43 class PDG_Service;
44 class PDG_SchedulerType;
45 class PDG_WorkItem;
46 
47 class UT_JSONValue;
48 class UT_JSONWriter;
49 
50 namespace PDGN
51 {
52 class PDGN_PollingClientNNG;
53 }
54 
55 /*
56  * Base class for scheduler nodes, which process work items and run them
57  * either in process or out of process
58  */
60  public PDG_EventEmitter,
61  public PDG_TypeInstance,
63 {
64 public:
65  /*
66  * Enumeration of possible return values from onScheduler callback
67  */
69  {
70  /// The work item was cooked, and should be marked as canceled
72 
73  /// The work item was cooked, and should be marked as failed
75 
76  /// The work item was cooked, and should be marked as succeeded
78 
79  /// The call to schedule the work item failed
81 
82  /// The call to schedule the work item succeeded
84 
85  /// The scheduler cannot handle the work item at this time
87 
88  /// The scheduler cannot handle any work items at this time, and
89  /// all further scheduling requests will be deferred
90  eFullDeferred
91  };
92 
93  /*
94  * Enumeration of possible return values from onTick callback
95  */
97  {
98  /// The scheduler is ready to accept work items
100 
101  /// The scheduler is busy, and cannot process additional work items
103 
104  /// The scheduler has encountered some sort of fatal error or request
105  /// to cancel, and will not longer accept work items for the remainder
106  /// of the cook.
107  eSchedulerCancelCook
108  };
109 
110  /*
111  * Enumeration of possible return values from onAcceptWorkItem callback
112  */
114  {
115  /// The scheduler is able to handle the specified work item
117 
118  /// The scheduler is not able to handle the specified work item
120 
121  /// The scheduler cannot tell if can/can't schedule the specified
122  /// work item, and the default logic for checking should be used
123  /// instead
124  eSchedulerDefault
125  };
126 
127  /*
128  * Enumeration of path mapping modes available on the scheduler
129  */
131  {
132  /// Use the default, global path mapping
134 
135  /// Disable path mapping
136  eNoPathMapping
137  };
138 
139  /*
140  * Enumeration of work item data transfer modes
141  */
143  {
144  /// Work item data is transfered to the farm using a shared
145  /// drive, by writing it to .json file on disk.
147 
148  /// Work item data is transfered via RPC
149  eSourceRPCMessage
150  };
151 
152  /*
153  * Enumeration of temp dir cleanup options
154  */
156  {
157  /// The temp file dir is not cleaned up automatically
159 
160  /// The temp file dir is cleaned up when the scheduler is removed or
161  /// the session shuts down
163 
164  /// The temp file dir is cleaned up after the scheduler finishes
165  /// cooking
166  eCleanupCook
167  };
168 
169  /// The key for the name of the scheduler when writing it to JSON
171 
172  /// The key for the type of the scheduler when writing it to JSON
174 
175  /// The key for the parameters of the scheduler when writing them to JSON
177 
178 public:
180  const PDG_BaseType* type,
181  const PDGT_ValueArgs& extra_args,
182  const UT_StringHolder& name);
183  ~PDG_Scheduler() override;
184 
185  /// Returns the list of supported event types
186  const PDG_EventFilter& supportedEventTypes() const override;
187 
188  int64 getMemoryUsage(bool inclusive) const override;
189 
190  /// Debug name method, required by PDGE_DependencyOwner
191  UT_StringHolder debugName() const override
192  { return name(); }
193 
194  /// Resets the dependency owner
195  void resetOwner() override;
196 
197  /// Returns the is cooked dep for this scheduler
199  { return &myIsCookedDep; }
200 
201  /// Returns the is cooked dep for this scheduler
203  { return &myIsSetupDep; }
204 
205  /// Returns the name of the shceudler
206  const UT_StringHolder& name() const
207  { return myName; }
208 
209  /// Called when the type object should reload itself because of a change
210  /// to the underlying Python module
211  bool reloadInstance(UT_WorkBuffer& errors) override;
212 
213  /// Returns the node interface/template that describes the default
214  /// parameters and connections for the scheduler
215  const PDG_NodeInterface* templateInterface() const override;
216 
217  /// Returns true if the scheduler is able to queue the specified work item,
218  /// else false.
219  bool canSchedule(const PDG_WorkItem* work_item);
220 
221  /// Called when the scheduler should process a static dependency graph
222  virtual void onScheduleStatic(
223  const PDG_WorkItemMap& dependencies,
224  const PDG_WorkItemMap& dependents,
225  const PDG_WorkItemArray& ready_items) = 0;
226 
227  /// Called whenever the scheduler should schedule a work item. This is a
228  /// required callback.
229  virtual ScheduleResult onSchedule(PDG_WorkItem* work_item) = 0;
230 
231  /// Called when a specific work item should be canceled
232  virtual void onCancelWorkItems(
233  const PDG_WorkItemArray& work_item,
234  PDG_Node* node) = 0;
235 
236  /// Called when the scheduler is first started, should be used to initialize
237  /// scheduler state, threads, etc. This is an optional callback.
238  virtual bool onStart() = 0;
239 
240  /// Called when the scheduler is stopped, to clean up any resources held
241  /// by the scheduler (sockets, threads, etc). Optional callback.
242  virtual bool onStop() = 0;
243 
244  /// Called when cooking begins
245  virtual bool onStartCook(
246  bool static_cook,
247  const PDG_NodeSet&) = 0;
248 
249  /// Called when cooking completes or is canceled
250  virtual bool onStopCook(bool cancel) = 0;
251 
252  /// Called once at the start of the cook, to allow the scheduler to
253  /// set any custom cook options
254  virtual void onConfigureCook(
255  PDG_CookOptions* cook_ptions) = 0;
256 
257  /// Called at the before cooking on the background thread to setup
258  /// anything needed for a cook.
259  virtual bool onSetupCook() = 0;
260 
261  /// Called periodically during cooking to update state
262  virtual TickResult onTick() = 0;
263 
264  /// Returns an enum indicating whether or not the scheduler accepts the
265  /// specified work item
266  virtual AcceptResult onAcceptWorkItem(
267  const PDG_WorkItem* work_item) = 0;
268 
269  /// Custom file transfer logic, implemented per-scheduler
270  virtual bool onTransferFile(
271  const UT_StringHolder& file_path);
272 
273  /// Transfers a file from the local machine to the machine that will be
274  /// executing processor tasks, e.g. a remote machine on the farm. This
275  /// callback is required since the main PDG code depends on its existence.
276  /// At a later point we may be able to make this optional.
277  bool transferFile(
278  const UT_StringHolder& file_path,
279  PDG_FileUtils::TransferType default_type,
280  UT_WorkBuffer& errors) const;
281 
282  /// Returns the path on the scheduler that a local file will be copied
283  /// to, using the standard file transfer mechanism
284  UT_StringHolder formatTransferPath(
285  const UT_StringHolder& local_path,
286  PDG_FileUtils::TransferType default_type,
287  bool local) const;
288 
289  /// Returns the local version of the given path.
290  UT_StringHolder localizePath(
291  const UT_StringHolder& deloc_path) const;
292 
293  /// Returns the delocalized (remote) version of the given local path.
294  UT_StringHolder delocalizePath(
295  const UT_StringHolder& local_path) const;
296 
297  /// Returns the job name for the specified work item
298  UT_StringHolder jobName(const PDG_WorkItem* work_item) const;
299 
300  /// Expands special tokens in the command string
301  virtual UT_StringHolder expandCommandTokens(
302  const UT_StringHolder& command,
303  const PDG_WorkItem* work_item) = 0;
304 
305  /// cook the output node in the graph context of the given file as a single job
306  virtual UT_StringHolder submitAsJob(
307  const UT_StringHolder& graph_file,
308  const UT_StringHolder& node_name) = 0;
309 
310  /// set the working directory local and network path, equivalent
311  /// to the __PDG_DIR__
312  void setWorkingDir(
313  const UT_StringHolder& local_path,
314  const UT_StringHolder& remote_path);
315  /// set the temp directory local and network path, equivalent
316  /// to the __PDG_TEMP__
317  void setTempDir(
318  const UT_StringHolder& local_path,
319  const UT_StringHolder& remote_path);
320  /// set the script directory local and network path, equivalent
321  /// to the __PDG_SCRIPTDIR__
322  void setScriptDir(
323  const UT_StringHolder& local_path,
324  const UT_StringHolder& remote_path);
325 
326  /// sets whether or not the scheduler accepts in-process work items
327  void setAcceptInProcess(bool in_process);
328 
329  /// returns the working directory (network) path, equivalent
330  /// to the __PDG_DIR__ command token when local is false.
331  /// When local is true, returns the absolute path to the shared root
332  /// on the local file system
333  UT_StringHolder workingDir(bool local) const;
334 
335  /// returns the temp directory (network) path, equivalent
336  /// to the __PDG_TEMP__ command token when local is false.
337  /// When local is true, returns the absolute path to the shared temp
338  /// on the local file system
339  UT_StringHolder tempDir(bool local) const;
340 
341  /// returns the temp script directory (network) path, equivalent
342  /// to the __PDG_SCRIPTDIR__ command token when local is false.
343  /// When local is true, returns the absolute path to the temp
344  /// script on the local file system
345  UT_StringHolder scriptDir(bool local) const;
346 
347  /// Returns the path to the directory where log files generated during the
348  /// cook should be written.
349  /// When local is true, returns the aboslute path on the local file system.
350  UT_StringHolder logDir(bool local) const;
351 
352  /// Returns the path to the directory where work items are serialized
353  /// before their commands are executed.
354  /// When local is true, returns the aboslute path on the local file system.
355  UT_StringHolder dataDir(bool local) const;
356 
357  /// Returns the path to an application for the given name, for example
358  /// "python", "hython"
359  virtual UT_StringHolder applicationBin(
360  const UT_StringHolder& name,
361  const PDG_WorkItem* work_item);
362 
363  /// returns the server endpoint for work item results, in format <HOST>:<PORT>,
364  /// equivalent to the __PDG_RESULT_SERVER__ command token
365  virtual UT_StringHolder workItemResultServerAddr() = 0;
366 
367  /// returns a URI for the workitem cook log (text file)
368  virtual UT_StringHolder getLogURI(const PDG_WorkItem* work_item) = 0;
369 
370  /// returns a URI for the workitem status page if relevant
371  virtual UT_StringHolder getStatusURI(const PDG_WorkItem* work_item) = 0;
372 
373  /// Terminate the give shared server
374  virtual bool endSharedServer(
375  const UT_StringHolder& sharedserver_name) = 0;
376  /// Clears metadata associated with the given shared server name
377  virtual void clearSharedServerInfo(
378  const UT_StringHolder &sharedserver_name);
379  /// Sets metadata associated with the given shared server name, returns full name
380  virtual UT_StringHolder setSharedServerInfo(
381  const UT_StringHolder &sharedserver_name,
382  const PDGT_ValueArgs& info);
383  /// Gets metadata associated with the given shared server name
384  PDGT_ValueArgs getSharedServerInfo(
385  const UT_StringHolder &sharedserver_name);
386  /// Gets the list of shared servers
387  UT_StringArray getSharedServers();
388 
389  /// Delete the temporary directory and all its contents
390  virtual void cleanTempDirectory();
391 
392  /// Called to stop the scheduler
393  void stop(bool exiting);
394 
395  /// Called when a cook begins with the cook state data for that cook
396  bool startCook(PDG_CookState& cook_state);
397 
398  /// Called when a cook stops
399  void stopCook();
400 
401  /// Cancels an active cook
402  void cancelCook(bool pause);
403 
404  /// Ticks the scheduler
405  bool tick(PDG_Scheduler::TickResult& tick_result);
406 
407  /// Cooks a specific work item using it's internal cook method
408  bool cookWorkItem(PDG_WorkItem* work_item);
409 
410 
411  /// Submits a static cook with this scheduler
412  void submitStatic();
413 
414 
415  /// Queues a work item and returns a state that represents the result of
416  /// the operation
417  virtual PDG_WorkItemState queueWorkItem(PDG_WorkItem* work_item);
418 
419  /// Removes a work item from any internal tracking lists
420  void removeWorkItem(const PDG_WorkItem* work_item);
421 
422 
423  /// Cancels a cook for a specific work tiem
424  void cancelWorkItem(PDG_WorkItem* work_item);
425 
426  /// Cancels a cook for a specific node
427  void cancelNode(PDG_Node* node);
428 
429  void onWorkItemPriorityChanged(
430  PDG_WorkItem* work_item);
431  void process(bool skip_ready_items);
432 
433  bool isRunning(int count=0);
434  bool isRunning(const PDG_WorkItem* work_item);
435  bool isDefault();
436 
437  bool isWaitForFailures() const;
438  bool isValidateOutputFiles() const;
439  bool isCheckExpectedOutputFiles() const;
440  bool isCompressWorkItemData() const;
441  virtual PDGN::PDGN_PollingClientNNG*
442  getPollingClient() { return nullptr; }
443 
444  WorkItemDataSource workItemDataSource() const;
445 
446  int numRunningItems() const;
447  int numFailedItems() const;
448  int numQueuedItems() const;
449 
450  void setContext(PDG_GraphContext* context);
451  PDG_GraphContext* context() const;
452 
453  void dependencyGraph(
454  PDG_WorkItemMap& dependencies,
455  PDG_WorkItemMap& dependents,
456  PDG_WorkItemArray& ready,
457  bool expand);
458 
459  /// Starts a service using this scheduler
460  virtual bool startService(
461  UT_WorkBuffer& errors,
462  PDG_Service* service)
463  { return false; }
464 
465  /// Stops a service that was started with this scheduler
466  virtual bool stopService(
467  UT_WorkBuffer& errors,
468  PDG_Service* service)
469  { return false; }
470 
471  template <typename T, typename D=T>
473  T& result,
474  PDG_NodeInterface* node,
475  const UT_StringHolder& prefix,
476  const UT_StringHolder& parm,
477  PDG_WorkItem* work_item,
478  const D& default_value,
479  UT_WorkBuffer& errors) const
480  {
481  UT_WorkBuffer parm_name;
482  UT_WorkBuffer toggle_name;
483 
484  if (prefix.isstring() && prefix.length() > 0)
485  {
486  toggle_name.format("{}_override_toggle", templateName());
487  parm_name.format("{}_{}", prefix, parm);
488  }
489  else
490  {
491  parm_name.append(parm);
492  }
493 
494  // If the user supplied us with a batch item, evaluate against the first
495  // sub item instead
496  PDG_WorkItem* eval_work_item = work_item;
497  if (work_item && work_item->isBatch())
498  {
499  auto batch_item =
500  static_cast<PDG_BatchWorkItem*>(work_item);
501  if (batch_item->batchSize() > 0)
502  eval_work_item = batch_item->batchItems()[0];
503  }
504 
505  result = default_value;
506  PDG_Port* port = parameter(parm_name.buffer());
507  if (port)
508  {
509  if (!port->evaluate(0, result, eval_work_item, errors))
510  return false;
511  }
512 
513  if (!node)
514  return true;
515 
516  port = node->parameter(toggle_name.buffer());
517 
518  if (port)
519  {
520  exint toggle_result;
521  port->evaluate(0, toggle_result, eval_work_item, errors);
522 
523  if (toggle_result < 1)
524  return true;
525  }
526 
527  port = node->parameter(parm_name.buffer());
528  if (port)
529  {
530  if (!port->evaluate(0, result, eval_work_item, errors))
531  return false;
532  }
533 
534  return true;
535  }
536 
537 
538  void onWorkItemSetStringArray(
539  PDG_WorkItemID work_item_id,
540  int index,
541  const UT_StringHolder& attribute_name,
543  void onWorkItemSetFloatArray(
544  PDG_WorkItemID work_item_id,
545  int index,
546  const UT_StringHolder& attribute_name,
548  void onWorkItemSetIntArray(
549  PDG_WorkItemID work_item_id,
550  int index,
551  const UT_StringHolder& attribute_name,
553  void onWorkItemSetFileArray(
554  PDG_WorkItemID work_item_id,
555  int index,
556  const UT_StringHolder& attribute_name,
558  void onWorkItemSetDictArray(
559  PDG_WorkItemID work_item_id,
560  int index,
561  const UT_StringHolder& attribute_name,
563 
564  void onWorkItemSetPyObject(
565  PDG_WorkItemID work_item_id,
566  int index,
567  const UT_StringHolder& attribute_name,
568  const UT_StringHolder& pyobject_repr);
569  void onWorkItemSetString(
570  PDG_WorkItemID work_item_id,
571  int index,
572  const UT_StringHolder& attribute_name,
573  const UT_StringHolder& value,
574  int attrib_index);
575  void onWorkItemSetFloat(
576  PDG_WorkItemID work_item_id,
577  int index,
578  const UT_StringHolder& attribute_name,
579  fpreal value,
580  int attrib_index);
581  void onWorkItemSetInt(
582  PDG_WorkItemID work_item_id,
583  int index,
584  const UT_StringHolder& attribute_name,
585  exint value,
586  int attrib_index);
587  void onWorkItemSetFile(
588  PDG_WorkItemID work_item_id,
589  int index,
590  const UT_StringHolder& attribute_name,
592  int attrib_index);
593  void onWorkItemSetDict(
594  PDG_WorkItemID work_item_id,
595  int index,
596  const UT_StringHolder& attribute_name,
597  const UT_OptionsHolder& dict_repr,
598  int attrib_index);
599 
600  void onWorkItemAddOutput(
601  PDG_WorkItemID work_item_id,
602  int index,
603  const UT_StringHolder& path,
604  const UT_StringHolder& tag,
605  PDG_File::Hash hash_code,
606  bool active_only);
607  void onWorkItemAddOutputs(
608  PDG_WorkItemID work_item_id,
609  int index,
610  const UT_StringArray& paths,
611  const UT_StringHolder& tags,
612  const PDG_File::HashArray& hashes,
613  bool active_only);
614  void onWorkItemAddOutputs(
615  PDG_WorkItemID work_item_id,
616  int index,
617  const UT_StringArray& paths,
618  const UT_StringArray& tags,
619  const PDG_File::HashArray& hashes,
620  bool active_only);
621  void onWorkItemInvalidateCache(
622  PDG_WorkItemID work_item_id,
623  int index);
624 
625  void onWorkItemSucceeded(
626  PDG_WorkItemID work_item_id,
627  int index,
628  fpreal cook_duration);
629  void onWorkItemFailed(
630  PDG_WorkItemID work_item_id,
631  int index);
632  void onWorkItemCanceled(
633  PDG_WorkItemID work_item_id,
634  int index);
635  void onWorkItemStartCook(
636  PDG_WorkItemID work_item_id,
637  int index,
638  bool clear_outputs);
639 
640  void onWorkItemSetCustomState(
641  PDG_WorkItemID work_item_id,
642  int index,
643  const UT_StringHolder& custom_state);
644  void onWorkItemSetCookPercent(
645  PDG_WorkItemID work_item_id,
646  int index,
647  fpreal &cook_percent);
648  void onWorkItemAppendLog(
649  PDG_WorkItemID work_item_id,
650  int index,
651  const UT_StringHolder& log_data,
652  PDG_WorkItemLogType log_type);
653 
654  PDG_WorkItemEvalState isWorkItemReady(
655  PDG_WorkItemID work_item_id,
656  int index);
657 
658  /// Emits errors or warnings from the scheduler as PDG_Events
659  void addError(
660  const UT_StringHolder& message) const override;
661  void addWarning(
662  const UT_StringHolder& message) const override;
663 
664  /// Writes the current parameter value configuration of this scheduler
665  /// to JSON
666  bool asJSON(
667  UT_JSONWriter& writer,
668  bool skip_defaults) const;
669 
670  /// Reads and constructs a scheduler from JSON and returns the instance
671  static PDG_Scheduler* fromJSON(
672  const UT_JSONValue* value,
673  PDG_GraphContext* context,
674  UT_WorkBuffer& errors);
675 
676  virtual fpreal tickPeriod() const;
677  virtual int maxItemsPerTick() const;
678  virtual int maxConcurrentTasks() const;
679 
680  PathMappingMode mapMode() const;
681 
682 protected:
683  /// Find the workitem and report error if not found
684  PDG_WorkItem* workItemChecked(
685  PDG_WorkItemID work_item_id,
686  int index);
687 
689  PDGE_Resolutions& resolutions,
690  const PDGE_Evaluator& evaluator,
691  PDGE_Dependency* dependency) override;
692 
693 private:
694  struct Result
695  {
696  PDG_WorkItemState myState;
697  PDG_WorkItemID myId;
698  fpreal myDuration;
699  int myIndex;
700  bool myUnresolve;
701  };
702 
703  using ResultMap = UT_Map<PDG_WorkItemID, Result>;
704  using ResultQueue = UT_ConcurrentQueue<Result>;
705 
706  using PriorityQueue =
709  using WorkItemSet = UT_ConcurrentSet<PDG_WorkItemID>;
710  using NodeSet = UT_ConcurrentSet<PDG_Node*>;
711  using SharedServerInfoMap =
712  UT_ConcurrentHashMap<UT_StringHolder, PDGT_ValueArgs>;
713 
714 private:
715  ScheduleResult schedule(
716  PDG_WorkItem* work_item,
717  UT_Array<Result>& pending);
718  int markCompleted(
719  const Result& result,
720  UT_Array<Result>& pending);
721  PDG_WorkItem* workItem(
722  PDG_WorkItemID work_item_id,
723  int index);
724  void updateDefaultDirectories();
725 
726 private:
727  PDGE_Dependency myIsCookedDep;
728  PDGE_Dependency myIsSetupDep;
729 
730  PriorityQueue myScheduleQueue;
731  ResultQueue myScheduleResults;
732  ResultMap myPauseResults;
733  SharedServerInfoMap mySharedServerInfo;
734  PDG_WorkItemIDSet myPausedItems;
735 
736  WorkItemSet myRunningItems;
737  WorkItemSet myFailedItems;
738  WorkItemSet myLongRunningItems;
739 
740  WorkItemSet myCanceledItems;
741  NodeSet myCanceledNodes;
742 
743  UT_StringHolder myName;
744  UT_StringHolder myLocalWorkingDir;
745  UT_StringHolder myLocalTempDir;
746  UT_StringHolder myLocalScriptDir;
747  UT_StringHolder myRemoteWorkingDir;
748  UT_StringHolder myRemoteTempDir;
749  UT_StringHolder myRemoteScriptDir;
750 
751  PDG_GraphContext* myContext;
752  const PDG_SchedulerType* myTypeObject;
753 
754  time_t myLastTick;
755  WorkItemDataSource myDataSource;
756  TempDirCleanup myTempDirCleanup;
757 
758  UT_TBBSpinLock myProcessLock;
759 
760  bool myCancelingFlag;
761  bool myPausingFlag;
762  bool myStaticCook;
763  bool myInProcess;
764 
765  bool myIsWaitForFailures;
766  bool myIsValidateOutputFiles;
767  bool myIsCheckExpectedOutputFiles;
768  bool myIsCompressWorkItemData;
769 };
770 
771 #endif /* __PDG_SCHEDULER_H__ */
exint PDG_WorkItemID
Type defs for unique work item IDs.
The work item was cooked, and should be marked as succeeded.
Definition: PDG_Scheduler.h:77
GLuint GLsizei const GLchar * message
Definition: glcorearb.h:2543
static const UT_StringHolder theTypeKey
The key for the type of the scheduler when writing it to JSON.
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.
Use the default, global path mapping.
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.
#define PDG_API
Definition: PDG_API.h:23
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
The scheduler is not able to handle the specified work item.
int64 exint
Definition: SYS_Types.h:125
SYS_FORCE_INLINE const char * buffer() const
The call to schedule the work item succeeded.
Definition: PDG_Scheduler.h:83
The temp file dir is not cleaned up automatically.
The work item was cooked, and should be marked as failed.
Definition: PDG_Scheduler.h:74
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
**But if you need a result
Definition: thread.h:613
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.
static const UT_StringHolder theParametersKey
The key for the parameters of the scheduler when writing them to JSON.
PDG_WorkItemEvalState
virtual bool reloadInstance(UT_WorkBuffer &errors)
The call to schedule the work item failed.
Definition: PDG_Scheduler.h:80
virtual PDGN::PDGN_PollingClientNNG * getPollingClient()
int64 Hash
The file hash/modtime type.
Definition: PDG_File.h:39
exint length() const
The work item was cooked, and should be marked as canceled.
Definition: PDG_Scheduler.h:71
bool isBatch() const
Returns true if the work tiem is a batch.
PDG_WorkItemState
Enum of possible work item states.
const UT_StringHolder & templateName() const
virtual void addError(const UT_StringHolder &message) const
Adds an error to the node interface – implemented in subclasses.
long long int64
Definition: SYS_Types.h:116
virtual int64 getMemoryUsage(bool inclusive) const
Returns the memory usage of this owner instance.
GLuint const GLchar * name
Definition: glcorearb.h:786
virtual const PDG_NodeInterface * templateInterface() const
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.
Definition: PDG_FileUtils.h:83
PDG_Port * parameter(const UT_StringHolder &name, int multi=-1) const
virtual bool stopService(UT_WorkBuffer &errors, PDG_Service *service)
Stops a service that was started with this scheduler.
fpreal64 fpreal
Definition: SYS_Types.h:277
The scheduler cannot handle the work item at this time.
Definition: PDG_Scheduler.h:86
GLuint index
Definition: glcorearb.h:786
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.
Definition: PDG_Scheduler.h:99
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.
Definition: UT_JSONValue.h:99
void pause(int delay) noexcept
Definition: thread.h:102
Definition: core.h:1131
#define UT_ConcurrentPriorityQueue
bool evaluate(int index, fpreal &result, const PDG_WorkItem *work_item, UT_WorkBuffer &errors) const
PDGE_Dependency * isCookedDep()
Returns the is cooked dep for this scheduler.
type
Definition: core.h:1059
virtual void resetOwner()
Resets the owner.
static const UT_StringHolder theNameKey
The key for the name of the scheduler when writing it to JSON.
GLint GLsizei count
Definition: glcorearb.h:405
SYS_FORCE_INLINE bool isstring() const
virtual const PDG_EventFilter & supportedEventTypes() const =0
Returns the list of supported event types for this emitter.