Commit a1c4ff9f authored by Millian Poquet's avatar Millian Poquet

[code] s4u: kill

parent 58cb51e7
......@@ -391,9 +391,9 @@ void batexec_job_launcher_process(BatsimContext * context,
}
string pname = "job" + job->id.to_string();
simgrid::s4u::Actor::create(pname.c_str(),
context->machines[alloc->machine_ids.first_element()]->host,
execute_job_process, context, alloc, false, nullptr);
//job->execution_processes.insert(process); TODO S4U
auto actor = simgrid::s4u::Actor::create(pname.c_str(),
context->machines[alloc->machine_ids.first_element()]->host,
execute_job_process, context, alloc, false, nullptr);
job->execution_actors.insert(actor);
}
}
......@@ -315,9 +315,9 @@ bool job_comparator_subtime_number(const Job *a, const Job *b)
Job::~Job()
{
xbt_assert(execution_processes.size() == 0,
xbt_assert(execution_actors.size() == 0,
"Internal error: job %s has %d execution processes on destruction (should be 0).",
this->id.to_string().c_str(), (int)execution_processes.size());
this->id.to_string().c_str(), (int)execution_actors.size());
if (task != nullptr)
{
......
......@@ -12,6 +12,7 @@
#include <rapidjson/document.h>
#include <simgrid/msg.h>
#include <simgrid/s4u.hpp>
#include "exact_numbers.hpp"
#include "machine_range.hpp"
......@@ -170,7 +171,7 @@ struct Job
JobIdentifier id; //!< The job unique identifier
BatTask * task = nullptr; //!< The root task be executed by this job (profile instantiation).
std::string json_description; //!< The JSON description of the job
std::set<msg_process_t> execution_processes; //!< The processes involved in running the job
std::set<simgrid::s4u::ActorPtr> execution_actors; //!< The actors involved in running the job
std::deque<std::string> incoming_message_buffer; //!< The buffer for incoming messages from the scheduler.
// Scheduler allocation and metadata
......
......@@ -9,6 +9,7 @@
#include "task_execution.hpp"
#include "server.hpp"
#include <simgrid/s4u.hpp>
#include <simgrid/plugins/energy.h>
#include <smpi/smpi.h>
......@@ -35,7 +36,7 @@ int smpi_replay_process(int argc, char *argv[])
MSG_sem_release(args->semaphore);
}
args->job->execution_processes.erase(MSG_process_self());
// args->job->execution_actors.erase(simgrid::s4u::Actor::self()); TODO S4U
delete args;
return 0;
}
......@@ -267,7 +268,8 @@ int execute_task(BatTask * btask,
msg_process_t process = MSG_process_create_with_arguments(str_pname, smpi_replay_process,
message, host_to_use, 5, argv);
job->execution_processes.insert(process);
//job->execution_processes.insert(process); TODO S4U
(void) process;
// todo: avoid memory leaks
free(str_pname);
......@@ -522,7 +524,7 @@ void execute_job_process(BatsimContext * context,
send_message("server", IPMessageType::JOB_COMPLETED, (void*)message);
}
//job->execution_processes.erase(MSG_process_self()); TODO S4U
job->execution_actors.erase(simgrid::s4u::Actor::self());
}
void waiter_process(double target_time, const ServerData * server_data)
......@@ -592,13 +594,13 @@ void killer_process(BatsimContext * context, std::vector<JobIdentifier> jobs_ids
message->jobs_progress[job_id] = job_progress;
// Let's kill all the involved processes
xbt_assert(job->execution_processes.size() > 0);
for (msg_process_t process : job->execution_processes)
xbt_assert(job->execution_actors.size() > 0);
for (simgrid::s4u::ActorPtr actor : job->execution_actors)
{
XBT_INFO("Killing process '%s'", MSG_process_get_name(process));
MSG_process_kill(process);
XBT_INFO("Killing process '%s'", actor->get_cname());
actor->kill();
}
job->execution_processes.clear();
job->execution_actors.clear();
// Let's update the job information
job->state = JobState::JOB_STATE_COMPLETED_KILLED;
......
......@@ -870,10 +870,10 @@ void server_on_execute_job(ServerData * data,
}
string pname = "job_" + job->id.to_string();
simgrid::s4u::Actor::create(pname.c_str(),
data->context->machines[allocation->machine_ids.first_element()]->host,
execute_job_process, data->context, allocation, true, message->io_profile);
// job->execution_processes.insert(process); TODO S4U
auto actor = simgrid::s4u::Actor::create(pname.c_str(),
data->context->machines[allocation->machine_ids.first_element()]->host,
execute_job_process, data->context, allocation, true, message->io_profile);
job->execution_actors.insert(actor);
}
bool is_simumation_finished(const ServerData * data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment