Exemplo n.º 1
0
/**
   This site_config object is not really ready for prime time.
 */
site_config_type * site_config_alloc_empty() {
  site_config_type * site_config = util_malloc(sizeof * site_config);

  site_config->joblist = ext_joblist_alloc();
  site_config->queue_drivers = hash_alloc();

  site_config->lsf_queue_name_site = NULL;
  site_config->lsf_request_site = NULL;
  site_config->rsh_command_site = NULL;
  site_config->license_root_path = NULL;
  site_config->license_root_path_site = NULL;
  site_config->__license_root_path = NULL;
  site_config->job_script = NULL;
  site_config->job_script_site = NULL;
  site_config->manual_url = NULL;
  site_config->default_browser = NULL;
  site_config->user_mode = false;
  site_config->driver_type = NULL_DRIVER;

  site_config->job_queue = job_queue_alloc(DEFAULT_MAX_SUBMIT, "OK", "ERROR");
  site_config->env_variables_user = hash_alloc();
  site_config->env_variables_site = hash_alloc();

  site_config->path_variables_user = stringlist_alloc_new();
  site_config->path_values_user = stringlist_alloc_new();
  site_config->path_variables_site = hash_alloc();

  /* Some hooops to get the current umask. */
  site_config->umask = umask(0);
  site_config_set_umask(site_config, site_config->umask);
  site_config_set_manual_url(site_config, DEFAULT_MANUAL_URL);
  site_config_set_default_browser(site_config, DEFAULT_BROWSER);
  site_config_set_max_submit(site_config, DEFAULT_MAX_SUBMIT);
  return site_config;
}
Exemplo n.º 2
0
void job_queue_set_driver_(job_driver_type driver_type) {
  job_queue_type * queue = job_queue_alloc( 10 , "OK" , "ERROR");
  queue_driver_type * driver = queue_driver_alloc( driver_type );
  test_assert_false( job_queue_has_driver( queue ));
  
  job_queue_set_driver( queue , driver );
  test_assert_true( job_queue_has_driver( queue ));
}
Exemplo n.º 3
0
void test_create() {
  job_queue_type * job_queue = job_queue_alloc( 100 , "OK" , "ERROR");
  job_queue_manager_type * manager = job_queue_manager_alloc( job_queue );
  
  test_assert_true( job_queue_manager_is_instance( manager ));
  
  job_queue_manager_free( manager );
  job_queue_free( job_queue );
}
Exemplo n.º 4
0
static void site_config_install_job_queue(site_config_type  * site_config ) {
  if (site_config->job_script == NULL)
    util_exit("Must set the path to the job script with the %s key in the site_config / config file\n",JOB_SCRIPT_KEY);
  
  site_config->job_queue = job_queue_alloc(site_config->max_submit , "OK" , "ERROR" );

  /* 
     All the various driver options are set, unconditionally of which
     driver is actually selected in the end.
  */
  site_config_set_job_queue__( site_config , site_config->driver_type );
}
Exemplo n.º 5
0
int main(int argc , char ** argv) {
  const int queue_timeout =  180;
  const int submit_timeout = 180;
  const int status_timeout = 180;
  const int number_of_jobs = 250;
  const int submit_threads = number_of_jobs / 10 ;
  const int status_threads = number_of_jobs + 1;
  const char * job = util_alloc_abs_path(argv[1]);
  rng_type * rng = rng_alloc( MZRAN , INIT_CLOCK );
  test_work_area_type * work_area = test_work_area_alloc("job_queue");
  job_type **jobs = alloc_jobs( rng , number_of_jobs , job);

  job_queue_type * queue = job_queue_alloc(number_of_jobs, "OK", "ERROR");
  queue_driver_type * driver = queue_driver_alloc_local();
  job_queue_manager_type * queue_manager = job_queue_manager_alloc( queue );

  job_queue_set_driver(queue, driver);
  job_queue_manager_start_queue(queue_manager, 0, false , true);

  {
    thread_pool_type * status_pool = thread_pool_alloc( status_threads , true );
    thread_pool_type * submit_pool = thread_pool_alloc( submit_threads , true );

    submit_jobs( queue , number_of_jobs , jobs , submit_pool );
    status_jobs( queue , number_of_jobs , jobs , status_pool );

    if (!thread_pool_try_join( submit_pool , submit_timeout ))
      util_exit("Joining submit pool failed \n");
    thread_pool_free( submit_pool );

    job_queue_submit_complete(queue);

    if (!thread_pool_try_join( status_pool , status_timeout))
      util_exit("Joining status pool failed \n");
    thread_pool_free( status_pool );
  }

  if (!job_queue_manager_try_wait(queue_manager , queue_timeout))
    util_exit("job_queue never completed \n");

  job_queue_manager_free(queue_manager);
  job_queue_free(queue);
  queue_driver_free(driver);
  check_jobs( number_of_jobs , jobs );
  test_work_area_free(work_area);
  rng_free( rng );
}