diff --git a/include/actsim_agent/actsim_agent.hpp b/include/actsim_agent/actsim_agent.hpp index e19945d..d723349 100644 --- a/include/actsim_agent/actsim_agent.hpp +++ b/include/actsim_agent/actsim_agent.hpp @@ -28,7 +28,7 @@ #include -#define DATABASE_VERSION 2 +#define DATABASE_VERSION 3 #define DOWNLOAD_BUFFER 5 diff --git a/src/actsim_agent/downloader.cpp b/src/actsim_agent/downloader.cpp index 2b09102..e16b3cd 100644 --- a/src/actsim_agent/downloader.cpp +++ b/src/actsim_agent/downloader.cpp @@ -113,6 +113,7 @@ bool Downloader::fetch_tasks(size_t n) { pqxx::row res = txn->exec1( "SELECT " " ap.design_file AS design, " + " ap.top_proc, " " ap.outputs AS target_artifact, " " ap.id AS source_pass, " " sc.id AS source_config, " @@ -135,7 +136,7 @@ bool Downloader::fetch_tasks(size_t n) { ); // seems like there is nothing to do right now - if (res.empty()) { + if (res.size() > 0) { *task_avail = false; return; } @@ -147,6 +148,23 @@ bool Downloader::fetch_tasks(size_t n) { *design = res["design"].as(); *source_config = res["source_config"].as(); + std::vector commands; + auto arr = res["sim_commands"].as_array(); + std::pair elem; + do { + elem = arr.get_next(); + if (elem.first == pqxx::array_parser::juncture::string_value) { + commands.push_back(elem.second); + } + } while (elem.first != pqxx::array_parser::juncture::done); + + *testcase = { + commands, + res["top_proc"].as(), + false, + 0 + }; + if (res["id"].is_null()) { // create a new sim output row in the database pqxx::row new_row = txn->exec_params1(