Skip to content

Commit

Permalink
Backend fix to handle compound jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Apr 10, 2024
1 parent 69b34a7 commit 7d7257a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tools/wrench/wrench-daemon/include/SimulationController.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ namespace wrench {
// Thread-safe queues for the server thread and the simulation thread to communicate
BlockingQueue<std::pair<double, std::shared_ptr<wrench::ExecutionEvent>>> event_queue;

BlockingQueue<std::tuple<std::shared_ptr<StandardJob>, std::shared_ptr<ComputeService>, std::map<std::string, std::string>>> submissions_to_do;
// BlockingQueue<std::tuple<std::shared_ptr<StandardJob>, std::shared_ptr<ComputeService>, std::map<std::string, std::string>>> submissions_to_do;

BlockingQueue<std::function<void()>> things_to_do;

Expand Down
25 changes: 16 additions & 9 deletions tools/wrench/wrench-daemon/src/SimulationController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,25 @@ namespace wrench {
*/
json SimulationController::eventToJSON(double date, const std::shared_ptr<wrench::ExecutionEvent> &event) {
// Construct the json event description
std::shared_ptr<wrench::StandardJob> job;
std::shared_ptr<wrench::Job> job;
json event_desc;

event_desc["event_date"] = date;
// Deal with the different event types
if (auto failed = std::dynamic_pointer_cast<wrench::StandardJobFailedEvent>(event)) {
event_desc["event_type"] = "job_failure";
event_desc["failure_cause"] = failed->failure_cause->toString();
job = failed->standard_job;
} else if (auto complete = std::dynamic_pointer_cast<wrench::StandardJobCompletedEvent>(event)) {
event_desc["event_type"] = "job_completion";
job = complete->standard_job;
if (auto failed_sj = std::dynamic_pointer_cast<wrench::StandardJobFailedEvent>(event)) {
event_desc["event_type"] = "standard_job_failure";
event_desc["failure_cause"] = failed_sj->failure_cause->toString();
job = failed_sj->standard_job;
} else if (auto complete_sj = std::dynamic_pointer_cast<wrench::StandardJobCompletedEvent>(event)) {
event_desc["event_type"] = "standard_job_completion";
job = complete_sj->standard_job;
} else if (auto failed_cj = std::dynamic_pointer_cast<wrench::CompoundJobFailedEvent>(event)) {
event_desc["event_type"] = "compound_job_failure";
event_desc["failure_cause"] = failed_cj->failure_cause->toString();
job = failed_cj->job;
} else if (auto completed_cj = std::dynamic_pointer_cast<wrench::CompoundJobCompletedEvent>(event)) {
event_desc["event_type"] = "compound_job_completion";
job = completed_cj->job;
}

event_desc["compute_service_name"] = job->getParentComputeService()->getName();
Expand All @@ -222,7 +229,7 @@ namespace wrench {
this->event_queue.waitAndPop(event);

// Construct the json event description
std::shared_ptr<wrench::StandardJob> job;
// std::shared_ptr<wrench::StandardJob> job;
json event_desc = eventToJSON(event.first, event.second);

// Construct the json answer
Expand Down

0 comments on commit 7d7257a

Please sign in to comment.