Example #1
0
dynamic_string *get_reservation_command(

  resizable_array *host_req_list,
  char            *username,
  char            *jobid,
  char            *apbasil_path,
  char            *apbasil_protocol,
  char            *multi_req_list,
  int              use_nppn,
  int              nppcu,
  int              mppdepth)

  {
  dynamic_string *command = get_dynamic_string(-1, NULL);
  dynamic_string *node_list = get_dynamic_string(-1, NULL);
  char            buf[MAXLINE * 2];

  /* place the top header */
  snprintf(buf, sizeof(buf), APBASIL_RESERVE_REQ, 
    (apbasil_protocol != NULL) ? apbasil_protocol : DEFAULT_APBASIL_PROTOCOL);
  append_dynamic_string(command, buf);

  /* place the reserve header */
  snprintf(buf, sizeof(buf), APBASIL_RESERVE_ARRAY, username, jobid);
  append_dynamic_string(command, buf);

  if (multi_req_list == NULL)
    {
    create_reserve_params_from_host_req_list(host_req_list, apbasil_protocol, use_nppn, nppcu, mppdepth, command);
    }
  else
    {
    /* no need to account for use_nppn here, this path always should */
    create_reserve_params_from_multi_req_list(multi_req_list, apbasil_protocol, nppcu, mppdepth, command);
    }

  free_dynamic_string(node_list);

  /* pipe the output to apbasil */
  snprintf(buf, sizeof(buf), "</ReserveParamArray></BasilRequest>\" | %s",
    (apbasil_path != NULL) ? apbasil_path : DEFAULT_APBASIL_PATH);
  append_dynamic_string(command, buf);

  return(command);
  } /* END get_reservation_command() */
void get_reservation_command(

  host_req_list   *list,
  char            *username,
  char            *jobid,
  char            *apbasil_path,
  char            *apbasil_protocol,
  char            *multi_req_list,
  int              use_nppn,
  int              nppcu,
  int              mppdepth,
  std::string&     command,
  std::string&     cray_frequency)

  {
  std::string      node_list = "";
  char            buf[MAXLINE * 2];

  command.clear();
  /* place the top header */
  snprintf(buf, sizeof(buf), APBASIL_RESERVE_REQ, 
    (apbasil_protocol != NULL) ? apbasil_protocol : DEFAULT_APBASIL_PROTOCOL);
  command += buf;

  /* place the reserve header */
  snprintf(buf, sizeof(buf), APBASIL_RESERVE_ARRAY, username, jobid);
  command += buf;

  if (multi_req_list == NULL)
    {
    create_reserve_params_from_host_req_list(list, apbasil_protocol, use_nppn, nppcu, mppdepth, command, cray_frequency);
    }
  else
    {
    /* no need to account for use_nppn here, this path always should */
    create_reserve_params_from_multi_req_list(multi_req_list, apbasil_protocol, nppcu, mppdepth, command, cray_frequency);
    }

  /* pipe the output to apbasil */
  snprintf(buf, sizeof(buf), "</ReserveParamArray></BasilRequest>\" | %s",
    (apbasil_path != NULL) ? apbasil_path : DEFAULT_APBASIL_PATH);
  command += buf;
  } /* END get_reservation_command() */