Commit 1ca474b2 authored by Millian Poquet's avatar Millian Poquet
Browse files

Merge branch 'coalloc' into coalloc_to_master

parents 92fa23ba 9ad58722
This diff is collapsed.
......@@ -310,7 +310,7 @@ int execute_profile(BatsimContext *context,
send_message("server", IPMessageType::FROM_JOB_MSG, (void*)message);
if (delay_job(0.005, remaining_time) == -1)
if (delay_job(data->sleeptime, remaining_time) == -1)
return -1;
return profile->return_code;
......@@ -327,7 +327,7 @@ int execute_profile(BatsimContext *context,
if (data->on_timeout == "") {
XBT_INFO("Waiting for message from scheduler");
while (true) {
if (delay_job(0.005, remaining_time) == -1)
if (delay_job(data->polltime, remaining_time) == -1)
return -1;
if (!job->incoming_message_buffer.empty()) {
......
......@@ -476,6 +476,15 @@ Profile *Profile::from_json(const std::string & profile_name,
data->message.CopyFrom(json_desc["msg"], data->message.GetAllocator());
if (json_desc.HasMember("sleeptime")) {
xbt_assert(json_desc["sleeptime"].IsNumber(), "%s: profile '%s' has a non-number 'sleeptime' field",
error_prefix.c_str(), profile_name.c_str());
data->sleeptime = json_desc["sleeptime"].GetDouble();
xbt_assert(data->sleeptime > 0, "%s: profile '%s' has a non-positive 'sleeptime' field (%g)",
error_prefix.c_str(), profile_name.c_str(), data->sleeptime);
} else {
data->sleeptime = 0.0000001;
}
profile->data = data;
}
else if (profile_type == "recv")
......@@ -503,6 +512,15 @@ Profile *Profile::from_json(const std::string & profile_name,
data->on_timeout = json_desc["timeout"].GetString();
}
if (json_desc.HasMember("polltime")) {
xbt_assert(json_desc["polltime"].IsNumber(), "%s: profile '%s' has a non-number 'polltime' field",
error_prefix.c_str(), profile_name.c_str());
data->polltime = json_desc["polltime"].GetDouble();
xbt_assert(data->polltime > 0, "%s: profile '%s' has a non-positive 'polltime' field (%g)",
error_prefix.c_str(), profile_name.c_str(), data->polltime);
} else {
data->polltime = 0.005;
}
profile->data = data;
}
else if (profile_type == "smpi")
......
......@@ -173,6 +173,7 @@ struct MsgDataStagingProfileData
struct SchedulerSendProfileData
{
rapidjson::Document message; //!< The message being sent to the scheduler
double sleeptime; //!< The time to sleep after sending the message.
};
/**
......@@ -184,6 +185,7 @@ struct SchedulerRecvProfileData
std::string on_success; //!< The profile to execute if it matches
std::string on_failure; //!< The profile to execute if it does not match
std::string on_timeout; //!< The profile to execute if no message is in the buffer (i.e. the scheduler has not answered in time). Can be omitted which will result that the job will wait until its walltime is reached.
double polltime; //!< The time to sleep between polling if on_timeout is not set.
};
......
......@@ -651,7 +651,7 @@ void server_on_change_job_state(ServerData * data,
xbt_assert(data->nb_completed_jobs + data->nb_running_jobs <= data->nb_submitted_jobs);
break;
default:
xbt_assert(false, "Can only change the state of a submitted job to running or rejected");
xbt_assert(false, "Can only change the state of a submitted job to running or rejected. State was %s", job_state_to_string(job->state).c_str());
}
break;
case JobState::JOB_STATE_RUNNING:
......@@ -667,11 +667,11 @@ void server_on_change_job_state(ServerData * data,
xbt_assert(data->nb_completed_jobs + data->nb_running_jobs <= data->nb_submitted_jobs);
break;
default:
xbt_assert(false, "Can only change the state of a running job to completed (successfully, failed, and killed)");
xbt_assert(false, "Can only change the state of a running job to completed (successfully, failed, and killed). State was %s", job_state_to_string(job->state).c_str());
}
break;
default:
xbt_assert(false, "Can only change the state of a submitted or running job.");
xbt_assert(false, "Can only change the state of a submitted or running job. State was %s", job_state_to_string(job->state).c_str());
}
job->state = new_state;
......
{
"version": 0,
"date": "Wed 6 Sep 17:41:23 CEST 2017",
"description": "Simple workload with delays for testing purposes.",
"jobs": [
{
"id": 0,
"profile": "delay",
"res": 4,
"walltime": 300,
"subtime": 0.0
},
{
"id": 1,
"profile": "delay",
"res": 8,
"walltime": 300,
"subtime": 0.1
},
{
"id": 2,
"profile": "delay",
"res": 16,
"walltime": 300,
"subtime": 0.2
},
{
"id": 3,
"profile": "delay",
"res": 16,
"walltime": 300,
"subtime": 0.3
},
{
"id": 4,
"profile": "delay",
"res": 4,
"walltime": 300,
"subtime": 0.4
},
{
"id": 5,
"profile": "delay",
"res": 4,
"walltime": 300,
"subtime": 0.5
},
{
"id": 6,
"profile": "delay",
"res": 4,
"walltime": 300,
"subtime": 0.5
},
{
"id": 7,
"profile": "delay",
"res": 4,
"walltime": 300,
"subtime": 0.5
},
{
"id": 8,
"profile": "delay",
"res": 4,
"walltime": 300,
"subtime": 0.5
},
{
"id": 9,
"profile": "delay",
"res": 4,
"walltime": 300,
"subtime": 0.5
},
{
"id": 10,
"profile": "delay",
"res": 33,
"walltime": 300,
"subtime": 0.6
},
{
"id": 11,
"profile": "delay",
"res": 32,
"walltime": 300,
"subtime": 0.6
}
],
"nb_res": 32,
"profiles": {
"delay": {
"type": "delay",
"delay": 96.00
}
}
}
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