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