Mise à jour terminée. Pour connaître les apports de la version 13.8.4 par rapport à notre ancienne version vous pouvez lire les "Release Notes" suivantes :
https://about.gitlab.com/releases/2021/02/11/security-release-gitlab-13-8-4-released/
https://about.gitlab.com/releases/2021/02/05/gitlab-13-8-3-released/

Commit 58272007 authored by Millian Poquet's avatar Millian Poquet

Addition of the --disable-schedule-tracing (or -T) option to avoid the generation of the Pajé trace

parent 01c3fb75
......@@ -50,6 +50,7 @@ struct MainArguments
VerbosityLevel verbosity = VerbosityLevel::INFORMATION; //! Sets the Batsim verbosity
bool allow_space_sharing = false; //! Allows/forbids space sharing. Two jobs can run on the same machine if and only if space sharing is allowed.
bool enable_simgrid_process_tracing = false; //! If set to true, this options enables the tracing of SimGrid processes
bool enable_schedule_tracing = true; //! If set to true, the schedule is exported to a Pajé trace file
bool abort = false; //! A boolean value. If set to yet, the launching should be aborted for reason abortReason
std::string abortReason; //! Human readable reasons which explains why the launch should be aborted
......@@ -108,6 +109,9 @@ int parse_opt (int key, char *arg, struct argp_state *state)
case 't':
mainArgs->enable_simgrid_process_tracing = true;
break;
case 'T':
mainArgs->enable_schedule_tracing = false;
break;
case ARGP_KEY_ARG:
switch(state->arg_num)
{
......@@ -154,6 +158,7 @@ int main(int argc, char * argv[])
{"quiet", 'q', 0, 0, "Shortcut for --verbosity=quiet", 0},
{"socket", 's', "FILENAME", 0, "Unix Domain Socket filename", 0},
{"process-tracing", 't', 0, 0, "Enables SimGrid process tracing (shortcut for SimGrid options ----cfg=tracing:1 --cfg=tracing/msg/process:1)", 0},
{"disable-schedule-tracing", 'T', 0, 0, "If set, disables the tracing of the schedule.", 0},
{"verbosity", 'v', "VERBOSITY_LEVEL", 0, "Sets the Batsim verbosity level. Available values are : quiet, network-only, information (default), debug.", 0},
{0, '\0', 0, 0, 0, 0} // The options array must be NULL-terminated
};
......@@ -221,11 +226,13 @@ int main(int argc, char * argv[])
context.workload_filename = mainArgs.workloadFilename;
context.energy_used = mainArgs.energy_used;
context.allow_space_sharing = mainArgs.allow_space_sharing;
context.trace_schedule = mainArgs.enable_schedule_tracing;
load_json_workload(&context, mainArgs.workloadFilename);
context.jobs.setProfiles(&context.profiles);
context.paje_tracer.setFilename(mainArgs.exportPrefix + "_schedule.trace");
//context.jobs.displayDebug();
if (context.trace_schedule)
context.paje_tracer.setFilename(mainArgs.exportPrefix + "_schedule.trace");
XBT_INFO("Checking whether SMPI is used or not...");
bool smpi_used = context.jobs.containsSMPIJob();
......@@ -244,8 +251,11 @@ int main(int argc, char * argv[])
context.machines.createMachines(hosts, &context, mainArgs.masterHostName);
xbt_dynar_free(&hosts);
const Machine * masterMachine = context.machines.masterMachine();
context.machines.setTracer(&context.paje_tracer);
context.paje_tracer.initialize(&context, MSG_get_clock());
if (context.trace_schedule)
{
context.machines.setTracer(&context.paje_tracer);
context.paje_tracer.initialize(&context, MSG_get_clock());
}
XBT_INFO("Machines created successfully. There are %lu computing machines.", context.machines.machines().size());
if (context.energy_used)
......@@ -275,7 +285,8 @@ int main(int argc, char * argv[])
msg_error_t res = MSG_main();
// Finalization
context.paje_tracer.finalize(&context, MSG_get_clock());
if (context.trace_schedule)
context.paje_tracer.finalize(&context, MSG_get_clock());
exportScheduleToCSV(mainArgs.exportPrefix + "_schedule.csv", MSG_get_clock(), &context);
exportJobsToCSV(mainArgs.exportPrefix + "_jobs.csv", &context);
......
......@@ -22,6 +22,7 @@ struct BatsimContext
long long microseconds_used_by_scheduler = 0;
bool energy_used;
bool allow_space_sharing;
bool trace_schedule;
std::string platform_filename;
std::string workload_filename;
};
......@@ -3,6 +3,8 @@
#include <algorithm>
#include <fstream>
#include <boost/algorithm/string/join.hpp>
#include <stdlib.h>
#include <xbt.h>
#include <math.h>
......@@ -84,7 +86,7 @@ void PajeTracer::setFilename(const string &filename)
PajeTracer::~PajeTracer()
{
if (state != FINALIZED)
if (state != FINALIZED && state != UNINITIALIZED)
fprintf(stderr, "Destruction of a PajeTracer object which has not been finalized. The corresponding trace file may be invalid.\n");
if (_wbuf != nullptr)
......@@ -521,8 +523,10 @@ void exportJobsToCSV(const string &filename, BatsimContext *context)
if (job->state == JobState::JOB_STATE_COMPLETED_SUCCESSFULLY || job->state == JobState::JOB_STATE_COMPLETED_KILLED)
{
char * buf;
int success = job->state == JobState::JOB_STATE_COMPLETED_SUCCESSFULLY;
char * buf = nullptr;
int success = (job->state == JobState::JOB_STATE_COMPLETED_SUCCESSFULLY);
xbt_assert(job->runtime > 0);
int ret = asprintf(&buf, "%d,%lf,%d,%lf,%d,%lf,%lf,%lf,%lf,%lf,%lf,%Lf,", // finished by a ',' because the next part is written after asprintf
job->id,
job->submission_time,
......@@ -541,27 +545,22 @@ void exportJobsToCSV(const string &filename, BatsimContext *context)
f << buf;
free(buf);
// TODO: use boost::join for the following if
xbt_assert((int)job->allocation.size() == job->required_nb_res);
vector<string> machine_id_strings;
if (job->required_nb_res > 0)
{
int ret = asprintf(&buf, "%d", job->allocation[0]);
xbt_assert(ret != -1, "asprintf failed (not enough memory?)");
f << buf;
free(buf);
for (const int & machine_id : job->allocation)
machine_id_strings.push_back(to_string(machine_id));
for (int i = 1; i < job->required_nb_res; ++i)
{
ret = asprintf(&buf," %d", job->allocation[i]);
xbt_assert(ret != -1, "asprintf failed (not enough memory?)");
f << buf;
free(buf);
}
}
f << boost::algorithm::join(machine_id_strings, " ");
// todo: use union of intervals instead
f << "\n";
}
}
f.close();
}
......
......@@ -48,40 +48,39 @@ void Jobs::load_from_json(const Document &doc, const string &filename)
const Value & jobs = doc["jobs"];
xbt_assert(jobs.IsArray(), "Invalid JSON file '%s': the 'jobs' member is not an array", filename.c_str());
Job j;
j.starting_time = -1;
j.runtime = -1;
j.state = JobState::JOB_STATE_NOT_SUBMITTED;
for (SizeType i = 0; i < jobs.Size(); i++) // Uses SizeType instead of size_t
{
Job * j = new Job;
j->starting_time = -1;
j->runtime = -1;
j->state = JobState::JOB_STATE_NOT_SUBMITTED;
j->consumed_energy = -1;
const Value & job = jobs[i];
xbt_assert(job.IsObject(), "Invalid JSON file '%s': one job is not an object", filename.c_str());
xbt_assert(job.HasMember("id"), "Invalid JSON file '%s': one job has no 'id' field", filename.c_str());
xbt_assert(job["id"].IsInt(), "Invalid JSON file '%s': one job has a non-integral 'id' field ('%s')", filename.c_str(), job["id"].GetString());
j.id = job["id"].GetInt();
j->id = job["id"].GetInt();
xbt_assert(job.HasMember("subtime"), "Invalid JSON file '%s': job %d has no 'subtime' field", filename.c_str(), j.id);
xbt_assert(job["subtime"].IsNumber(), "Invalid JSON file '%s': job %d has a non-number 'subtime' field", filename.c_str(), j.id);
j.submission_time = job["subtime"].GetDouble();
xbt_assert(job.HasMember("subtime"), "Invalid JSON file '%s': job %d has no 'subtime' field", filename.c_str(), j->id);
xbt_assert(job["subtime"].IsNumber(), "Invalid JSON file '%s': job %d has a non-number 'subtime' field", filename.c_str(), j->id);
j->submission_time = job["subtime"].GetDouble();
xbt_assert(job.HasMember("walltime"), "Invalid JSON file '%s': job %d has no 'walltime' field", filename.c_str(), j.id);
xbt_assert(job["walltime"].IsNumber(), "Invalid JSON file '%s': job %d has a non-number 'walltime' field", filename.c_str(), j.id);
j.walltime = job["walltime"].GetDouble();
xbt_assert(job.HasMember("walltime"), "Invalid JSON file '%s': job %d has no 'walltime' field", filename.c_str(), j->id);
xbt_assert(job["walltime"].IsNumber(), "Invalid JSON file '%s': job %d has a non-number 'walltime' field", filename.c_str(), j->id);
j->walltime = job["walltime"].GetDouble();
xbt_assert(job.HasMember("res"), "Invalid JSON file '%s': job %d has no 'res' field", filename.c_str(), j.id);
xbt_assert(job["res"].IsInt(), "Invalid JSON file '%s': job %d has a non-number 'res' field", filename.c_str(), j.id);
j.required_nb_res = job["res"].GetInt();
xbt_assert(job.HasMember("res"), "Invalid JSON file '%s': job %d has no 'res' field", filename.c_str(), j->id);
xbt_assert(job["res"].IsInt(), "Invalid JSON file '%s': job %d has a non-number 'res' field", filename.c_str(), j->id);
j->required_nb_res = job["res"].GetInt();
xbt_assert(job.HasMember("profile"), "Invalid JSON file '%s': job %d has no 'profile' field", filename.c_str(), j.id);
xbt_assert(job["profile"].IsString(), "Invalid JSON file '%s': job %d has a non-string 'profile' field", filename.c_str(), j.id);
j.profile = job["profile"].GetString();
xbt_assert(job.HasMember("profile"), "Invalid JSON file '%s': job %d has no 'profile' field", filename.c_str(), j->id);
xbt_assert(job["profile"].IsString(), "Invalid JSON file '%s': job %d has a non-string 'profile' field", filename.c_str(), j->id);
j->profile = job["profile"].GetString();
xbt_assert(!exists(j.id), "Invalid JSON file '%s': duplication of job id %d", filename.c_str(), j.id);
Job * nj = new Job;
*nj = j;
_jobs[j.id] = nj;
xbt_assert(!exists(j->id), "Invalid JSON file '%s': duplication of job id %d", filename.c_str(), j->id);
_jobs[j->id] = j;
}
}
......
......@@ -260,7 +260,8 @@ int execute_job_process(int argc, char *argv[])
{
XBT_INFO("Job %d had been killed (walltime %lf reached", job->id, job->walltime);
job->state = JobState::JOB_STATE_COMPLETED_KILLED;
args->context->paje_tracer.addJobKill(job->id, args->allocation.machine_ids, MSG_get_clock(), true);
if (args->context->trace_schedule)
args->context->paje_tracer.addJobKill(job->id, args->allocation.machine_ids, MSG_get_clock(), true);
}
args->context->machines.updateMachinesOnJobEnd(job->id, args->allocation.machine_ids);
......
......@@ -264,8 +264,8 @@ void Machines::updateMachinesOnJobRun(int jobID, const std::vector<int> & usedMa
if (previous_top_job == -1 || previous_top_job != *machine->jobs_being_computed.begin())
{
xbt_assert(_tracer != nullptr, "Invalid Machines::updateMachinesOnJobRun call: setTracer has not been called");
_tracer->set_machine_as_computing_job(machine->id, *machine->jobs_being_computed.begin(), MSG_get_clock());
if (_tracer != nullptr)
_tracer->set_machine_as_computing_job(machine->id, *machine->jobs_being_computed.begin(), MSG_get_clock());
}
}
}
......@@ -286,13 +286,13 @@ void Machines::updateMachinesOnJobEnd(int jobID, const std::vector<int> & usedMa
if (machine->jobs_being_computed.empty())
{
machine->state = MachineState::IDLE;
xbt_assert(_tracer != nullptr, "Invalid Machines::updateMachinesOnJobRun call: setTracer has not been called");
_tracer->set_machine_idle(machine->id, MSG_get_clock());
if (_tracer != nullptr)
_tracer->set_machine_idle(machine->id, MSG_get_clock());
}
else if (*machine->jobs_being_computed.begin() != previous_top_job)
{
xbt_assert(_tracer != nullptr, "Invalid Machines::updateMachinesOnJobRun call: setTracer has not been called");
_tracer->set_machine_as_computing_job(machine->id, *machine->jobs_being_computed.begin(), MSG_get_clock());
if (_tracer != nullptr)
_tracer->set_machine_as_computing_job(machine->id, *machine->jobs_being_computed.begin(), MSG_get_clock());
}
}
......
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