void test_submit(lsf_driver_type * driver, const char * cmd) {
  assert( lsf_driver_set_option(driver , LSF_DEBUG_OUTPUT , "TRUE" ) );
  assert( LSF_SUBMIT_INTERNAL == lsf_driver_get_submit_method( driver ));
  {
    char * run_path = util_alloc_cwd();
    lsf_job_type * job = lsf_driver_submit_job( driver , cmd , 1 , run_path , "NAME" , 0 , NULL );
    assert( job );
    {
      {
        int lsf_status = lsf_driver_get_job_status_lsf( driver , job );
        assert( (lsf_status == JOB_STAT_RUN) || (lsf_status == JOB_STAT_PEND) );
      }

      lsf_driver_kill_job( driver , job );
      lsf_driver_set_bjobs_refresh_interval( driver , 0 );
      sleep(1);

      {
        int lsf_status = lsf_driver_get_job_status_lsf( driver , job );
        assert( lsf_status == JOB_STAT_EXIT);
      }
    }

    free( run_path );
  }
}
void test_submit(lsf_driver_type * driver) {
  test_assert_true( lsf_driver_set_option(driver , LSF_DEBUG_OUTPUT , "TRUE" ) );
  test_assert_int_equal( LSF_SUBMIT_INTERNAL , lsf_driver_get_submit_method( driver ));
  {
    char * run_path = util_alloc_cwd();
    lsf_job_type * job = lsf_driver_submit_job( driver , cmd , 1 , run_path , "NAME" , 0 , NULL );
    if (job) {
      {
        int lsf_status = lsf_driver_get_job_status_lsf( driver , job );
        if (!((lsf_status == JOB_STAT_RUN) || (lsf_status == JOB_STAT_PEND))) 
          test_error_exit("Got lsf_status:%d expected: %d or %d \n",lsf_status , JOB_STAT_RUN , JOB_STAT_PEND);
      }
      
      lsf_driver_kill_job( driver , job );
      lsf_driver_set_bjobs_refresh_interval( driver , 0 );
      sleep(1);

      {
        int lsf_status = lsf_driver_get_job_status_lsf( driver , job );
        if (lsf_status != JOB_STAT_EXIT)
          test_error_exit("Got lsf_status:%d expected: %d \n",lsf_status , JOB_STAT_EXIT );
      }
    } else 
      test_error_exit("lsf_driver_submit_job() returned NULL \n");
    
    
    free( run_path );
  }
}
Exemple #3
0
void add_jobs( int chunk_size) {
  int i;
  char * cwd = util_alloc_cwd();
  for (i=0; i < chunk_size; i++) {
    block_job_type * job = block_job_alloc();
    job->lsf_job = lsf_driver_submit_job(lsf_driver , BLOCK_COMMAND , 1 , cwd , "BLOCK" , 0 , NULL );
    vector_append_ref( job_pool , job );
  }
  free( cwd );
}
void test_submit(lsf_driver_type * driver , const char * server , const char * bsub_cmd , const char * bjobs_cmd , const char * bkill_cmd , const char * cmd) {
  lsf_driver_set_option(driver , LSF_SERVER , server );
  
  if (bsub_cmd != NULL)
    lsf_driver_set_option(driver , LSF_BSUB_CMD , server );

  if (bjobs_cmd != NULL)
    lsf_driver_set_option(driver , LSF_BJOBS_CMD , server );

  if (bkill_cmd != NULL)
    lsf_driver_set_option(driver , LSF_BKILL_CMD , server );

  {
    char * run_path = util_alloc_cwd();
    lsf_job_type * job = lsf_driver_submit_job( driver , cmd , 1 , run_path , "NAME" , 0 , NULL );
    
    if (job != NULL) {
      {
        int lsf_status = lsf_driver_get_job_status_lsf( driver , job );
        if (!((lsf_status == JOB_STAT_RUN) || (lsf_status == JOB_STAT_PEND)))
          exit(1);
      }
      
      lsf_driver_kill_job( driver , job );
      lsf_driver_set_bjobs_refresh_interval( driver , 0 );
      sleep(1);

      {
        int lsf_status = lsf_driver_get_job_status_lsf( driver , job );
        if (lsf_status != JOB_STAT_EXIT)
          exit(1);
      }
    } else
      exit(1);
    
    free( run_path );
  }
}