Skip to content

Commit 7f5d3b1

Browse files
committed
code,edc: update w.r.t. batprotocol update
1 parent 01e2133 commit 7f5d3b1

9 files changed

+21
-28
lines changed

flake.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ipp.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ IPMessage::~IPMessage()
310310
} break;
311311
case IPMessageType::SCHED_HELLO:
312312
{
313-
auto * msg = static_cast<ExternalDecisionComponentHelloMessage *>(data);
313+
auto * msg = static_cast<EDCHelloMessage *>(data);
314314
delete msg;
315315
} break;
316316
case IPMessageType::SCHED_REJECT_JOB:

src/ipp.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ struct KillJobsMessage
198198
/**
199199
* @brief Wrapper struct around batprotocol::fb::EDCRequestedSimulationFeatures
200200
*/
201-
struct ExternalDecisionComponentRequestedSimulationFeatures
201+
struct EDCRequestedSimulationFeatures
202202
{
203203
bool dynamic_registration = false; //!< cf. batprotocol::fb::EDCRequestedSimulationFeatures
204204
bool profile_reuse = false; //!< cf. batprotocol::fb::EDCRequestedSimulationFeatures
@@ -210,15 +210,15 @@ struct ExternalDecisionComponentRequestedSimulationFeatures
210210
};
211211

212212
/**
213-
* @brief The content of the SCHED_HELLO message
213+
* @brief The content of the EDC_HELLO message
214214
*/
215-
struct ExternalDecisionComponentHelloMessage
215+
struct EDCHelloMessage
216216
{
217217
std::string batprotocol_version; //!< The batprotocol version used by the external decision component
218218
std::string edc_name; //!< The name of the external decision component
219219
std::string edc_version; //!< The version of the external decision component
220220
std::string edc_commit; //!< The commit of the external decision component
221-
ExternalDecisionComponentRequestedSimulationFeatures requested_simulation_features; //!< The simulation features requested by this EDC
221+
EDCRequestedSimulationFeatures requested_simulation_features; //!< The simulation features requested by this EDC
222222
};
223223

224224
/**

src/protocol.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ std::shared_ptr<batprotocol::KillProgress> battask_to_kill_progress(const BatTas
9191
std::shared_ptr<batprotocol::Job> to_job(const Job & job)
9292
{
9393
auto proto_job = batprotocol::Job::make();
94-
proto_job->set_host_number(job.requested_nb_res); // TODO: handle core/ghost requests
94+
proto_job->set_resource_number(job.requested_nb_res);
9595
proto_job->set_walltime(job.walltime);
9696
proto_job->set_profile(job.profile->name); // TODO: handle ghost jobs without profile
9797
// TODO: handle extra data
@@ -290,9 +290,9 @@ KillJobsMessage *from_kill_jobs(const batprotocol::fb::KillJobsEvent * kill_jobs
290290
return msg;
291291
}
292292

293-
ExternalDecisionComponentHelloMessage *from_edc_hello(const batprotocol::fb::ExternalDecisionComponentHelloEvent * edc_hello, BatsimContext * context)
293+
EDCHelloMessage *from_edc_hello(const batprotocol::fb::EDCHelloEvent * edc_hello, BatsimContext * context)
294294
{
295-
auto msg = new ExternalDecisionComponentHelloMessage;
295+
auto msg = new EDCHelloMessage;
296296

297297
msg->batprotocol_version = edc_hello->batprotocol_version()->str();
298298
msg->edc_name = edc_hello->decision_component_name()->str();
@@ -354,9 +354,9 @@ void parse_batprotocol_message(const uint8_t * buffer, uint32_t buffer_size, dou
354354
ip_message->type = IPMessageType::SCHED_KILL_JOBS;
355355
ip_message->data = static_cast<void *>(from_kill_jobs(event_timestamp->event_as_KillJobsEvent(), context));
356356
} break;
357-
case Event_ExternalDecisionComponentHelloEvent: {
357+
case Event_EDCHelloEvent: {
358358
ip_message->type = IPMessageType::SCHED_HELLO;
359-
ip_message->data = static_cast<void *>(from_edc_hello(event_timestamp->event_as_ExternalDecisionComponentHelloEvent(), context));
359+
ip_message->data = static_cast<void *>(from_edc_hello(event_timestamp->event_as_EDCHelloEvent(), context));
360360
} break;
361361
default: {
362362
xbt_assert("Unhandled event type received (%s)", batprotocol::fb::EnumNamesEvent()[event_timestamp->event_type()]);

src/protocol.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ batprotocol::SimulationBegins to_simulation_begins(const BatsimContext * context
2929
ExecuteJobMessage * from_execute_job(const batprotocol::fb::ExecuteJobEvent * execute_job, BatsimContext * context);
3030
RejectJobMessage * from_reject_job(const batprotocol::fb::RejectJobEvent * reject_job, BatsimContext * context);
3131
KillJobsMessage * from_kill_jobs(const batprotocol::fb::KillJobsEvent * kill_jobs, BatsimContext * context);
32-
ExternalDecisionComponentHelloMessage * from_edc_hello(const batprotocol::fb::ExternalDecisionComponentHelloEvent * edc_hello, BatsimContext * context);
32+
EDCHelloMessage * from_edc_hello(const batprotocol::fb::EDCHelloEvent * edc_hello, BatsimContext * context);
3333

3434
void parse_batprotocol_message(const uint8_t * buffer, uint32_t buffer_size, double & now, std::shared_ptr<std::vector<IPMessageWithTimestamp> > & messages, BatsimContext * context);
3535

src/server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ void server_on_edc_hello(ServerData *data, IPMessage *task_data)
10131013

10141014
(void) task_data;
10151015
xbt_assert(task_data->data != nullptr, "inconsistency: task_data has null data");
1016-
auto * message = static_cast<ExternalDecisionComponentHelloMessage *>(task_data->data);
1016+
auto * message = static_cast<EDCHelloMessage *>(task_data->data);
10171017
// TODO: check batprotocol version compatibility, store&log scheduler tracability info...
10181018

10191019
// TODO: set tunable behavior per EDC, not for all of them

test/edc-lib/exec1by1.cpp

+2-9
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ uint8_t batsim_edc_take_decisions(
7474
switch (event->event_type())
7575
{
7676
case fb::Event_BatsimHelloEvent: {
77-
mb->add_external_decision_component_hello("exec1by1", "0.1.0");
77+
mb->add_edc_hello("exec1by1", "0.1.0");
7878
} break;
7979
case fb::Event_SimulationBeginsEvent: {
8080
auto simu_begins = event->event_as_SimulationBeginsEvent();
@@ -85,14 +85,7 @@ uint8_t batsim_edc_take_decisions(
8585
auto job = new SchedJob();
8686
job->job_id = parsed_job->job_id()->str();
8787

88-
auto host_request = parsed_job->job()->computation_resource_request_as_HostNumber();
89-
if (host_request == nullptr)
90-
{
91-
printf("non-host resource request received for job='%s', aborting\n", job->job_id.c_str());
92-
return 1;
93-
}
94-
job->nb_hosts = host_request->host_number();
95-
88+
job->nb_hosts = parsed_job->job()->resource_request();
9689
if (job->nb_hosts > platform_nb_hosts)
9790
{
9891
mb->add_reject_job(job->job_id);

test/edc-lib/fcfs.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ uint8_t batsim_edc_take_decisions(
6969
switch (event->event_type())
7070
{
7171
case fb::Event_BatsimHelloEvent: {
72-
mb->add_external_decision_component_hello("fcfs", "0.1.0");
72+
mb->add_edc_hello("fcfs", "0.1.0");
7373
} break;
7474
case fb::Event_SimulationBeginsEvent: {
7575
auto simu_begins = event->event_as_SimulationBeginsEvent();
@@ -80,7 +80,7 @@ uint8_t batsim_edc_take_decisions(
8080
case fb::Event_JobSubmittedEvent: {
8181
::Job job{
8282
event->event_as_JobSubmittedEvent()->job_id()->str(),
83-
event->event_as_JobSubmittedEvent()->job()->computation_resource_request_as_HostNumber()->host_number()
83+
event->event_as_JobSubmittedEvent()->job()->resource_request()
8484
};
8585

8686
if (job.nb_hosts > platform_nb_hosts)

test/edc-lib/rejecter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ uint8_t batsim_edc_take_decisions(
5050
switch (event->event_type())
5151
{
5252
case fb::Event_BatsimHelloEvent: {
53-
mb->add_external_decision_component_hello("rejecter", "0.1.0");
53+
mb->add_edc_hello("rejecter", "0.1.0");
5454
} break;
5555
case fb::Event_JobSubmittedEvent: {
5656
auto job_id = event->event_as_JobSubmittedEvent()->job_id()->str();

0 commit comments

Comments
 (0)