Commit 7f7c6eb5 authored by Steffen Lackner's avatar Steffen Lackner
Browse files

[code] Make the sleep and poll time configurable in the profile

parent 6fe904da
......@@ -307,7 +307,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;
......@@ -324,7 +324,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()) {
......
......@@ -444,6 +444,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")
......@@ -471,6 +480,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")
......
......@@ -161,6 +161,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.
};
/**
......@@ -172,6 +173,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.
};
......
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