Output data for Decision Optimization deployment jobs
When your submit a job, you can define what output data you want to use and how you collect it (as either inline or referenced data).
Inline Data
You can define how to collect your output data as inline data.
"output_data": [{
"id":"solution.csv"
}]
Referenced data
- Data assets
- You can use data assets to reference any data asset or connected data asset present in your
space and benefit from the data-connector integration capabilities. You can specify the location for the output either by using an
href
, if the asset already exists in the space, or by using a file name. The file is then created or updated. For example,
or (this example creates the asset"location": { "href": "/v2/assets/<ASSET_ID>?space_id=<SPACE_ID>" }
solution.csv
)"location": { "name": "solution.csv" }
This example defines output data references to a data asset in space.
output_data_references": [{ "type": "data_asset", "id" : "solution.csv", "connection": {}, "location": { "href": "/v2/assets/<ASSET_ID>?space_id=<SPACE_ID>" } }]
This example provides the exact name for the output data as defined in the model in theid
field. You can define a different name for the output in thename
field."output_data_references": [{ "type" : "data_asset", "id" : "solution.csv", "connection": {}, "location": { "name": "my_solution.csv" } }]
You can also use a regular expression as an identifier. For more information, see Regexp.
- Connection assets
- You can use connection assets to reference any data and then refer to the connection without
having to specify credentials each time. Referencing a secure connection without having to use
inline credentials in the payload also offers you better security. You can use the
id
to identify connections. For example,"output_data_references": [{ "type": "connection_asset", "connection": { "id" : "<CONNECTION_ID>", } "location": { <other properties depending on connection type> } }]
The
<CONNECTION_ID>
is the globally unique identifier for a connection. You can find this identifier when you have created a connection and you then edit the connection in your project. The identifier is visible in the Edit connection window's URL.For information about job definitions, see Deployment job definitions.
You can specify the parameters that are required for the connection in the
location
field.This example connects to a COS/S3 asset. The connection parameters are provided in thelocation
field."location": { "file_name" : "<FILENAME>", "bucket" : "<BUCKET_NAME>" }
This example connects to a Db2 asset. The connection parameters are provided in theThis example connects to a COS/S3 asset. The connection parameters are provided in thelocation
field."location": { "table_name" : "<TABLE_NAME>", "schema_name" : "<SCHEMA_NAME>" }
id
field."output_data_references": [{ "type": "connection_asset", "id": "diet_food.csv", "connection": { "id" : "<CONNECTION_ID>" }, "location": { "file_name" : "<FILENAME>", "bucket" : "<BUCKET_NAME>" } }]
This example shows you how to connect to a Db2 asset. The connection parameters are provided in theid
field."output_data_references": [{ "type" : "connection_asset", "id" : "solution.csv", "connection" : { "id" : "<CONNECTION_ID>" }, "location" : { "table_name" : "<TABLE_NAME>", "schema_name" : "<SCHEMA_NAME>" } }]
For more information about the interaction properties that you can use in the
location
field, see Platform connections in the main menu. On the Connections page, select Connection resources > Connection properties. Then select the Interaction properties > As a target tab for the relevant connector. You might need to create a Platform assets catalog.For more information about the different connections available for Decision Optimization, see Supported data sources in Decision Optimization.
- URL-referenced data
- You can use URL-referenced data to store data at a particular URL. This example uses the
PUT
command to place thesolution.csv
output file on the server."output_data_references": { "type": "url", "id": "solution.csv", "connection": { "verb": "PUT", "url": "https://myserver.com/diet_food.csv", "headers": { "Content-Type": "application/x-www-form-urlencoded" } }, "location": {} }
Regexp
Regexp
as an identifier for all types of outputs. For example to
collect all .csv
output files: "id":".*\\.csv"
"id":".*"
You can use a
Regexp
as an identifier, and combine it with ${oaas_job_id}
and
${oaas_attachment_name}
place holders in the name
, to avoid
overwriting the output each time the job is run."output_data_references": [{
"type" : "data_asset",
"id" : ".*",
"connection": {
"href" : "/v2/connections/<CONNECTION_ID>?space_id=><SPACE_ID>"
},
"location": {
"name" : "${oaas_job_id}_${oaas_attachment_name}"
}
}]
solution.csv
file is generated as output, this file is saved in a
folder that has the same name as the job number. "output_data_references": [{
"type" : "connection_asset",
"id" : ".*",
"connection": {
"id" : "<CONNECTION_ID>"
},
"location": {
"bucket" : "<BUCKET_NAME>",
"file_name": "${oaas_job_id}/${oaas_attachment_name}"
}
}]
You can combine different types of data in the same request. For more information about data definitions, see Adding data to an analytics project.