Workunit.h
1 
10 #ifndef WRENCH_WORKUNIT_H
11 #define WRENCH_WORKUNIT_H
12 
13 
14 #include <tuple>
15 #include <set>
16 #include <map>
17 #include <vector>
18 #include <memory>
19 
20 namespace wrench {
21 
22  class StandardJob;
23  class WorkflowFile;
24  class StorageService;
25  class WorkflowTask;
26 
27  /***********************/
29  /***********************/
30 
34  class Workunit {
35 
36  public:
37 
39  std::set<std::tuple<WorkflowFile *, StorageService *, StorageService *>> pre_file_copies,
41  std::map<WorkflowFile *, StorageService *> file_locations,
42  std::set<std::tuple<WorkflowFile *, StorageService *, StorageService *>> post_file_copies,
43  std::set<std::tuple<WorkflowFile *, StorageService *>> cleanup_file_deletions);
44 
45  static void addDependency(Workunit *parent, Workunit *child);
46 
47  static std::set<std::unique_ptr<Workunit>> createWorkunits(StandardJob *job);
48 
50 
53 
55  std::set<Workunit*> children;
57  unsigned long num_pending_parents;
58 
60  std::set<std::tuple<WorkflowFile *, StorageService *, StorageService *>> pre_file_copies;
62  WorkflowTask *task = nullptr;
64  std::map<WorkflowFile *, StorageService *> file_locations;
66  std::set<std::tuple<WorkflowFile *, StorageService *, StorageService *>> post_file_copies;
68  std::set<std::tuple<WorkflowFile *, StorageService *>> cleanup_file_deletions;
69 
70 
71  ~Workunit();
72  };
73 
74  /***********************/
76  /***********************/
77 
78 };
79 
80 
81 #endif //WRENCH_WORKUNIT_H
std::set< std::tuple< WorkflowFile *, StorageService * > > cleanup_file_deletions
File deletions to perform last.
Definition: Workunit.h:68
A computational task in a Workflow.
Definition: WorkflowTask.h:26
StandardJob * getJob()
Retrieve the standard job this workunit belongs to.
Definition: Workunit.cpp:169
A class to describe a unit of work that&#39;s a sub-component of a StandardJob.
Definition: Workunit.h:34
static std::set< std::unique_ptr< Workunit > > createWorkunits(StandardJob *job)
Create all work for a newly dispatched job.
Definition: Workunit.cpp:78
Workunit(StandardJob *job, std::set< std::tuple< WorkflowFile *, StorageService *, StorageService *>> pre_file_copies, WorkflowTask *task, std::map< WorkflowFile *, StorageService *> file_locations, std::set< std::tuple< WorkflowFile *, StorageService *, StorageService *>> post_file_copies, std::set< std::tuple< WorkflowFile *, StorageService *>> cleanup_file_deletions)
Constructor.
Definition: Workunit.cpp:27
std::set< Workunit * > children
The Workunits that depend on this Workunit.
Definition: Workunit.h:55
A standard (i.e., non-pilot) workflow job that can be submitted to a ComputeService by a WMS (via a J...
Definition: StandardJob.h:38
unsigned long num_pending_parents
The number of Workunits this Workunit depends on.
Definition: Workunit.h:57
static void addDependency(Workunit *parent, Workunit *child)
Add a dependency between two work units (does nothing if the dependency already exists) ...
Definition: Workunit.cpp:55
std::map< WorkflowFile *, StorageService * > file_locations
Locations where computational tasks should read/write files.
Definition: Workunit.h:64
std::set< std::tuple< WorkflowFile *, StorageService *, StorageService * > > post_file_copies
File copies to perform after computational tasks completes.
Definition: Workunit.h:66
StandardJob * job
The StandardJob this Workunit belongs to.
Definition: Workunit.h:52
WorkflowTask * task
Computational task to perform.
Definition: Workunit.h:62
Definition: TerminalOutput.cpp:15
std::set< std::tuple< WorkflowFile *, StorageService *, StorageService * > > pre_file_copies
File copies to perform before computational tasks begin.
Definition: Workunit.h:60