mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Merge pull request #765 from nasa/763
Add ability to specify MC slave output directory
This commit is contained in:
commit
b694d5412b
@ -259,6 +259,9 @@ namespace Trick {
|
||||
/** Options to be passed to the slave sim. */
|
||||
std::string slave_sim_options;
|
||||
|
||||
/** Base output directory for slaves. */
|
||||
std::string slave_output_directory;
|
||||
|
||||
private:
|
||||
int run_queue(Trick::ScheduledJobQueue* queue, std::string in_string) ;
|
||||
|
||||
|
@ -101,6 +101,12 @@ void mc_set_user_cmd_string(const char *user_cmd_string);
|
||||
*/
|
||||
void mc_set_slave_sim_options(const char *slave_sim_options);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
* set #Trick::MonteCarlo::slave_output_directory
|
||||
*/
|
||||
void mc_set_slave_output_directory(const char *slave_output_directory);
|
||||
|
||||
/**
|
||||
* @relates Trick::MonteCarlo
|
||||
* get #Trick::MonteCarlo::slave_sim_options
|
||||
|
@ -110,6 +110,12 @@ extern "C" void mc_set_slave_sim_options(const char *slave_sim_options) {
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void mc_set_slave_output_directory(const char *slave_output_directory) {
|
||||
if ( the_mc != NULL ) {
|
||||
the_mc->slave_output_directory = std::string(slave_output_directory ? slave_output_directory : "");
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" const char *mc_get_slave_sim_options(void) {
|
||||
if ( the_mc != NULL ) {
|
||||
return the_mc->slave_sim_options.c_str();
|
||||
|
@ -19,7 +19,7 @@ void Trick::MonteCarlo::dispatch_run_to_slave(MonteRun *run, MonteSlave *slave)
|
||||
connection_device.port = slave->port;
|
||||
if (tc_connect(&connection_device) == TC_SUCCESS) {
|
||||
std::stringstream buffer_stream;
|
||||
buffer_stream << run_directory << "/RUN_" << std::setw(5) << std::setfill('0') << run->id;
|
||||
buffer_stream << slave_output_directory << "/RUN_" << std::setw(5) << std::setfill('0') << run->id;
|
||||
std::string buffer = "";
|
||||
for (std::vector<std::string>::size_type j = 0; j < run->variables.size(); ++j) {
|
||||
buffer += run->variables[j] + "\n";
|
||||
|
@ -34,6 +34,12 @@ int Trick::MonteCarlo::construct_run_directory() {
|
||||
return -1;
|
||||
}
|
||||
run_directory = run_base_directory + "MONTE_" + run_directory;
|
||||
|
||||
// If the user hasn't set an output directory for slaves, default to
|
||||
// the same location as the master's output.
|
||||
if (slave_output_directory.empty()) {
|
||||
slave_output_directory = run_directory;
|
||||
}
|
||||
}
|
||||
|
||||
if (access(run_directory.c_str(), F_OK) != 0) {
|
||||
|
@ -49,7 +49,7 @@ void Trick::MonteCarlo::initialize_slave(Trick::MonteSlave* slave_to_init) {
|
||||
<< " --monte_host " << machine_name
|
||||
<< " --monte_sync_port " << listen_device.port
|
||||
<< " --monte_client_id " << slave_to_init->id
|
||||
<< " -O " << run_directory;
|
||||
<< " -O " << slave_output_directory;
|
||||
buffer += ss.str();
|
||||
|
||||
/** <li> Append user sim options. */
|
||||
|
Loading…
Reference in New Issue
Block a user