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  class FileLocation;
27 
28  /***********************/
30  /***********************/
31 
35  class Workunit {
36 
37  public:
38 
39  Workunit(
41  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation>, std::shared_ptr<FileLocation>>> pre_file_copies,
43  std::map<WorkflowFile *, std::shared_ptr<FileLocation>> file_locations,
44  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation>, std::shared_ptr<FileLocation>>> post_file_copies,
45  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation>>> cleanup_file_deletions);
46 
47  static void addDependency(std::shared_ptr<Workunit> parent, std::shared_ptr<Workunit> child);
48 
49  static std::set<std::shared_ptr<Workunit>> createWorkunits(StandardJob *job);
50 
52 
55 
57  std::set<std::shared_ptr<Workunit>> children;
59  unsigned long num_pending_parents;
60 
62  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation>, std::shared_ptr<FileLocation>>> pre_file_copies;
64  WorkflowTask *task = nullptr;
66  std::map<WorkflowFile *, std::shared_ptr<FileLocation>> file_locations;
68  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation>, std::shared_ptr<FileLocation>>> post_file_copies;
70  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation>>> cleanup_file_deletions;
71 
72 
73  ~Workunit();
74  };
75 
76  /***********************/
78  /***********************/
79 
80 };
81 
82 
83 #endif //WRENCH_WORKUNIT_H
std::vector< std::tuple< WorkflowFile *, std::shared_ptr< FileLocation > > > cleanup_file_deletions
File deletions to perform last.
Definition: Workunit.h:70
unsigned long num_pending_parents
The number of Workunits this Workunit depends on.
Definition: Workunit.h:59
StandardJob * job
The StandardJob this Workunit belongs to.
Definition: Workunit.h:54
WorkflowTask * task
Computational task to perform.
Definition: Workunit.h:64
A class to describe a unit of work that's a sub-component of a StandardJob.
Definition: Workunit.h:35
static void addDependency(std::shared_ptr< Workunit > parent, std::shared_ptr< Workunit > child)
Add a dependency between two work units (does nothing if the dependency already exists)
Definition: Workunit.cpp:94
A standard (i.e., non-pilot) workflow job that can be submitted to a ComputeService by a WMS (via a J...
Definition: StandardJob.h:37
Definition: Alarm.cpp:20
Workunit(StandardJob *job, std::vector< std::tuple< WorkflowFile *, std::shared_ptr< FileLocation >, std::shared_ptr< FileLocation >>> pre_file_copies, WorkflowTask *task, std::map< WorkflowFile *, std::shared_ptr< FileLocation >> file_locations, std::vector< std::tuple< WorkflowFile *, std::shared_ptr< FileLocation >, std::shared_ptr< FileLocation >>> post_file_copies, std::vector< std::tuple< WorkflowFile *, std::shared_ptr< FileLocation >>> cleanup_file_deletions)
Constructor.
Definition: Workunit.cpp:31
std::set< std::shared_ptr< Workunit > > children
The Workunits that depend on this Workunit.
Definition: Workunit.h:57
std::vector< std::tuple< WorkflowFile *, std::shared_ptr< FileLocation >, std::shared_ptr< FileLocation > > > pre_file_copies
File copies to perform before computational tasks begin.
Definition: Workunit.h:62
std::map< WorkflowFile *, std::shared_ptr< FileLocation > > file_locations
Locations where computational tasks should read/write files.
Definition: Workunit.h:66
std::vector< std::tuple< WorkflowFile *, std::shared_ptr< FileLocation >, std::shared_ptr< FileLocation > > > post_file_copies
File copies to perform after computational tasks completes.
Definition: Workunit.h:68
A computational task in a Workflow.
Definition: WorkflowTask.h:31
StandardJob * getJob()
Retrieve the standard job this workunit belongs to.
Definition: Workunit.cpp:229
A data file used/produced by a WorkflowTask in a Workflow.
Definition: WorkflowFile.h:26
static std::set< std::shared_ptr< Workunit > > createWorkunits(StandardJob *job)
Create all work units for a newly dispatched job.
Definition: Workunit.cpp:117