host_req_list *parse_exec_hosts(

  char *exec_hosts_param,
  const char *mppnodes)

  {
  char            *slash;
  char            *host_tok;
  char            *exec_hosts = strdup(exec_hosts_param);
  char            *str_ptr = exec_hosts;
  const char     *delims = "+";
  host_req        *hr;
  host_req_list   *list = new host_req_list();

  while ((host_tok = threadsafe_tokenizer(&str_ptr, delims)) != NULL)
    {
    if ((slash = strchr(host_tok, '/')) != NULL)
      *slash = '\0';

    /* skip this host - the login shouldn't be part of the alps reservation */
    if ((strcmp(mom_host, host_tok)) &&
        (strcmp(mom_alias, host_tok)))
      {
      std::vector<int> indices;

      if (slash != NULL)
        {
        translate_range_string_to_vector(slash + 1, indices);
        hr = get_host_req(host_tok, indices.size());
        }
      else
        hr = get_host_req(host_tok, 1);

      list->push_back(hr);
      }
    }

  free(exec_hosts);
  return(sort_exec_hosts(list,mppnodes));
  } /* END parse_exec_hosts() */
Beispiel #2
0
resizable_array *parse_exec_hosts(

  char *exec_hosts_param)

  {
  char            *slash;
  char            *host_tok;
  char            *exec_hosts = strdup(exec_hosts_param);
  char            *str_ptr = exec_hosts;
  char            *delims = "+";
  char            *prev_host_tok = NULL;
  host_req        *hr;
  resizable_array *host_req_list = initialize_resizable_array(100);

  while ((host_tok = threadsafe_tokenizer(&str_ptr, delims)) != NULL)
    {
    if ((slash = strchr(host_tok, '/')) != NULL)
      *slash = '\0';

    /* skip this host - the login shouldn't be part of the alps reservation */
    if ((strcmp(mom_host, host_tok)) &&
        (strcmp(mom_alias, host_tok)))
      {
      if ((prev_host_tok != NULL) &&
          (!strcmp(prev_host_tok, host_tok)))
        {
        hr = (host_req *)host_req_list->slots[host_req_list->last].item;
        hr->ppn += 1;
        }
      else
        {
        prev_host_tok = host_tok;
        hr = get_host_req(host_tok);
        insert_thing(host_req_list, hr);
        }
      }
    }

  free(exec_hosts);

  return(host_req_list);
  } /* END parse_exec_hosts() */
Beispiel #3
0
host_req_list *parse_exec_hosts(

  char *exec_hosts_param,
  const char *mppnodes)

  {
  char            *slash;
  char            *host_tok;
  char            *exec_hosts = strdup(exec_hosts_param);
  char            *str_ptr = exec_hosts;
  const char     *delims = "+";
  char            *prev_host_tok = NULL;
  host_req        *hr;
  host_req_list   *list = new host_req_list();

  while ((host_tok = threadsafe_tokenizer(&str_ptr, delims)) != NULL)
    {
    if ((slash = strchr(host_tok, '/')) != NULL)
      *slash = '\0';

    /* skip this host - the login shouldn't be part of the alps reservation */
    if ((strcmp(mom_host, host_tok)) &&
        (strcmp(mom_alias, host_tok)))
      {
      if ((prev_host_tok != NULL) &&
          (!strcmp(prev_host_tok, host_tok)))
        {
        hr = list->back();
        hr->ppn += 1;
        }
      else
        {
        prev_host_tok = host_tok;
        hr = get_host_req(host_tok);
        list->push_back(hr);
        }
      }
    }

  free(exec_hosts);
  return(sort_exec_hosts(list,mppnodes));
  } /* END parse_exec_hosts() */