Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
batsim
batsim
Commits
ecde8b1a
Commit
ecde8b1a
authored
Apr 09, 2017
by
Millian Poquet
Browse files
[code] few fixes
parent
95c231e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/protocol.cpp
View file @
ecde8b1a
...
...
@@ -124,6 +124,7 @@ void JsonProtocolWriter::append_simulation_begins(int nb_resources, double date)
xbt_assert
(
date
>=
_last_date
,
"Date inconsistency"
);
_last_date
=
date
;
_is_empty
=
false
;
Value
data
(
rapidjson
::
kObjectType
);
data
.
AddMember
(
"nb_resources"
,
Value
().
SetInt
(
nb_resources
),
_alloc
);
...
...
@@ -146,6 +147,7 @@ void JsonProtocolWriter::append_simulation_ends(double date)
xbt_assert
(
date
>=
_last_date
,
"Date inconsistency"
);
_last_date
=
date
;
_is_empty
=
false
;
Value
event
(
rapidjson
::
kObjectType
);
event
.
AddMember
(
"timestamp"
,
Value
().
SetDouble
(
date
),
_alloc
);
...
...
@@ -155,7 +157,7 @@ void JsonProtocolWriter::append_simulation_ends(double date)
_events
.
PushBack
(
event
,
_alloc
);
}
void
JsonProtocolWriter
::
append_job_submitted
(
const
vector
<
string
>
&
job_id
s
,
void
JsonProtocolWriter
::
append_job_submitted
(
const
string
&
job_id
,
double
date
)
{
/* {
...
...
@@ -168,17 +170,15 @@ void JsonProtocolWriter::append_job_submitted(const vector<string> & job_ids,
xbt_assert
(
date
>=
_last_date
,
"Date inconsistency"
);
_last_date
=
date
;
_is_empty
=
false
;
Value
data
(
rapidjson
::
kObjectType
);
data
.
AddMember
(
"job_id"
,
Value
().
SetString
(
job_id
.
c_str
(),
_alloc
),
_alloc
);
Value
event
(
rapidjson
::
kObjectType
);
event
.
AddMember
(
"timestamp"
,
Value
().
SetDouble
(
date
),
_alloc
);
event
.
AddMember
(
"type"
,
Value
().
SetString
(
"JOB_SUBMITTED"
),
_alloc
);
Value
jobs
(
rapidjson
::
kArrayType
);
jobs
.
Reserve
(
job_ids
.
size
(),
_alloc
);
for
(
const
string
&
job_id
:
job_ids
)
jobs
.
PushBack
(
Value
().
SetString
(
job_id
.
c_str
(),
_alloc
),
_alloc
);
event
.
AddMember
(
"data"
,
Value
().
SetObject
().
AddMember
(
"job_ids"
,
jobs
,
_alloc
),
_alloc
);
event
.
AddMember
(
"data"
,
data
,
_alloc
);
_events
.
PushBack
(
event
,
_alloc
);
}
...
...
@@ -197,6 +197,7 @@ void JsonProtocolWriter::append_job_completed(const string & job_id,
xbt_assert
(
std
::
find
(
accepted_completion_statuses
.
begin
(),
accepted_completion_statuses
.
end
(),
job_status
)
!=
accepted_completion_statuses
.
end
(),
"Unsupported job status '%s'!"
,
job_status
.
c_str
());
_last_date
=
date
;
_is_empty
=
false
;
Value
data
(
rapidjson
::
kObjectType
);
data
.
AddMember
(
"job_id"
,
Value
().
SetString
(
job_id
.
c_str
(),
_alloc
),
_alloc
);
...
...
@@ -221,6 +222,7 @@ void JsonProtocolWriter::append_job_killed(const vector<string> & job_ids,
xbt_assert
(
date
>=
_last_date
,
"Date inconsistency"
);
_last_date
=
date
;
_is_empty
=
false
;
Value
event
(
rapidjson
::
kObjectType
);
event
.
AddMember
(
"timestamp"
,
Value
().
SetDouble
(
date
),
_alloc
);
...
...
@@ -248,6 +250,7 @@ void JsonProtocolWriter::append_resource_state_changed(const MachineRange & reso
xbt_assert
(
date
>=
_last_date
,
"Date inconsistency"
);
_last_date
=
date
;
_is_empty
=
false
;
Value
data
(
rapidjson
::
kObjectType
);
data
.
AddMember
(
"resources"
,
...
...
@@ -273,6 +276,7 @@ void JsonProtocolWriter::append_query_reply_energy(double consumed_energy,
xbt_assert
(
date
>=
_last_date
,
"Date inconsistency"
);
_last_date
=
date
;
_is_empty
=
false
;
Value
event
(
rapidjson
::
kObjectType
);
event
.
AddMember
(
"timestamp"
,
Value
().
SetDouble
(
date
),
_alloc
);
...
...
@@ -705,5 +709,5 @@ void JsonProtocolReader::dsend_message(double when,
MSG_process_sleep
(
when
-
current_time
);
// Let's actually send the message
::
d
send_message
(
destination_mailbox
,
type
,
data
);
::
send_message
(
destination_mailbox
,
type
,
data
);
}
src/protocol.hpp
View file @
ecde8b1a
...
...
@@ -141,10 +141,10 @@ public:
/**
* @brief Appends a JOB_SUBMITTED event.
* @param[in] job_id
s
The identifier
s
of the submitted job
s
.
* @param[in] job_id The identifier of the submitted job.
* @param[in] date The event date. Must be greater than or equal to the previous event.
*/
virtual
void
append_job_submitted
(
const
std
::
vector
<
std
::
string
>
&
job_id
s
,
virtual
void
append_job_submitted
(
const
std
::
string
&
job_id
,
double
date
)
=
0
;
/**
...
...
@@ -339,10 +339,10 @@ public:
/**
* @brief Appends a JOB_SUBMITTED event.
* @param[in] job_id
s
The identifier
s
of the submitted job
s
.
* @param[in] job_id The identifier of the submitted job.
* @param[in] date The event date. Must be greater than or equal to the previous event.
*/
void
append_job_submitted
(
const
std
::
vector
<
std
::
string
>
&
job_id
s
,
void
append_job_submitted
(
const
std
::
string
&
job_id
,
double
date
);
/**
...
...
src/server.cpp
View file @
ecde8b1a
...
...
@@ -208,7 +208,7 @@ int server_process(int argc, char *argv[])
XBT_INFO
(
"Job %s SUBMITTED. %d jobs submitted so far"
,
message
->
job_id
.
to_string
().
c_str
(),
nb_submitted_jobs
);
context
->
proto_writer
->
append_job_submitted
(
{
job
->
id
}
,
MSG_get_clock
());
context
->
proto_writer
->
append_job_submitted
(
job
->
id
,
MSG_get_clock
());
}
break
;
// end of case JOB_SUBMITTED
case
IPMessageType
::
JOB_SUBMITTED_BY_DP
:
...
...
@@ -466,7 +466,6 @@ int server_process(int argc, char *argv[])
case
IPMessageType
::
SCHED_READY
:
{
sched_ready
=
true
;
}
break
;
// end of case SCHED_READY
case
IPMessageType
::
SCHED_WAIT_ANSWER
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment