コード例 #1
0
struct pbsnode *get_next_login_node(

  struct prop *needed)

  {
  struct pbsnode *pnode = NULL;
  login_node     *ln;
  int             node_fits = TRUE;

  pthread_mutex_lock(logins.ln_mutex);
  ln = (login_node *)logins.ra->slots[logins.next_node].item;

  if (ln != NULL)
    {
    pnode = ln->pnode;
    lock_node(pnode, __func__, NULL, LOGLEVEL);
    
    if (needed != NULL)
      {
      if (hasprop(pnode, needed) == FALSE)
        {
        node_fits = FALSE;
        }
      }
    
    /* must have at least one execution slot available */
    if ((pnode->nd_nsn - pnode->nd_np_to_be_used < 1) ||
        ((pnode->nd_state & INUSE_DOWN) != 0) ||
        ((pnode->nd_state & INUSE_OFFLINE) != 0))
      {
      node_fits = FALSE;
      }
    
    if (node_fits == FALSE)
      {
      unlock_node(pnode, __func__, NULL, LOGLEVEL);
      pnode = find_fitting_node(needed);
      }
    else
      {
      ln->times_used++;
      update_next_node_index(ln->times_used);
      }
    }

  pthread_mutex_unlock(logins.ln_mutex);

  return(pnode);
  } /* END get_next_login_node() */
コード例 #2
0
ファイル: login_nodes.c プロジェクト: AlbertDeFusco/torque
struct pbsnode *get_next_login_node(

  struct prop *needed)

  {
  struct pbsnode *pnode = NULL;
  int             node_fits = TRUE;

  pthread_mutex_lock(logins.ln_mutex);
  login_node &ln = logins.nodes[logins.next_node];

  pnode = ln.pnode;
  lock_node(pnode, __func__, NULL, LOGLEVEL);
  
  if (needed != NULL)
    {
    if (hasprop(pnode, needed) == FALSE)
      {
      node_fits = FALSE;
      }
    }
  
  /* must have at least one execution slot available */
  if ((pnode->nd_slots.get_total_execution_slots() - pnode->nd_np_to_be_used < 1) ||
      ((pnode->nd_state & INUSE_NOT_READY) != 0) ||
      ((pnode->nd_state & INUSE_OFFLINE) != 0) ||
      (pnode->nd_power_state != POWER_STATE_RUNNING))
    {
    node_fits = FALSE;
    }
  
  if (node_fits == FALSE)
    {
    unlock_node(pnode, __func__, NULL, LOGLEVEL);
    pnode = find_fitting_node(needed);
    }
  else
    {
    ln.times_used++;
    update_next_node_index(ln.times_used);
    }

  pthread_mutex_unlock(logins.ln_mutex);

  return(pnode);
  } /* END get_next_login_node() */