Skip to content

Commit

Permalink
tmp commit (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Sep 27, 2019
1 parent d032a57 commit f69f991
Show file tree
Hide file tree
Showing 15 changed files with 1,319 additions and 1,015 deletions.
142 changes: 72 additions & 70 deletions include/wrench/managers/JobManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,106 +19,108 @@
namespace wrench {

class WMS;
class Workflow;
class WorkflowTask;
class WorkflowFile;
class WorkflowJob;
class PilotJob;
class StandardJob;
class ComputeService;
class StorageService;

/***********************/
/** \cond DEVELOPER */
/***********************/
class Workflow;
class WorkflowTask;
class WorkflowFile;
class WorkflowJob;
class PilotJob;
class StandardJob;
class ComputeService;
class StorageService;

/***********************/
/** \cond DEVELOPER */
/***********************/


/**
* @brief A helper daemon (co-located with and explicitly started by a WMS), which is used to
* handle all job executions
*/
class JobManager : public Service {

public:

/**
* @brief A helper daemon (co-located with and explicitly started by a WMS), which is used to
* handle all job executions
*/
class JobManager : public Service {

public:
void stop() override;

void kill();

void stop() override;

void kill();
StandardJob *createStandardJob(std::vector<WorkflowTask *> tasks,
std::map<WorkflowFile *, std::shared_ptr<FileLocation> > file_locations,
std::set<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation> , std::shared_ptr<FileLocation> >> pre_file_copies,
std::set<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation> , std::shared_ptr<FileLocation> >> post_file_copies,
std::set<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation> >> cleanup_file_deletions);

StandardJob *createStandardJob(std::vector<WorkflowTask *> tasks,
std::map<WorkflowFile *, std::shared_ptr<FileLocation> > file_locations,
std::set<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation> , std::shared_ptr<FileLocation> >> pre_file_copies,
std::set<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation> , std::shared_ptr<FileLocation> >> post_file_copies,
std::set<std::tuple<WorkflowFile *, std::shared_ptr<FileLocation> >> cleanup_file_deletions);

StandardJob *createStandardJob(std::vector<WorkflowTask *> tasks,
std::map<WorkflowFile *,
std::shared_ptr<FileLocation> > file_locations);
StandardJob *createStandardJob(std::vector<WorkflowTask *> tasks,
std::map<WorkflowFile *,
std::shared_ptr<FileLocation> > file_locations);

StandardJob *createStandardJob(WorkflowTask *task,
std::map<WorkflowFile *,
std::shared_ptr<FileLocation> > file_locations);
StandardJob *createStandardJob(WorkflowTask *task,
std::map<WorkflowFile *,
std::shared_ptr<FileLocation> > file_locations);

PilotJob *createPilotJob();
PilotJob *createPilotJob();

void submitJob(WorkflowJob *job, std::shared_ptr<ComputeService> compute_service, std::map<std::string, std::string> service_specific_args = {});
void submitJob(WorkflowJob *job, std::shared_ptr<ComputeService> compute_service, std::map<std::string, std::string> service_specific_args = {});

void terminateJob(WorkflowJob *);
void terminateJob(WorkflowJob *);

void forgetJob(WorkflowJob *job);
void forgetJob(WorkflowJob *job);

std::set<PilotJob *> getPendingPilotJobs();
std::set<PilotJob *> getPendingPilotJobs();

std::set<PilotJob *> getRunningPilotJobs();
/***********************/
/** \cond INTERNAL */
/***********************/
std::set<PilotJob *> getRunningPilotJobs();
/***********************/
/** \cond INTERNAL */
/***********************/

~JobManager() override;
~JobManager() override;

protected:
protected:

friend class WMS;
friend class WMS;

explicit JobManager(std::shared_ptr<WMS> wms);
explicit JobManager(std::shared_ptr<WMS> wms);

/***********************/
/** \endcond */
/***********************/
/***********************/
/** \endcond */
/***********************/

private:
private:

int main() override;
bool processNextMessage();
void processStandardJobCompletion(StandardJob *job, std::shared_ptr<ComputeService> compute_service);
void processStandardJobFailure(StandardJob *job, std::shared_ptr<ComputeService> compute_service, std::shared_ptr<FailureCause> cause);
void processPilotJobStart(PilotJob *job, std::shared_ptr<ComputeService> compute_service);
void processPilotJobExpiration(PilotJob *job, std::shared_ptr<ComputeService> compute_service);
int main() override;
bool processNextMessage();
void processStandardJobCompletion(StandardJob *job, std::shared_ptr<ComputeService> compute_service);
void processStandardJobFailure(StandardJob *job, std::shared_ptr<ComputeService> compute_service, std::shared_ptr<FailureCause> cause);
void processPilotJobStart(PilotJob *job, std::shared_ptr<ComputeService> compute_service);
void processPilotJobExpiration(PilotJob *job, std::shared_ptr<ComputeService> compute_service);



// Relevant WMS
std::shared_ptr<WMS> wms;
// Relevant WMS
std::shared_ptr<WMS> wms;

// Job map
std::map<WorkflowJob*, std::unique_ptr<WorkflowJob>> jobs;
// Job map
std::map<WorkflowJob*, std::unique_ptr<WorkflowJob>> jobs;

// Job lists
std::set<StandardJob *> pending_standard_jobs;
std::set<StandardJob *> running_standard_jobs;
std::set<StandardJob *> completed_standard_jobs;
std::set<StandardJob *> failed_standard_jobs;
// Job lists
std::set<StandardJob *> pending_standard_jobs;
std::set<StandardJob *> running_standard_jobs;
std::set<StandardJob *> completed_standard_jobs;
std::set<StandardJob *> failed_standard_jobs;

std::set<PilotJob *> pending_pilot_jobs;
std::set<PilotJob *> running_pilot_jobs;
std::set<PilotJob *> completed_pilot_jobs;
std::set<PilotJob *> pending_pilot_jobs;
std::set<PilotJob *> running_pilot_jobs;
std::set<PilotJob *> completed_pilot_jobs;

};
};

/***********************/
/** \endcond */
/***********************/
/***********************/
/** \endcond */
/***********************/

};

Expand Down
Loading

0 comments on commit f69f991

Please sign in to comment.