post https://senaps.eratos.com/api/analysis/workflows
The following example demonstrates submitting a new workflow.
Assuming a model exists 'average_rainfall' with ports ['startdate', 'enddate', 'rainfall', 'average_rainfall']
Example CreateWorkflowRequest
{
"name": "A useful name for the workflow",
"description": "A detailed description...",
"organisationid": "csiro",
"groupids": ["my_group"],
"runas": { "roles": [ "my_group_role" ] }
"graph": {
"nodes" : [
{
"id" : "average_rainfall_model",
"modelid" : "average_rainfall"
},
{
"id" : "startdate_node",
"documentid" : "existing_document_datanode_id"
},
{
"id" : "enddate_node",
"value": "2017-01-01T10:00:00.0000Z"
},
{
"id" : "rainfall_node",
"streamid" : "rainfall.stream.123"
},
{
"id" : "average_rainfall_node",
"streamid" : "sensorcloud.average.rainfall.stream.id"
}]
"connections" : [
{
"source" : { "node": "startdate_node" },
"target" : { "node": "average_rainfall_model", "port": "startdate"}
},
{
"source" : { "node": "enddate_node" },
"target" : { "node": "average_rainfall_model", "port": "enddate"}
},
{
"source" : { "node": "rainfall_node" },
"target" : { "node": "average_rainfall_model", "port": "rainfall"}
},
{
"source" : { "node": "average_rainfall_model", "port": "average_rainfall"}
"target" : { "node": "average_rainfall_node" },
}]
}
}
Explanation:
runas
: provides the authorisation context for the workflow. If omitted, the requesting user's roles will be assigned to the workflow instead.*startdate_node
: connects an existing documentdatanode
by id.enddate_node
: creates a new documentdatanode
using the provided value.rainfall_node
: connects an existing stream.average_rainfall_node
: provides a destination output node for the model.-
NOTE: if a stream
datanode
already exists with the samestreamid
, it will reuse the existingdatanode
without creating a new streamdatanode
.
-
MAP Operations:
- An operator node can be 'mapped' to apply an operator to all elements of a collection, potentially in parallel.
- To 'map' an operator node, add the 'type: map' property. For the above example:
{ "id": "average_rainfall_model", "modelid": "average_rainfall", "type": "map" }
- For more detail, see the Analysis Service tutorial document: https://senaps.eratos.com/dashboard/pdf/analysis-api-tutorial.pdf