test_jobs: test_jobs

View source: R/testAPI.R

test_jobsR Documentation

test_jobs

Description

performing jobs locally.

Usage

test_jobs(
  work_func,
  data = NULL,
  n = NULL,
  init_func = NULL,
  global_vars = NULL,
  packages = c(),
  files = c(),
  callback_function = NULL,
  install_func = NULL
)

Arguments

work_func

data processing function with prototype function(data_element) if 'data' is specified or function() if 'n' is specified. This function runs for each element in data. This function can be recursive.

data

data for processing. Must be a numerable list or vector.

n

a number of jobs. This parameter must be less than or equal to the length of the data. If not specified, then the number of jobs will be equal to the length of the data.

init_func

initialization function with prototype function(). This function runs once at the start of a job before the job is split into separate threads. This function can not to be recursive.

global_vars

a list in the format <variable name>=<value>.

packages

a string vector with imported packages names.

files

a string vector with the files names that should be available for jobs.

callback_function

a function with prototype function(result_element) that is called for each result after loading. The value returned by this function is placed in the result list.

install_func

installation function with prototype function(packages), where packages is a vector with package names which cannot be installed from repositories. This function can not to be recursive.

Details

Like create_jobs, it creates a jobs for the BOINC server but does not submit them. Instead, it runs all jobs locally and generates a report at each step. This function is intended for debugging applications that use RBOINC. Files created by this function are not deleted after its completion.

Errors and warnings

When errors occur, execution can be stopped with the following messages:

  • "Archive making error: <error message>"

  • "You must specify 'data' or 'n'."

  • "The number of tasks must be less or equal than length of data."

Value

a list with states of jobs. This list contains the following fields:

  • log - Rscript output;

  • result - computation result.

Examples

## Not run: 

# Function for data processing:
fun = function(val)
{
   ...
}

# Data for processing:
data = list(...)

# Test jobs locally:
res = test_jobs(fun, data)


## End(Not run)

RBOINC.cl documentation built on Nov. 15, 2022, 3 a.m.