Esempio n. 1
0
void Trick::MonteCarlo::default_slave_dispatch_pre_text(Trick::MonteSlave* slave_to_init, std::string &buffer) {
    /** <ul><li> If the slave is running locally, use a local shell. */
    if (!localhost_as_remote &&
        (equals_ignore_case(slave_to_init->machine_name, machine_name) ||
         equals_ignore_case(slave_to_init->machine_name, std::string("localhost")))) {
        buffer = "/bin/sh -c '";
    /** <li> Otherwise, use the appropriate remote shell. */
    } else {
        switch (slave_to_init->remote_shell) {
            case TRICK_RSH:
                buffer = unix_rsh;
            break;
            case TRICK_USER_REMOTE_SH:
                if (slave_to_init->user_remote_shell.empty()) {
                    slave_to_init->user_remote_shell = unix_ssh;
                    if (verbosity >= ERROR) {
                        message_publish(MSG_WARNING, "Monte: TRICK_USER_REMOTE_SH specified for Slave %s:%d, but no shell given.\n"
                                                     "Defaulting to %s.\n",
                                        machine_name.c_str(), slave_to_init->id, slave_to_init->user_remote_shell.c_str()) ;
                    }
                }
                buffer = slave_to_init->user_remote_shell;
            break;
            default:
                buffer = unix_ssh;
            break;
        }
        /** <ul><li> Add the user-specified remote shell arguments and the remote machine name. </ul> */
        buffer += " " + slave_to_init->remote_shell_args + " " + slave_to_init->machine_name + " '";
    }

    /** <li> Add the user command string to allow passing
     * of environment variables and such to the slave.
     */
    if (!user_cmd_string.empty()) {
        buffer += user_cmd_string + "; ";
    }

    /** <li> Add the command to switch to the appropriate directory. */
    if (slave_to_init->remote_shell != TRICK_USER_REMOTE_SH) {
        buffer += "cd ";
        if (!slave_to_init->sim_path.empty()) {
            buffer += slave_to_init->sim_path;
        } else {
            buffer += std::string(command_line_args_get_default_dir());
        }
        buffer += std::string("; ");
    }
}
Esempio n. 2
0
/**
 * @par Detailed Design:
 * This function will only disable the slave when called from the input file at initialization.
 */
void Trick::MonteCarlo::disable_slave(std::string name, bool disabled){
    for (std::vector<MonteSlave *>::size_type i = 0; i < slaves.size(); ++i) {
        if (equals_ignore_case(slaves[i]->machine_name, name)) {
            if (disabled) {
                slaves[i]->state = Trick::MonteSlave::STOPPED;
            } else {
                slaves[i]->state = Trick::MonteSlave::UNINITIALIZED;
            }
            return;
        }
    }
}
bool AddressInfo::operator<(const AddressInfo& b) const {
  if( equals_ignore_case( service, b.service ) )
    return less_ignore_case( node , b.node );
  return less_ignore_case( service, b.service );
}
bool AddressInfo::operator==(const AddressInfo& b) const {
  return equals_ignore_case( node, b.node )
      && equals_ignore_case( service, b.service );
}