sasctl.services.model_publish#

Enables publishing objects such as models to various destinations.

class sasctl._services.model_publish.ModelPublish[source]#

Bases: Service

Enables publishing objects such as models to various destinations.

The service provides methods for managing publish destinations like CAS, Hadoop, Teradata, or SAS Micro Analytic Service

classmethod create_cas_destination(name, library, table, server=None, description=None)[source]#

Define a new CAS publishing destination.

Parameters:
  • name (str) – Name of the publishing destination.

  • library (str) – The CAS library in which table will be stored.

  • table (str) – Name of the CAS table in which models will be stored.

  • server (str, optional) – Name of the CAS server. Defaults to ‘cas-shared-default’.

  • description (str, optional) – Description of the publishing destination.

Returns:

RestObj

classmethod create_destination(name, type_, cas_server=None, cas_library=None, cas_table=None, description=None, mas_uri=None, hdfs_dir=None, conf_dir=None, user=None, database_library=None)[source]#

Define a new publishing destination.

Parameters:
  • name (str) – Name of the publishing destination.

  • type (str) – Choose from {'cas', 'mas', 'hadoop', 'teradata'} Type of publishing definition being created

  • cas_server (str, optional) – Name of the CAS server. Defaults to ‘cas-shared-default’. Required if type_ is ‘cas’, otherwise ignored.

  • cas_library (str, optional) – The CAS library in which cas_table will be stored. Required if type_ is ‘cas’, otherwise ignored.

  • cas_table (str, optional) – Name of the CAS table in which models will be stored. Required if type_ is ‘cas’, otherwise ignored.

  • description (str, optional) – Description of the publishing destination.

  • mas_uri (str, optional) – Required if type_ is ‘mas’, otherwise ignored.

  • hdfs_dir (str, optional) – Required if type_ is ‘hadoop’, otherwise ignored.

  • conf_dir (str, optional) – Required if type_ is ‘hadoop’, otherwise ignored.

  • user (str, optional) – Required if type_ is ‘hadoop’, otherwise ignored.

  • database_library (str, optional) – Required if type_ is ‘teradata’, otherwise ignored.

Returns:

RestObj

classmethod create_mas_destination(name, uri, description=None)[source]#

Define a new Micro Analytic Server (MAS) publishing destination.

Parameters:
  • name (str) – Name of the publishing destination.

  • uri (str) – The base URI that contains the host, the protocol, and optionally the port, which addresses the remote SAS Micro Analytic Service to use. Example: http://spam.com

  • description (str, optional) – Description of the publishing destination.

Returns:

RestObj

classmethod delete_destination(item)[source]#

Delete a destination instance.

Parameters:

item (str or dict) – Name or dictionary representation of publishing destination.

Returns:

None

classmethod get_destination(item, refresh=False)#

Return a destination instance.

Parameters:
  • item (str or dict) – Name, ID, or dictionary representation of the destination.

  • refresh (bool, optional) – Obtain an updated copy of the destination.

Returns:

RestObj or None – A dictionary containing the destination attributes or None.

Notes

If item is a complete representation of the destination it will be returned unless refresh is set. This prevents unnecessary REST calls when data is already available on the client.

classmethod list_destinations(filter=None, start=None, limit=None, **kwargs)#

List all destinations available in the environment.

Parameters:
  • filter (str, optional)

  • start (int, optional) – Zero-based index of the first item to return. Defaults to 0.

  • limit (int, optional) – The maximum number of items to return. Defaults to 20.

Returns:

list – A list of dictionaries containing the destinations.

Notes

See the filtering reference for details on the filter parameter.

classmethod list_models()[source]#
classmethod publish_model(model, destination, name=None, code=None, notes=None)[source]#

Publish a model to an existing publishing destination.

Parameters:
  • model (str or dict) – The name or id of the model, or a dictionary representation of the model.

  • destination (str or dict) – The name or id of the publishing destination, or a dictionary representation of the destination

  • name (str, optional) – Name of the published model. Defaults to the model name.

  • code (str, optional) – The code to be published.

  • notes

classmethod update_destination(item)#

Update a destination instance.

Parameters:

item (dict)

Returns:

None