Example #1
0
int main( int argc , char ** argv) {
  lsf_driver_type * driver = lsf_driver_alloc();

  test_option( driver , LSF_BSUB_CMD    , "Xbsub");
  test_option( driver , LSF_BJOBS_CMD   , "Xbsub");
  test_option( driver , LSF_BKILL_CMD   , "Xbsub");
  test_option( driver , LSF_RSH_CMD     , "RSH");
  test_option( driver , LSF_LOGIN_SHELL , "shell");
  test_option( driver , LSF_BSUB_CMD    , "bsub");
  printf("Options OK\n");

  test_server( driver , NULL , LSF_SUBMIT_INTERNAL );
  test_server( driver , "LoCaL" , LSF_SUBMIT_LOCAL_SHELL );
  test_server( driver , "LOCAL" , LSF_SUBMIT_LOCAL_SHELL );
  test_server( driver , "XLOCAL" , LSF_SUBMIT_REMOTE_SHELL );
  test_server( driver , NULL , LSF_SUBMIT_INTERNAL );
  test_server( driver , "be-grid01" , LSF_SUBMIT_REMOTE_SHELL );
  printf("Servers OK\n");

  test_status( JOB_STAT_PEND   , JOB_QUEUE_PENDING );
  test_status( JOB_STAT_PSUSP  , JOB_QUEUE_RUNNING );
  test_status( JOB_STAT_USUSP  , JOB_QUEUE_RUNNING );
  test_status( JOB_STAT_SSUSP  , JOB_QUEUE_RUNNING );
  test_status( JOB_STAT_RUN    , JOB_QUEUE_RUNNING );
  test_status( JOB_STAT_NULL   , JOB_QUEUE_NOT_ACTIVE );
  test_status( JOB_STAT_DONE   , JOB_QUEUE_DONE );
  test_status( JOB_STAT_EXIT   , JOB_QUEUE_EXIT );
  test_status( JOB_STAT_UNKWN  , JOB_QUEUE_EXIT );
  test_status( 192             , JOB_QUEUE_DONE ); 
  
  printf("Status OK \n");
  exit(0);
}
Example #2
0
queue_driver_type * queue_driver_alloc(job_driver_type type) {
  queue_driver_type * driver = queue_driver_alloc_empty();
  driver->driver_type = type;
  switch (type) {
    case LSF_DRIVER:
      driver->submit = lsf_driver_submit_job;
      driver->get_status = lsf_driver_get_job_status;
      driver->kill_job = lsf_driver_kill_job;
      driver->free_job = lsf_driver_free_job;
      driver->free_driver = lsf_driver_free__;
      driver->set_option = lsf_driver_set_option;
      driver->get_option = lsf_driver_get_option;
      driver->has_option = lsf_driver_has_option;
      driver->name = util_alloc_string_copy("LSF");
      driver->init_options = lsf_driver_init_option_list;
      driver->data = lsf_driver_alloc();
      break;
    case LOCAL_DRIVER:
      driver->submit = local_driver_submit_job;
      driver->get_status = local_driver_get_job_status;
      driver->kill_job = local_driver_kill_job;
      driver->free_job = local_driver_free_job;
      driver->free_driver = local_driver_free__;
      driver->name = util_alloc_string_copy("local");
      driver->init_options = local_driver_init_option_list;
      driver->data = local_driver_alloc();
      break;
    case RSH_DRIVER:
      driver->submit = rsh_driver_submit_job;
      driver->get_status = rsh_driver_get_job_status;
      driver->kill_job = rsh_driver_kill_job;
      driver->free_job = rsh_driver_free_job;
      driver->free_driver = rsh_driver_free__;
      driver->set_option = rsh_driver_set_option;
      driver->get_option = rsh_driver_get_option;
      driver->name = util_alloc_string_copy("RSH");
      driver->init_options = rsh_driver_init_option_list;
      driver->data = rsh_driver_alloc();
      break;
    case TORQUE_DRIVER:
      driver->submit = torque_driver_submit_job;
      driver->get_status = torque_driver_get_job_status;
      driver->kill_job = torque_driver_kill_job;
      driver->free_job = torque_driver_free_job;
      driver->free_driver = torque_driver_free__;
      driver->set_option = torque_driver_set_option;
      driver->get_option = torque_driver_get_option;
      driver->name = util_alloc_string_copy("TORQUE");
      driver->init_options = torque_driver_init_option_list;
      driver->data = torque_driver_alloc();
      break;
    default:
      util_abort("%s: unrecognized driver type:%d \n", __func__, type);
  }
  
  queue_driver_set_generic_option__(driver, MAX_RUNNING, "0");
  return driver;
}
int main( int argc , char ** argv) {
  lsf_driver_type * driver = lsf_driver_alloc();
  stringlist_type * server_list = stringlist_alloc_from_split( argv[2] , " ");
  int iarg;
  for (iarg = 0; iarg < stringlist_get_size( server_list ); iarg++) {
    const char * server = stringlist_iget( server_list , iarg );
    test_submit(driver , server , NULL , NULL , NULL , argv[1]);
  }
  stringlist_free( server_list );

  exit(0);
}
int main( int argc , char ** argv) {
  lsf_driver_type * driver = lsf_driver_alloc();
  test_submit(driver , argv[1]);
  lsf_driver_free( driver );
  exit(0);
}
Example #5
0
int main( int argc, char ** argv) {
  if (argc == 1)
    util_exit("block_node  node1  node2  node3:2  \n");
  
  /* Initialize lsf environment */
  util_setenv( "LSF_BINDIR"    , "/prog/LSF/9.1/linux2.6-glibc2.3-x86_64/bin" );
  util_setenv( "LSF_LINDIR"    , "/prog/LSF/9.1/linux2.6-glibc2.3-x86_64/lib" );
  util_setenv( "XLSF_UIDDIR"   , "/prog/LSF/9.1/linux2.6-glibc2.3-x86_64/lib/uid" );
  util_setenv( "LSF_SERVERDIR" , "/prog/LSF/9.1/linux2.6-glibc2.3-x86_64/etc");
  util_setenv( "LSF_ENVDIR"    , "/prog/LSF/conf");
  
  util_update_path_var( "PATH"               , "/prog/LSF/9.1/linux2.6-glibc2.3-x86_64/bin" , false);
  util_update_path_var( "LD_LIBRARY_PATH"    , "/prog/LSF/9.1/linux2.6-glibc2.3-x86_64/lib" , false);

  
  lsf_driver = lsf_driver_alloc();
  if (lsf_driver_get_submit_method( lsf_driver ) != LSF_SUBMIT_INTERNAL)
    util_exit("Sorry - the block_node program must be invoked on a proper LSF node \n");

  {
    
    int iarg;
    int total_blocked_target = 0;
    nodes       = hash_alloc();
    for (iarg = 1; iarg < argc; iarg++) {
      char   *node_name;
      int    num_slots;
      
      {
        char * num_slots_string;
        util_binary_split_string( argv[iarg] , ":" , true , &node_name , &num_slots_string);
        if (num_slots_string)
          util_sscanf_int( num_slots_string , &num_slots);
        else
          num_slots = 1;
      }
      
      if (!hash_has_key( nodes , node_name))
        hash_insert_hash_owned_ref( nodes , node_name , count_pair_alloc() , free);

      {
        count_pair_type * pair = hash_get( nodes , node_name);
        pair->target += num_slots;
      }
      total_blocked_target += num_slots;
    }

    signal(SIGINT , block_node_exit );
    {
      const int sleep_time    = 5;
      const int chunk_size    = 10;    /* We submit this many at a time. */
      const int max_pool_size = 1000;  /* The absolute total maximum of jobs we will submit. */  

      bool           cont        = true;
      int            pending     = 0;   
      bool           all_blocked;
      job_pool                   = vector_alloc_new();

      while (cont) {
        printf("[Ctrl-C to give up] "); fflush( stdout );
        if (cont) sleep( sleep_time );
        if (pending == 0) {
          if (vector_get_size( job_pool ) < max_pool_size)
            add_jobs( chunk_size );
        }
        
        update_pool_status( &all_blocked , &pending);
        print_status();

        if (all_blocked)
          cont = false;
      }
      if (!all_blocked)
        printf("Sorry - failed to block all the nodes \n");
      
      block_node_exit( 0 );
      hash_free( nodes );
    }
  }
}