WRENCH  1.10
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
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(
40  std::shared_ptr<StandardJob> job,
41  double sleep_time,
42  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation>, std::shared_ptr<FileLocation>>> pre_file_copies,
44  std::map<WorkflowFile *, std::vector<std::shared_ptr<FileLocation>>> file_locations,
45  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation>, std::shared_ptr<FileLocation>>> post_file_copies,
46  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation>>> cleanup_file_deletions);
47 
48  static void addDependency(std::shared_ptr<Workunit> parent, std::shared_ptr<Workunit> child);
49 
50  static std::set<std::shared_ptr<Workunit>> createWorkunits(std::shared_ptr<StandardJob> job);
51 
52  std::shared_ptr<StandardJob> getJob();
53 
55  std::shared_ptr<StandardJob> job;
56 
58  std::set<std::shared_ptr<Workunit>> children;
60  unsigned long num_pending_parents;
61 
63  double sleep_time;
65  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation>, std::shared_ptr<FileLocation>>> pre_file_copies;
67  WorkflowTask *task = nullptr;
69  std::map<WorkflowFile *, std::vector<std::shared_ptr<FileLocation>>> file_locations;
71  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation>, std::shared_ptr<FileLocation>>> post_file_copies;
73  std::vector<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation>>> cleanup_file_deletions;
74 
75 
76  ~Workunit();
77  };
78 
79  /***********************/
81  /***********************/
82 
83 };
84 
85 
86 #endif //WRENCH_WORKUNIT_H
wrench::Workunit::cleanup_file_deletions
std::vector< std::tuple< WorkflowFile *, std::shared_ptr< FileLocation > > > cleanup_file_deletions
File deletions to perform last.
Definition: Workunit.h:73
wrench::Workunit::num_pending_parents
unsigned long num_pending_parents
The number of Workunits this Workunit depends on.
Definition: Workunit.h:60
wrench::Workunit::task
WorkflowTask * task
Computational task to perform.
Definition: Workunit.h:67
wrench::Workunit::Workunit
Workunit(std::shared_ptr< StandardJob > job, double sleep_time, std::vector< std::tuple< WorkflowFile *, std::shared_ptr< FileLocation >, std::shared_ptr< FileLocation >>> pre_file_copies, WorkflowTask *task, std::map< WorkflowFile *, std::vector< 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:30
wrench::Workunit
A class to describe a unit of work that's a sub-component of a StandardJob.
Definition: Workunit.h:35
wrench::Workunit::addDependency
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:100
wrench::Workunit::createWorkunits
static std::set< std::shared_ptr< Workunit > > createWorkunits(std::shared_ptr< StandardJob > job)
Create all work units for a newly dispatched job.
Definition: Workunit.cpp:123
wrench::Workunit::job
std::shared_ptr< StandardJob > job
The StandardJob this Workunit belongs to.
Definition: Workunit.h:55
wrench
Definition: Alarm.cpp:20
wrench::Workunit::children
std::set< std::shared_ptr< Workunit > > children
The Workunits that depend on this Workunit.
Definition: Workunit.h:58
wrench::Workunit::getJob
std::shared_ptr< StandardJob > getJob()
Retrieve the standard job this workunit belongs to.
Definition: Workunit.cpp:280
wrench::Workunit::pre_file_copies
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:65
wrench::Workunit::post_file_copies
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:71
wrench::WorkflowTask
A computational task in a Workflow.
Definition: WorkflowTask.h:31
wrench::Workunit::file_locations
std::map< WorkflowFile *, std::vector< std::shared_ptr< FileLocation > > > file_locations
Locations where computational tasks should read/write files.
Definition: Workunit.h:69
wrench::Workunit::sleep_time
double sleep_time
A sleep time, in seconds.
Definition: Workunit.h:63
wrench::WorkflowFile
A data file used/produced by a WorkflowTask in a Workflow.
Definition: WorkflowFile.h:26