public interface RBroker
RBroker
an
application developer can focus entirely on integrating
R Analytics, while offloading the complexity
of managing client-side API task queues and server-side
R session lifecycles.
The basic programming model for working with
RBroker
is as follows:
RBrokerFactory
to create an appropriate instance of
RBroker
.
RTask
.
RTask
to
RBroker
for execution.
RTask
using RTaskToken
.
RTask
found within RTaskResult
.
RTaskListener
with your
RBroker instance and the RBroker will automatically notify your
application when each
RTask
completes.
This approach allows your application to skip step 5. above
and scale effortlessly.
Modifier and Type | Method and Description |
---|---|
void |
addBrokerListener(RBrokerListener brokerListener)
Register an asynchronous listener to receive callbacks
on
RBroker
runtime statistics events or runtime errors. |
void |
addTaskListener(RTaskListener taskListener)
Register an asynchronous listener to receive callbacks
on
RTask completion
or failure events. |
RBrokerStatus |
flush()
|
boolean |
isConnected()
Indicates if current
RBroker
instance is still connected to the DeployR server. |
int |
maxConcurrency()
Returns the task execution concurrency levels enforced for
this instance of
RBroker . |
com.revo.deployr.client.RUser |
owner()
Returns a token indicating the owner of the current instance of
RBroker . |
void |
refresh(RBrokerConfig config)
Refresh configuration for
RBroker . |
void |
shutdown()
Release all client-side and server-side resources maintained
by or on behalf of an instance of
RBroker . |
void |
simulateApp(RTaskAppSimulator appSimulator)
Launch an RTaskAppSimulator simulation.
|
RBrokerStatus |
status()
|
RTaskToken |
submit(RTask task)
|
RTaskToken |
submit(RTask task,
boolean priority)
|
void refresh(RBrokerConfig config) throws RBrokerException
RBroker
.
Note, support for refresh is only available on the
PooledTaskBroker runtime. In addition, only
PoolCreationOptions
are processed on this call. All other RBrokerConfig options are
ignored.
A refresh causes all workspace objects and directory files
in the underlying R sessions within the pool to be
cleared before new workspace objects and/or directory
files are loaded per the new config options.
Only an idle RBroker
instance can be refreshed. An
RBrokerException
will be raised if this method is called when the instance
of RBroker
is currently busy with queued or executing
RTask
.RBrokerException
RTaskToken submit(RTask task) throws RBrokerException
RBrokerException
RTaskToken submit(RTask task, boolean priority) throws RBrokerException
RTask
for execution under the control of
RBroker
.
Priority tasks are automatically moved to the front of the
queue, ahead of all standard tasks that are already pending
execution by the broker.RBrokerException
void addTaskListener(RTaskListener taskListener) throws RBrokerException
RTask
completion
or failure events.RBrokerException
void addBrokerListener(RBrokerListener brokerListener) throws RBrokerException
RBroker
runtime statistics events or runtime errors.RBrokerException
void simulateApp(RTaskAppSimulator appSimulator)
RTask
defined
by your simulation will be automatically executed by
the current instance of
RBroker
.
Make sure to register your
RTaskListener
and RBrokerListener
before starting your simulation in order to receive
asynchronous callbacks in your application when
RTask
complete
and/or to receive runtime summary statistics from
RBroker
as the
simulation proceeds.int maxConcurrency()
RBroker
.RBrokerStatus status()
RTask
activity on RBroker
.
This call can be used to determine if an RBroker instance is
idle which can be particularly useful ahead calls to
shutdown()
.
The RBrokerStatus.pendingTasks
and RBrokerStatus.executingTasks
fields can be used by an application to estimate time remaining
until RBroker
reaches an idle
state.
The RBrokerStatus.isIdle
field
is provided for convenience for an application if individual pending
and executing task counts are not relevant in
shutdown()
decisions.RBrokerStatus flush()
boolean isConnected()
RBroker
instance is still connected to the DeployR server. A connection may
be lost for a number of reasons, for example, due to a droppeed
network connection between client and server or if the DeployR server
itself goes down.void shutdown()
RBroker
.com.revo.deployr.client.RUser owner()