Esempio n. 1
0
END_TEST

START_TEST(add_execution_slot_test)
{
    struct pbsnode node;
    int result = 0;
    initialize_pbsnode(&node, NULL, NULL, 0, FALSE);

    result = add_execution_slot(NULL);
    fail_unless(result == PBSE_RMBADPARAM, "NULL node pointer input fail");

    result = add_execution_slot(&node);
    fail_unless(result == PBSE_NONE, "add_execution_slot_test fail");
}
Esempio n. 2
0
END_TEST


START_TEST(add_execution_slot_test)
  {
  pbsnode node;
  int result = 0;

  result = add_execution_slot(NULL);
  fail_unless(result == PBSE_RMBADPARAM, "NULL node pointer input fail");

  result = add_execution_slot(&node);
  fail_unless(result == PBSE_NONE, "add_execution_slot_test fail");
  }
struct pbsnode *create_alps_subnode(

  struct pbsnode *parent,
  const char     *node_id)

  {
  pbsnode *subnode;
  svrattrl       *plist = NULL;
  int             bad;
  int             rc = PBSE_NONE;

  subnode = new pbsnode(node_id, NULL, false);

  if (subnode->get_error() != PBSE_NONE)
    {
    delete subnode;
    log_err(ENOMEM, __func__, "");
    return(NULL);
    }

  // all nodes have at least 1 core
  add_execution_slot(subnode);
  
  // we need to increment this count for accuracy  
  svr_clnodes++;

  /* do we need to do something else here? */
  subnode->nd_addrs = parent->nd_addrs;

  rc = mgr_set_node_attr(subnode, 
      node_attr_def,
      ND_ATR_LAST,
      plist,
      ATR_DFLAG_MGRD | ATR_DFLAG_MGWR,
      &bad,
      (void *)subnode,
      ATR_ACTION_ALTER,
      false);

  if (rc != PBSE_NONE)
    {
    free(subnode);
    log_err(rc, __func__, "Couldn't set node attributes");
    return(NULL);
    }

  subnode->nd_ntype = NTYPE_CLUSTER;
  subnode->parent = parent;
  subnode->nd_state &= ~INUSE_NOHIERARCHY;

  /* add any properties to the subnodes */
  parent->copy_properties(subnode);

  subnode->lock_node(__func__, NULL, LOGLEVEL);
    
  insert_node(parent->alps_subnodes, subnode);
  
  return(subnode);
  } /* END create_alps_subnode() */
Esempio n. 4
0
struct pbsnode *create_alps_subnode(

  struct pbsnode *parent,
  const char     *node_id)

  {
  struct pbsnode *subnode = (struct pbsnode *)calloc(1, sizeof(struct pbsnode));
  svrattrl       *plist = NULL;
  int             bad;
  int             rc = PBSE_NONE;

  if (initialize_pbsnode(subnode, strdup(node_id), NULL, NTYPE_CLUSTER, FALSE) != PBSE_NONE)
    {
    free(subnode);
    log_err(ENOMEM, __func__, "");
    return(NULL);
    }

  // all nodes have at least 1 core
  add_execution_slot(subnode);
  
  // we need to increment this count for accuracy  
  svr_clnodes++;

  /* do we need to do something else here? */
  subnode->nd_addrs = parent->nd_addrs;

  rc = mgr_set_node_attr(subnode, 
      node_attr_def,
      ND_ATR_LAST,
      plist,
      ATR_DFLAG_MGRD | ATR_DFLAG_MGWR,
      &bad,
      (void *)subnode,
      ATR_ACTION_ALTER);

  if (rc != PBSE_NONE)
    {
    free(subnode);
    log_err(rc, __func__, "Couldn't set node attributes");
    return(NULL);
    }

  subnode->nd_ntype = NTYPE_CLUSTER;
  subnode->parent = parent;

  /* add any properties to the subnodes */
  copy_properties(subnode, parent);

  lock_node(subnode, __func__, NULL, LOGLEVEL);
    
  insert_node(&(parent->alps_subnodes), subnode);
  
  return(subnode);
  } /* END create_alps_subnode() */
Esempio n. 5
0
int set_ncpus(

  struct pbsnode *current,
  struct pbsnode *parent,
  int             ncpus)

  {
  int difference;
  int i;
  int orig_svr_clnodes;

  if (current == NULL)
    return(PBSE_BAD_PARAMETER);
  
  difference = ncpus - current->nd_slots.get_total_execution_slots();
  orig_svr_clnodes = svr_clnodes;

  for (i = 0; i < abs(difference); i++)
    {
    if (difference > 0)
      {
      add_execution_slot(current); 

      svr_clnodes++;
      }
    else if (difference < 0)
      {
      delete_a_subnode(current);
      svr_clnodes--;
      }
    }
   
  if (difference < 0)
    {
    snprintf(log_buffer, sizeof(log_buffer), "ncpus was reduced from %d to %d", orig_svr_clnodes, svr_clnodes);
    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_NODE, __func__, log_buffer);
    }
  else if (current->nd_slots.get_total_execution_slots() > parent->max_subnode_nppn)
    parent->max_subnode_nppn = current->nd_slots.get_total_execution_slots();

#ifdef PENABLE_LINUX_CGROUPS
  if (current->nd_layout.getTotalThreads() != current->nd_slots.get_total_execution_slots())
    {
    current->nd_layout = Machine(current->nd_slots.get_total_execution_slots());
    }
#endif

  return(PBSE_NONE);
  } /* END set_ncpus() */
Esempio n. 6
0
int set_ncpus(

  struct pbsnode *current,
  struct pbsnode *parent,
  const char     *str)

  {
  int ncpus;
  int difference;
  int i, orig_svr_clnodes;

  if (current == NULL)
    return(PBSE_BAD_PARAMETER);
  
  ncpus = atoi(str + ac_cproc_eq_len);
  difference = ncpus - current->nd_slots.get_total_execution_slots();
  orig_svr_clnodes = svr_clnodes;

  for (i = 0; i < abs(difference); i++)
    {
    if (difference > 0)
      {
      add_execution_slot(current); 

      svr_clnodes++;
      }
    else if (difference < 0)
      {
      delete_a_subnode(current);
      svr_clnodes--;
      }
    }
   
  if (difference < 0)
    {
    snprintf(log_buffer, sizeof(log_buffer), "ncpus was reduced from %d to %d", orig_svr_clnodes, svr_clnodes);
    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_NODE, __func__, log_buffer);
    }
  else if (current->nd_slots.get_total_execution_slots() > parent->max_subnode_nppn)
    parent->max_subnode_nppn = current->nd_slots.get_total_execution_slots();

  return(PBSE_NONE);
  } /* END set_ncpus() */