Skip to content
Snippets Groups Projects
Commit 5b4e30a6 authored by Maël Madon's avatar Maël Madon
Browse files

dev: make scheduler easy_bf into dynamic sched

parent af873b2c
No related branches found
No related tags found
1 merge request!5New dynamic schedulers: fcfs and easy-bf
......@@ -12,7 +12,7 @@ EasyBackfilling::EasyBackfilling(Workload * workload,
ResourceSelector * selector,
double rjms_delay,
rapidjson::Document * variant_options) :
ISchedulingAlgorithm(workload, decision, queue, selector, rjms_delay, variant_options)
DynScheduler(workload, decision, queue, selector, rjms_delay, variant_options)
{
}
......@@ -23,6 +23,9 @@ EasyBackfilling::~EasyBackfilling()
void EasyBackfilling::on_simulation_start(double date, const rapidjson::Value & batsim_config)
{
/* Call superclass. If broker enabled, submit jobs date=0. */
DynScheduler::on_simulation_start(date, batsim_config);
_schedule = Schedule(_nb_machines, date);
(void) batsim_config;
}
......@@ -51,12 +54,16 @@ void EasyBackfilling::make_decisions(double date,
if (new_job->nb_requested_resources > _nb_machines)
{
_decision->add_reject_job(new_job_id, date);
if (broker_enabled)
broker->update_status_if_dyn_job(new_job_id, KILLED);
}
else if (!new_job->has_walltime)
{
LOG_SCOPE_FUNCTION(INFO);
LOG_F(INFO, "Date=%g. Rejecting job '%s' as it has no walltime", date, new_job_id.c_str());
_decision->add_reject_job(new_job_id, date);
if (broker_enabled)
broker->update_status_if_dyn_job(new_job_id, KILLED);
}
else
{
......@@ -92,6 +99,10 @@ void EasyBackfilling::make_decisions(double date,
if ( alloc.started_in_first_slice)
{
_decision->add_execute_job(new_job_id, alloc.used_machines, date);
if (broker_enabled)
broker->update_status_if_dyn_job(new_job_id, RUNNING);
_queue->remove_job(new_job);
nb_available_machines -= new_job->nb_requested_resources;
}
......@@ -121,6 +132,9 @@ void EasyBackfilling::make_decisions(double date,
if (alloc.started_in_first_slice)
{
_decision->add_execute_job(job->id, alloc.used_machines, date);
if (broker_enabled)
broker->update_status_if_dyn_job(job->id, RUNNING);
job_it = _queue->remove_job(job_it); // Updating job_it to remove on traversal
priority_job_after = _queue->first_job_or_nullptr();
}
......@@ -134,6 +148,9 @@ void EasyBackfilling::make_decisions(double date,
if (alloc.started_in_first_slice)
{
_decision->add_execute_job(job->id, alloc.used_machines, date);
if (broker_enabled)
broker->update_status_if_dyn_job(job->id, RUNNING);
job_it = _queue->remove_job(job_it);
}
else
......@@ -144,6 +161,10 @@ void EasyBackfilling::make_decisions(double date,
}
}
}
/* make_decisions from superclass, will in particular take care of sending
* feedback about job status to the users, if broker enabled */
DynScheduler::make_decisions(date, update_info, compare_info);
}
......@@ -180,6 +201,8 @@ void EasyBackfilling::sort_queue_while_handling_priority_job(const Job * priorit
if (alloc.started_in_first_slice)
{
_decision->add_execute_job(priority_job_after->id, alloc.used_machines, (double)update_info->current_date);
if (broker_enabled)
broker->update_status_if_dyn_job(priority_job_after->id, RUNNING);
_queue->remove_job(priority_job_after);
priority_job_after = _queue->first_job_or_nullptr();
could_run_priority_job = true;
......
......@@ -2,12 +2,11 @@
#include <list>
#include "../isalgorithm.hpp"
#include "../json_workload.hpp"
#include "../broker/dynscheduler.hpp"
#include "../locality.hpp"
#include "../schedule.hpp"
class EasyBackfilling : public ISchedulingAlgorithm
class EasyBackfilling : public DynScheduler
{
public:
EasyBackfilling(Workload * workload, SchedulingDecision * decision, Queue * queue, ResourceSelector * selector,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment