run {acumos}R Documentation

Run-time tools for Acumos

Description

The following functions are not exported and not intended to be used by users, but are useful for Acumos developers, testing and used by the platform itself.

Usage

run(where = getwd(), file = "component.amc", runtime = "runtime.json",
    init.only = FALSE)
data2msg(data, output)
msg2data(msg, input)
send.msg(url, payload, response=FALSE)

Arguments

where

directory in which the component will be run

file

path to the model component file (as created by compose()) or a directory containing the unpacked content of the component.

payload

raw vector, message to send - typically constructed by data2msg

runtime

either path to the runtime JSON file or a structure corresponding to the parsed payload of the file

init.only

logical, if TRUE then the runtime is setup but the actual server/generator is not executed.

data

data to wrap into a message - it is expected to be a list (hence a data frame qualifies)

output

name of the proto message type to use

msg

raw vector containing the message

input

name of the proto message type to use

url

string, URL to send the message to

response

logical, if TRUE then the HTTP response object is returned, otherwise only a logical denoting success or failure.

Details

run loads and runs the component by providing a service endpoint on localhost and post specified by the input_port property in the runtime object.

The component file is expected to be created by the compose function. runtime defines the run-time properties such as input port and outputs.

data2msg performs the conversion of native types to the binary message for communication with other Acumos components.

msg2data converts a Acumos message to data according to the provided schema.

Value

The return value of run is undefined since it is executed for its side-effect of providing the service and may never return.

data2msg returns a raw vector constituting the message

msg2data returns the data represented by the message

send.msg returns TRUE on success, FALSE otherwise unless response is TRUE in which case the full response object is returned.

Note

The .proto file containing the schema definitions must be loaded before data2msg() and msg2data() are used, e.g., by the virtue of being inside the run() function or explicitly using RProtoBuf::readProtoFiles(proto).

The run() function can be used only once in a session, because protobuf definitions are global and cannot be overridden without a conflict.

The internal Acumos communication protocol is subject to change and all of the above functions are hidden.

If the runtime list contains an entry data_response=TRUE then the component also returns the result in the response body (in addition to any output URL specifications). In all other cases the response is always "OK" on success and error string on error.

Author(s)

Simon Urbanek

See Also

compose


[Package acumos version 0.4-1 Index]