decision_optimization_client.Container

class decision_optimization_client.Container
name

Name of the container

description

Description of the container

category

Category of the container, can be scenario or dashboard

lineage

If the container has been copied, name of the container that it was copied from

projectId

ID of the project the container is a part of

add_asset_data(name, data=None, category='model')

Adds or updates asset data.

Parameters
  • name – The name of the asset

  • data – A stream containing the data to upload.

  • category – The category (defaults to model)

Returns

the asset metadata as Asset

add_table_data(what, data=None, category=None)

Adds the table data to the container.

Data must be pandas.DataFrame.

Examples

Adds the data for the table with the specified name:

>>> container.add_table_data("table1", data=table1_data)

Adds the data for the tables in the dict:

>>> tables = { "table1": table1_df, "table2": table2_df }
>>> scenario.add_table_data(tables)
Parameters
  • what – what to add. Can be either a table name or a dict of {table_name: table_data}

  • data – The data if what is a table name.

copy(name)

Copies this container.

Arg:

name (Mandatory): The name of the copy.

Returns

The Container for the copy.

create_asset(name, data=None, category='model')

Creates an asset.

Returns

A Asset instance.

delete_asset(name)

Deletes the asset.

Parameters

name – The name of the asset as a string.

delete_table_data(table)

Deletes table data.

Parameters

tableTable from which you want the data to be deleted

get_asset(name)

Gets asset metadata using name.

Parameters
  • asset – An asset or asset name as a string.

  • name – An asset name.

Returns

A Asset instance.

get_asset_data(name)

Gets asset data.

Parameters

name – The name of the asset.

Returns

The asset data as a byte array.

get_assets()

Returns asset metadata for all of this container’s assets.

Returns

A dict where its keys are asset names and its values are Asset’s metadata.

get_status()

Get the solve status for this scenario

Returns

A JSON describing the solve status for that scenario

get_table_data(table)

Gets table data.

Parameters

tableTable from which you want the data

Returns

A pandas.DataFrame containing the data.

get_table_type(name)

Returns a TableType descriptor for the Table which name is specified.

Parameters

name – A table name as a string.

Returns

A TableType instance.

get_tables(category=None)

Returns all container table metadata.

Parameters

category – The category of tables. Can be input, output or None if both input and output tables are to be returned.

Returns

A dict where its keys are asset names and its values are Table.

get_tables_data(category=None)
Parameters

category – The category of tables. Can be input, output or None if both input and output tables are to be returned.

Returns

A dict of all tables. Keys are table names, values are DataFrames with table data.

solve(display_log=None, log_lines=25, log_output=None, asynchronous=False, timeout=None, **kwargs)

Solves this scenario.

If an error occurs and display_log is None or not set, this prints the last log_lines lines of log (default: 25)

If display_log is set to False, nothing is displayed.

If display_log display_log is set to True, the log are always displayed.

Parameters
  • **kwargs – extra arguments passed as SolveConfig attributes

  • display_log – If True, log is downloaded after solve and displayed. Default is False

  • log_lines – number of lines of log to print. Default is 25. If None, all log lines are displayed.

  • log_output – the file like object to write logs to. If not specified or None, defaults to sys.stdout.

  • asynchronous – If true, the solve will be done asynchronously (it won’t wait for it to finish), allowing you to do multiple solves in parallel

Returns

A JSON describing the status of the job that has been launched for this container.

update_table_type(table_type)

Updates the table type for the specified TableType.

Parameters

table_type – A TableType for the update.