|
10 | 10 | #include <fstream>
|
11 | 11 | #include <streambuf>
|
12 | 12 | #include <algorithm>
|
13 |
| -#include <regex> |
14 | 13 |
|
15 | 14 | #include <boost/algorithm/string.hpp>
|
16 | 15 | #include <boost/algorithm/string/join.hpp>
|
17 | 16 |
|
18 | 17 | #include <simgrid/s4u.hpp>
|
19 | 18 |
|
20 | 19 | #include <rapidjson/document.h>
|
21 |
| -#include <rapidjson/writer.h> |
22 |
| -#include <rapidjson/stringbuffer.h> |
23 | 20 |
|
24 | 21 | #include "profiles.hpp"
|
25 | 22 |
|
@@ -407,55 +404,6 @@ JobPtr Job::from_json(const rapidjson::Value & json_desc,
|
407 | 404 | error_prefix.c_str(), profile_name.c_str(), j->id.to_string().c_str());
|
408 | 405 | j->profile = workload->profiles->at(profile_name);
|
409 | 406 |
|
410 |
| - // Let's get the JSON string which originally described the job |
411 |
| - // (to conserve potential fields unused by Batsim) |
412 |
| - rapidjson::StringBuffer buffer; |
413 |
| - rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); |
414 |
| - json_desc.Accept(writer); |
415 |
| - |
416 |
| - // Let's replace the job ID by its WLOAD!NUMBER counterpart if needed |
417 |
| - // in the json raw description |
418 |
| - string json_description_tmp(buffer.GetString(), buffer.GetSize()); |
419 |
| - /// @cond DOXYGEN_FAILS_PARSING_THIS_REGEX |
420 |
| - std::regex r(R"("id"\s*:\s*(?:"*[^(,|})]*"*)\s*)"); |
421 |
| - /// @endcond |
422 |
| - string replacement_str = "\"id\":\"" + j->id.to_string() + "\""; |
423 |
| - // XBT_INFO("Before regexp: %s", json_description_tmp.c_str()); |
424 |
| - j->json_description = std::regex_replace(json_description_tmp, r, replacement_str); |
425 |
| - |
426 |
| - // Let's check that the new description is a valid JSON string |
427 |
| - rapidjson::Document check_doc; |
428 |
| - check_doc.Parse(j->json_description.c_str()); |
429 |
| - xbt_assert(!check_doc.HasParseError(), |
430 |
| - "A problem occured when replacing the job_id by its WLOAD!job_name counterpart:" |
431 |
| - "The output string '%s' is not valid JSON.", j->json_description.c_str()); |
432 |
| - xbt_assert(check_doc.IsObject(), |
433 |
| - "A problem occured when replacing the job_id by its WLOAD!job_name counterpart: " |
434 |
| - "The output string '%s' is not valid JSON.", j->json_description.c_str()); |
435 |
| - xbt_assert(check_doc.HasMember("id"), |
436 |
| - "A problem occured when replacing the job_id by its WLOAD!job_name counterpart: " |
437 |
| - "The output JSON '%s' has no 'id' field.", j->json_description.c_str()); |
438 |
| - xbt_assert(check_doc["id"].IsString(), |
439 |
| - "A problem occured when replacing the job_id by its WLOAD!job_name counterpart: " |
440 |
| - "The output JSON '%s' has a non-string 'id' field.", j->json_description.c_str()); |
441 |
| - xbt_assert(check_doc.HasMember("subtime") && check_doc["subtime"].IsNumber(), |
442 |
| - "A problem occured when replacing the job_id by its WLOAD!job_name counterpart: " |
443 |
| - "The output JSON '%s' has no 'subtime' field (or it is not a number)", |
444 |
| - j->json_description.c_str()); |
445 |
| - xbt_assert((check_doc.HasMember("walltime") && check_doc["walltime"].IsNumber()) |
446 |
| - || (!check_doc.HasMember("walltime")), |
447 |
| - "A problem occured when replacing the job_id by its WLOAD!job_name counterpart: " |
448 |
| - "The output JSON '%s' has no 'walltime' field (or it is not a number)", |
449 |
| - j->json_description.c_str()); |
450 |
| - xbt_assert(check_doc.HasMember("res") && check_doc["res"].IsInt(), |
451 |
| - "A problem occured when replacing the job_id by its WLOAD!job_name counterpart: " |
452 |
| - "The output JSON '%s' has no 'res' field (or it is not an integer)", |
453 |
| - j->json_description.c_str()); |
454 |
| - xbt_assert(check_doc.HasMember("profile") && check_doc["profile"].IsString(), |
455 |
| - "A problem occured when replacing the job_id by its WLOAD!job_name counterpart: " |
456 |
| - "The output JSON '%s' has no 'profile' field (or it is not a string)", |
457 |
| - j->json_description.c_str()); |
458 |
| - |
459 | 407 | XBT_DEBUG("Job '%s' Loaded", j->id.to_string().c_str());
|
460 | 408 | return j;
|
461 | 409 | }
|
|
0 commit comments