Commit 1817fb5e authored by Millian Poquet's avatar Millian Poquet
Browse files

[code] fix #12: multiple kill of jobs failed

parent b5de8b24
......@@ -289,6 +289,12 @@ add_test(kill
-bod /tmp/batsim_tests/kill
-bwd ${CMAKE_SOURCE_DIR})
add_test(kill_multiple
${CMAKE_SOURCE_DIR}/tools/experiments/execute_instances.py
${CMAKE_SOURCE_DIR}/test/test_kill_multiple.yaml
-bod /tmp/batsim_tests/kill_multiple
-bwd ${CMAKE_SOURCE_DIR})
add_test(pybatsim_tests
${CMAKE_SOURCE_DIR}/tools/experiments/execute_instances.py
${CMAKE_SOURCE_DIR}/test/pybatsim_tests.yaml
......
Subproject commit 08732915ca8deb9dbe25253773604cfeb66f52c2
Subproject commit 52216b1972ef11126468b46ab13dbfb95f969295
......@@ -47,6 +47,8 @@ struct Job
int required_nb_res; //!< The number of resources the job is requested to be executed on
std::string kill_reason; //!< If the job has been killed, the kill reason is stored in this variable
bool kill_requested = false; //!< Whether the job kill has been requested
std::set<msg_process_t> execution_processes; //!< The processes involved in running the job
std::string json_description; //!< The JSON description of the job
......
......@@ -614,17 +614,27 @@ void server_on_kill_jobs(ServerData * data,
KillerProcessArguments * args = new KillerProcessArguments;
args->context = data->context;
args->jobs_ids = message->jobs_ids;
for (const JobIdentifier & job_id : args->jobs_ids)
for (const JobIdentifier & job_id : message->jobs_ids)
{
Job * job = data->context->workloads.job_at(job_id);
(void) job; // Avoids a warning if assertions are ignored
// Let's discard jobs whose kill has already been requested
if (!job->kill_requested)
{
// Let's check the job state
xbt_assert(job->state == JobState::JOB_STATE_RUNNING ||
job->state == JobState::JOB_STATE_COMPLETED_SUCCESSFULLY ||
job->state == JobState::JOB_STATE_COMPLETED_KILLED,
"Invalid KILL_JOB: job_id '%s' refers to a job not being executed nor completed.",
job_id.to_string().c_str());
// Let's mark that the job kill has been requested
job->kill_requested = true;
// The job is included in the killer_process arguments
args->jobs_ids.push_back(job_id);
}
}
MSG_process_create("killer_process", killer_process, (void *) args, MSG_host_self());
......
base_output_directory: /tmp/batsim_tests/kill_multiple
base_variables:
batsim_dir: ${base_working_directory}
implicit_instances:
implicit:
sweep:
platform :
- {"name":"small", "filename":"${batsim_dir}/platforms/small_platform.xml", "master_host":"master_host"}
workload :
- {"name":"tiny", "filename": "${batsim_dir}/workload_profiles/one_delay_job.json"}
algo:
- {"name":"killer", "sched_name":"killer"}
delay_before_kill: [0,5,10,15]
nb_kills_per_job: [1,2]
generic_instance:
timeout: 10
working_directory: ${base_working_directory}
output_directory: ${base_output_directory}/results/${instance_id}
batsim_command: batsim -p ${platform[filename]} -w ${workload[filename]} -e ${output_directory}/out -m ${platform[master_host]}
sched_command: batsched -v ${algo[sched_name]} --variant_options_filepath ${output_directory}/sched_input.json
commands_before_execution:
# Generate sched input
- |
#!/usr/bin/env bash
cat > ${output_directory}/sched_input.json << EOF
{
"nb_kills_per_job": ${nb_kills_per_job},
"delay_before_kill": ${delay_before_kill}
}
EOF
commands_before_instances:
- ${batsim_dir}/test/is_batsim_dir.py ${base_working_directory}
- ${batsim_dir}/test/clean_output_dir.py ${base_output_directory}
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