enqueue_bulk: Bulk queuing

Description Usage Arguments Details

Description

Bulk queuing. Similar in some respects to things like apply. This is an experiment to deal with the pattern where you have a big pile of parameters in a data.frame to loop over, by applying a function to each row.

Usage

1
2
3
4
5
6
enqueue_bulk(X, FUN, rrq, do.call = FALSE, group = NULL, timeout = Inf,
  time_poll = 1, delete_tasks = FALSE, progress_bar = TRUE,
  env = parent.frame())

enqueue_bulk_submit(X, FUN, rrq, do.call = FALSE, group = NULL,
  progress_bar = TRUE, env = parent.frame())

Arguments

X

An object to loop over. If a list, we'll loop over the elements of the list, duplicating the behaviour of rrqlapply except for not handling dots. If a data.frame we'll loop over the rows. Matrices are not supported.

FUN

A function. Will be found in the same way as FUN within rrqlapply.

rrq

An rrq object

do.call

Behave like (but not via) do.call; given an element el, rather than run FUN(el) run FUN(el[[1]], el[[2]], ...).

group

Name of a group for generated task ids. If not included, an ID will be generated.

timeout

Total length of time to wait for tasks to be completed. The default is to wait forever (like lapply).

time_poll

Time to poll for tasks. Must be an integer. Because of how the function is implemented, R will be unresponsive for this long each iteration (unless results are returned), so the default of 1s should be reasonable.

delete_tasks

Delete tasks on successful finish?

progress_bar

Display a progress bar?

env

Environment to look in

Details

There are two modes here; selected with do.call. With do.call=FALSE, the default, the function behaves similarly to apply(X, FUN, 1); that is the function is applied to each row of the data.frame (as a list): FUN(as.list(X[1,])), FUN(as.list(X[2,])), and so on. The alternative mode (do.call=TRUE) is where the data.frame contains parameters to the function FUN so equivalent to FUN(X[1,1], X[1,2], .... This is similar (but not implemented as) running: do.call("FUN", as.list(X[1,])).

Be careful, this one is going to change, including the name probably. You have been warned.


traitecoevo/rrqueue documentation built on May 31, 2019, 7:44 p.m.