ayx_python_sdk.providers.amp_provider.repositories package

Submodules

ayx_python_sdk.providers.amp_provider.repositories.dcm_repository module

Class that saves and retrieves AMP DCM information.

class ayx_python_sdk.providers.amp_provider.repositories.dcm_repository.DCMRepository(*args, **kwargs)[source]

Bases: object

Repository that stores DCM information.

class SdkEngineStub(channel)

Bases: object

Missing associated documentation comment in .proto file.

static free_write_lock(connection_id: str, role: str, secret_type: str, lock_id: str) None[source]

Frees a lock obtained from a previous call to get_write_lock().

Parameters
  • connection_id – string with UUID of connection

  • role – A role such as ?oauth?

  • secret_type – A secret type such as ?oauth_token?

  • lock_id – A lock_id acquired from a previous call to get_write_lock()

static get_connection(connection_id: str) Dict[source]

Retrieve connection information including secrets by connection ID.

Parameters

connection_id – string with UUID of connection

static get_write_lock(connection_id: str, role: str, secret_type: str, expires_in: Optional[datetime.datetime]) Dict[source]

Attempt to acquire an exclusive write lock.

Parameters
  • connection_id – string with UUID of connection

  • role – A role such as ?oauth?

  • secret_type – A secret type such as ?oauth_token?

  • expires_in – (Optional) A DateTime value in which to ask for the lock to be held for in milliseconds.

static update_connection_secret(connection_id: str, lock_id: str, role: str, secret_type: str, value: str, expires_on: Optional[datetime.datetime], parameters: Optional[Dict[str, str]]) Dict[source]

Update a single secret for role and secret_type to value as well as the optional expires_on and parameters.

Parameters
  • connection_id – A connection ID

  • lock_id – A lock ID acquired from get_write_lock()

  • role – A role such as ?oauth?

  • secret_type – A secret type such as ?oauth_token?

  • value – The new value to store for the secret

  • expires_on – (Optional) DateTime expiration of this secret

  • parameters – Dict of parameter values for this secret (this is arbitrary user data stored as JSON)

ayx_python_sdk.providers.amp_provider.repositories.environment_repository module

Class that saves and retrieves AMP environment information.

class ayx_python_sdk.providers.amp_provider.repositories.environment_repository.EnvironmentRepository(*args, **kwargs)[source]

Bases: object

Repository that stores environment information.

clear_repository() None[source]

Clear the repository.

get_alteryx_install_dir() pathlib.Path[source]

Get the directory where designer is stored.

Returns

The Alteryx install directory as a Path object.

Return type

Path

get_alteryx_locale() Locale[source]

Get the locale code from Alteryx user settings.

Returns

The language / region that Alteryx is using to display messages.

Return type

Locale

get_designer_version() str[source]

Get the version of designer that is running the tool.

Returns

A version in the format of 1.2.3.4

Return type

str

get_proxy_configuration() dict[source]
get_temp_dir() str[source]

Get the directory where designer-managed temp files are created.

Returns

The path to the directory where temporary files are stored.

Return type

str

get_tool_id() int[source]

Get the ID of the tool.

Returns

Tool’s ID (specified by developer).

Return type

int

get_update_mode() ayx_python_sdk.core.environment_base.UpdateMode[source]

Get the type of tool update running.

Returns

Enum corresponding to the type of update mode designer is running in. (Quick, Full, No Update)

Return type

UpdateMode

get_update_only() bool[source]

Check if the tool is running in update only mode.

Returns

True if workflow isn’t being run.

Return type

bool

get_workflow_dir() pathlib.Path[source]

Get the directory where the workflow is running the tool.

Returns

The workflow directory as a Path object.

Return type

Path

save_engine_constants(constants: Dict[str, str]) None[source]

Save engine constants to repo.

Parameters

constants – The dictionary of engine constants received through gRPC

save_tool_config(new_config: dict) None[source]

Update the tool’s configuration file.

Parameters

new_config – The new configuration to set for the tool.

save_update_mode(update_mode: int) None[source]

Save the passed in update mode.

Parameters

update_mode – An int that corresponds to the protobuf enumeration for the update mode that designer is running in.

ayx_python_sdk.providers.amp_provider.repositories.grpc_repository module

Repository for gRPC objects.

class ayx_python_sdk.providers.amp_provider.repositories.grpc_repository.GrpcRepository(*args, **kwargs)[source]

Bases: object

Class used to get the grpc client/server.

clear_repository() None[source]

Clear the repo.

clear_sdk_engine_client() None[source]

Clear the client.

get_sdk_engine_client() SdkEngineStub[source]

Get the client.

Returns

The SdkEngineClient to make calls with.

Return type

SdkEngineStub

get_sdk_tool_server() Server[source]

Get the server.

Returns

The SdkToolServer.

Return type

Server

get_sdk_tool_server_address() SocketAddress[source]

Get the server address.

Returns

The IP address and port that the server is listening on.

Return type

SocketAddress

save_sdk_engine_client(client: SdkEngineStub) None[source]

Save the client.

Parameters

client – gRPC SdkEngineClient that can make calls to the services defined in the SdkEngineServicer.

save_sdk_tool_server(server: Server) None[source]

Save the server.

Parameters

server – The SdkToolServer that is running on the Python process.

save_sdk_tool_server_address(address: SocketAddress) None[source]

Save the server address.

Parameters

address – The IP address and port that the server is listening on.

ayx_python_sdk.providers.amp_provider.repositories.input_anchor_repository module

Class that implements the Input Anchor repository singleton.

class ayx_python_sdk.providers.amp_provider.repositories.input_anchor_repository.InputAnchorRepository(*args, **kwargs)[source]

Bases: object

Class defines methods and properties to read/write/delete input anchors.

clear_repository() None[source]

Delete all data in the repository.

delete_anchor(anchor_name: str) None[source]

Delete InputAnchor object associated with the anchor name.

Parameters

anchor_name – The name of the anchor to delete from the repository.

get_anchor(anchor_name: str) AMPInputAnchor[source]

Retrieve InputAnchor object associated with the anchor name.

Parameters

anchor_name – The name of the anchor to fetch from the repository.

Return type

The input anchor object with corresponding name.

save_anchor(anchor: AMPInputAnchor) None[source]

Save AMP input anchor to repository.

Parameters

anchor – The AMPInputAnchor to be saved.

save_grpc_anchor(input_anchor: ProtobufInputAnchor) None[source]

Convert an Input Anchor from Protobuf to AMP and saves it to the repository.

Parameters

input_anchor – The protobuf representation of an input anchor to be saved.

ayx_python_sdk.providers.amp_provider.repositories.input_connection_repository module

Class that saves input connection information given the associated anchor.

class ayx_python_sdk.providers.amp_provider.repositories.input_connection_repository.InputConnectionRepository(*args, **kwargs)[source]

Bases: object

Repository that stores input connection information.

clear_repository() None[source]

Delete all data in the repository.

delete_connection(anchor_name: str, connection_name: str) None[source]

Delete the connection associated with the given anchor name and connection name.

Parameters
  • anchor_name – The name of the anchor that the connection is associated with.

  • connection_name – The name of the input connection to delete.

get_all_connections(anchor_name: str) List[AMPInputConnection][source]

Get the connections associated with the given anchor name.

get_connection(anchor_name: str, connection_name: str) AMPInputConnection[source]

Get the connection associated with the given anchor name and connection name.

Parameters
  • anchor_name – The name of the anchor that the connection is associated with.

  • connection_name – The name of the input connection to retrieve.

get_connection_packet_size(anchor_name: str, connection_name: str) Optional[int][source]

Retrieve packet size associated with a given input connection/anchor name.

Parameters
  • anchor_name – The name of the anchor that the connection is associated with.

  • connection_name – The name of the input connection to get the status of.

Returns

The max packet size on the conenction, if set, otherwise None.

Return type

int, optional

get_connection_status(anchor_name: str, connection_name: str) ayx_python_sdk.core.input_connection_base.InputConnectionStatus[source]

Retrieve input connection status associated with a given input connection/anchor name.

Parameters
  • anchor_name – The name of the anchor that the connection is associated with.

  • connection_name – The name of the input connection to get the status of.

Returns

Enumeration value (1,2,3, or 4) that corresponds to the status of this connection. (Created, Initialized, Receiving records, Closed)

Return type

InputConnectionStatus

save_connection(anchor_name: str, connection: AMPInputConnection) None[source]

Save input connection information for the assoiciated anchor name.

Parameters
  • anchor_name – The name of the input anchor object that the connection is associated with.

  • connection – The AMPInputConnection object itself, to be saved to the repository.

save_connection_packet_size(anchor_name: str, connection_name: str, size: Optional[int]) None[source]

Save packet size associated with a given input connection/anchor name.

Parameters
  • anchor_name – The name of the anchor that the connection is associated with.

  • connection_name – The name of the input connection.

  • size – The max number of packets allowed.

save_connection_status(anchor_name: str, connection_name: str, status: ayx_python_sdk.core.input_connection_base.InputConnectionStatus) None[source]

Save input connection status associated with a given input connection/anchor name.

Parameters
  • anchor_name – The name of the anchor that the connection is associated with.

  • connection_name – The name of the input connection to set the status of.

  • status – Enumeration value (1,2,3, or 4) that corresponds to the status of this connection. (Created, Initialized, Receiving records, Closed)

save_grpc_connection(anchor: AMPInputAnchor, connection: ProtobufInputConnection) None[source]

Save input connection object given a protobuf object.

Parameters
  • anchor – The input anchor object that the connection is associated with.

  • connection – The protobuf representation of the input connection, to be serialized into AMP and saved to the repository.

ayx_python_sdk.providers.amp_provider.repositories.input_metadata_repository module

Class that saves input metadata information given the associated anchor name and connection name.

class ayx_python_sdk.providers.amp_provider.repositories.input_metadata_repository.InputMetadataRepository(*args, **kwargs)[source]

Bases: object

Repository that stores input metadata information.

clear_repository() None[source]

Delete all data in the repository.

delete_metadata(anchor_name: str, connection_name: str) None[source]

Delete the input metadata associated with the given anchor name and connection name.

Parameters
  • anchor_name – The name of the input anchor that the metadata is associated with.

  • connection_name – The name of the input connection that the metadata is associated with.

get_metadata(anchor_name: str, connection_name: str) CoreMetadata[source]

Get the input metadata associated with the given anchor name and connection name.

Parameters
  • anchor_name – The name of the input anchor that the metadata is associated with.

  • connection_name – The name of the input connection that the metadata is associated with.

Returns

The metadata information for the anchor and connection.

Return type

CoreMetadata

save_grpc_metadata(anchor_name: str, connection_name: str, metadata: ProtobufMetadata) None[source]

Save input metadata information for the associated anchor name and connection name given a Protobuf metadata message.

Parameters
  • anchor_name – The name of the input anchor that the metadata is associated with.

  • connection_name – The name of the input connection that the metadata is associated with.

  • metadata – The protobuf metadata information for the anchor and connection.

save_metadata(anchor_name: str, connection_name: str, metadata: CoreMetadata) None[source]

Save input metadata information for the associated anchor name and connection name.

Parameters
  • anchor_name – The name of the input anchor that the metadata is associated with.

  • connection_name – The name of the input connection that the metadata is associated with.

  • metadata – The metadata information for the anchor and connection.

ayx_python_sdk.providers.amp_provider.repositories.input_record_packet_repository module

Class that saves/retrieves input record packets.

exception ayx_python_sdk.providers.amp_provider.repositories.input_record_packet_repository.EmptyRecordPacketRepositoryException[source]

Bases: Exception

Exception to be raised after the final record packet has been returned.

class ayx_python_sdk.providers.amp_provider.repositories.input_record_packet_repository.InputRecordPacketRepository(*args, **kwargs)[source]

Bases: object

Repository that stores input record packets.

clear_repository() None[source]

Delete all data in the repository.

peek_record_packet(anchor_name: str, connection_name: str) RecordPacketBase[source]

Get the next record packet without popping from the queue.

Parameters
  • anchor_name – The name of the input anchor that the metadata is associated with.

  • connection_name – The name of the input connection that the metadata is associated with.

Returns

The AMPRecordPacket at the front of the internal queue.

Return type

RecordPacketBase

pop_record_packet(anchor_name: str, connection_name: str) RecordPacketBase[source]

Retrieve record packet if there are enough records to meet the max packet size criteria.

Parameters
  • anchor_name – The name of the input anchor that the metadata is associated with.

  • connection_name – The name of the input connection that the metadata is associated with.

Returns

The AMPRecordPacket that was popped off the internal queue.

Return type

RecordPacketBase

push_record_packet(anchor_name: str, connection_name: str, record_packet: RecordPacketBase) None[source]

Save a record packet.

save_grpc_record_packet(anchor_name: str, connection_name: str, grpc_record_packet: ProtobufRecordPacket, metadata: Metadata) None[source]

Save a record packet from its protobuffer format.

exception ayx_python_sdk.providers.amp_provider.repositories.input_record_packet_repository.UnfinishedRecordPacketException[source]

Bases: Exception

Exception to be raised to indicate that a record packet isn’t ready to be returned.

ayx_python_sdk.providers.amp_provider.repositories.io_repository module

Class that saves and retrieves AMP IO information.

class ayx_python_sdk.providers.amp_provider.repositories.io_repository.IORepository(*args, **kwargs)[source]

Bases: object

Repository that stores IO information.

static decrypt_password(password: str) str[source]

Decrypt password.

Parameters

password – The password to decrypt.

Returns

The decrypted password.

Return type

str

static get_temp_file(extension: str = 'tmp') pathlib.Path[source]

Create a temporary file managed by Designer.

Parameters

extension – The file extension of the temp file.

Returns

The path to where the temp file is.

Return type

Path

static get_translate_msg(msg: str, *args: Any) str[source]

Translate a message to the current locale.

Parameters
  • msg – Message to translate.

  • *args – Interpolation data for the string.

Returns

The message, translated into the locale.

Return type

str

static save_error(error_msg: str) None[source]

Display an error message in the Results window.

Parameters

error_msg – The error message to be output.

static save_info(info_msg: str) None[source]

Display an info message in the Results window.

Parameters

info_msg – The info message to be output.

static save_warn(warn_msg: str) None[source]

Display a warning message in the Results window.

Parameters

warn_msg – The warning message to be output.

static update_progress(percent: float) None[source]

Update tool progress.

Parameters

percent – The progress (how close the connection is to processing all records) as a percentage.

ayx_python_sdk.providers.amp_provider.repositories.output_anchor_repository module

Repository for output anchor GRPC.

class ayx_python_sdk.providers.amp_provider.repositories.output_anchor_repository.OutputAnchorRepository(*args, **kwargs)[source]

Bases: object

Repository class, output anchors.

clear_repository() None[source]

Delete all data in the repository.

delete_anchor(anchor_name: str) None[source]

Remove an AMPOutputAnchor object from the repository if it’s already been saved.

Parameters

anchor_name – The name of the output anchor to delete from the repository.

get_all_anchor_names() List[str][source]

Pull a list of all anchor names in the repository.

Returns

List of all anchor names that exist in the repository.

Return type

List[str]

get_anchor(anchor_name: str) CoreOutputAnchor[source]

Retrieve an AMPOutputAnchor object from the repository if it’s already been saved.

Parameters

anchor_name – The name of the output anchor to get from the repository.

Returns

The retrieved output anchor that corresponds to the anchor name.

Return type

CoreOutputAnchor

save_anchor(anchor: CoreOutputAnchor) None[source]

Save an AMPOutputAnchor object to the repository.

Parameters

anchor – The AMP output anchor to save to the repository.

save_grpc_anchor(anchor: GrpcOutputAnchor) None[source]

Save a protobuf Output Anchor to the repository.

Parameters

anchor – The grpc representation of the output anchor.

ayx_python_sdk.providers.amp_provider.repositories.output_metadata_repository module

Class that saves output metadata information given the associated anchor name.

class ayx_python_sdk.providers.amp_provider.repositories.output_metadata_repository.OutputMetadataRepository(*args, **kwargs)[source]

Bases: object

Repository that stores output metadata information.

clear_repository() None[source]

Delete all data in the repository.

delete_metadata(anchor_name: str) None[source]

Delete the output metadata associated with the given anchor name.

Parameters

anchor_name – The name of the anchor to delete.

get_grpc_metadata(anchor_name: str) ProtobufMetadata[source]

Get the output Protobuf metadata message associated with the given anchor name.

Parameters

anchor_name – The name of the anchor.

Returns

The metadata of the record packets that will be associated with this anchor as a protobuf object.

Return type

ProtobufMetadata

get_metadata(anchor_name: str) CoreMetadata[source]

Get the output metadata associated with the given anchor name.

Parameters

anchor_name – The name of the anchor.

Returns

Retrieves the metadata that is associatd with the specified anchor.

Return type

CoreMetadata

save_metadata(anchor_name: str, metadata: CoreMetadata) None[source]

Save output metadata information for the associated anchor name.

Parameters
  • anchor_name – The name of the anchor.

  • metadata – The metadata of the record packets that will be associated with this anchor.

ayx_python_sdk.providers.amp_provider.repositories.output_record_packet_repository module

Class that saves/retrieves output record packets.

class ayx_python_sdk.providers.amp_provider.repositories.output_record_packet_repository.OutputRecordPacketRepository(*args, **kwargs)[source]

Bases: object

Repository that stores output record packets.

clear_repository() None[source]

Delete all data in the repository.

get_anchor_progress(anchor_name: str) float[source]

Get the anchor progress.

Parameters

anchor_name – The name of the anchor to delete.

Returns

The progress percentage of the anchor.

Return type

progress

get_grpc_record_packets(anchor_name: str) List[record_packet_pb2.RecordPacket][source]

Get a record packet in protobuf format.

Parameters

anchor_name – The name of the anchor to delete.

Returns

The list of protobuf record packets that are associated with the passed in anchor name.

Return type

List[ProtobufRecordPacket]

get_record_packet(anchor_name: str) RecordPacketBase[source]

Get a record packet.

Parameters

anchor_name – The name of the output anchor that the record packet is associated with.

Returns

The record packet associated with the anchor name.

Return type

RecordPacketBase

save_anchor_progress(anchor_name: str, progress: float) None[source]

Save the anchor progress.

Parameters
  • anchor_name – The name of the anchor to delete.

  • progress – The progress percentage of the anchor.

save_record_packet(anchor_name: str, record_packet: RecordPacketBase) None[source]

Save a record packet.

Parameters
  • anchor_name – The name of the anchor that the record packet is associated with.

  • record_packet – The record packet to save to the repository.

ayx_python_sdk.providers.amp_provider.repositories.plugin_class_repository module

Class that saves plugin class.

class ayx_python_sdk.providers.amp_provider.repositories.plugin_class_repository.PluginClassRepository(*args, **kwargs)[source]

Bases: object

Repository that stores plugin class.

clear_repository() None[source]

Delete all data in the repository.

get_plugin_class() Type[ayx_python_sdk.core.plugin.Plugin][source]

Get the plugin class.

Returns

The custom Plugin class that’s being used.

Return type

Type[Plugin]

save_plugin_class(plugin_class: Type[ayx_python_sdk.core.plugin.Plugin]) None[source]

Save plugin class.

Parameters

plugin_class – The custom Plugin class that’s being used.

ayx_python_sdk.providers.amp_provider.repositories.singleton module

Singleton metaclass.

class ayx_python_sdk.providers.amp_provider.repositories.singleton.Singleton[source]

Bases: type

Implements the Singleton Design Pattern using metaclasses.

References

[1] Mastering Python Design Patterns, Singleton.

ayx_python_sdk.providers.amp_provider.repositories.test_harness_state_repository module

Repository for the status of the handshake with the SDK engine server.

class ayx_python_sdk.providers.amp_provider.repositories.test_harness_state_repository.TestHarnessStateRepository(*args, **kwargs)[source]

Bases: object

Class defines methods and properties to read/write/delete the handshake status.

NOTE: This class is only used by the test harness and shouldn’t be used by the SDK Tool Service.

get_handshake_completed_status() bool[source]

Save AMP input anchor to repository.

Returns

True if handshake completed, False otherwise.

Return type

bool

get_metadata(anchor_name: str) CoreMetadata[source]

Get metadata on the anchor.

Parameters

anchor_name – The anchor to get the metadata of.

Returns

The metadata on the anchor that matches the passed in anchor name.

Return type

CoreMetadata

get_record_packet(anchor_name: str) ayx_python_sdk.providers.amp_provider.amp_record_packet.AMPRecordPacket[source]

Get record packet from repository.

Parameters

anchor_name – The name of the anchor that the record packet is associated with.

Returns

The record packet to save to the repository.

Return type

record_packet

get_sdk_tool_server_address() SocketAddress[source]

Get the SDK Tool server address.

Returns

The IP address and port that the server is listening on.

Return type

SocketAddress

save_handshake_completed_status(status: bool) None[source]

Save handshake completed status.

Parameters

status – Handshake completion status.

save_metadata(anchor_name: str, metadata: ProtobufMetadata) None[source]

Saves metadata of the data coming in.

Parameters
  • anchor_name – The anchor that the metadata is associated with.

  • metadata – The metadata of the data that will be going through this anchor.

save_record_packet(anchor_name: str, record_packet: ProtobufRecordPacket) None[source]

Save record packet to this repository.

Parameters
  • anchor_name – The name of the anchor that the record packet is associated with.

  • record_packet – The record packet to save to the repository.

save_sdk_tool_server_address(address: SocketAddress) None[source]

Save the SDK Tool server address.

Parameters

address – The IP address and port that the server is listening on.

ayx_python_sdk.providers.amp_provider.repositories.tool_config_repository module

Class that saves tool configuration information.

class ayx_python_sdk.providers.amp_provider.repositories.tool_config_repository.ToolConfigRepository(*args, **kwargs)[source]

Bases: object

Repository that stores tool configuration information.

clear_repository() None[source]

Delete all data in the repository.

get_tool_config() Dict[str, Any][source]

Get the tool configuration.

Returns

The Tool Config XML associated with the current plugin.

Return type

Dict[str, Any]

save_tool_config(tool_config: Dict[str, Any]) None[source]

Save tool configuration dictionary.

Parameters

tool_config – Dictionary form of the Tool Config XML.

save_xml_tool_config(tool_config_xml: str) None[source]

Save the tool configuration xml as a dictionary.

Parameters

tool_config_xml – The Tool Config XML as a raw string.

Module contents

Repository classes that store information coming from the out of process manager.

class ayx_python_sdk.providers.amp_provider.repositories.DCMRepository(*args, **kwargs)[source]

Bases: object

Repository that stores DCM information.

class SdkEngineStub(channel)

Bases: object

Missing associated documentation comment in .proto file.

static free_write_lock(connection_id: str, role: str, secret_type: str, lock_id: str) None[source]

Frees a lock obtained from a previous call to get_write_lock().

Parameters
  • connection_id – string with UUID of connection

  • role – A role such as ?oauth?

  • secret_type – A secret type such as ?oauth_token?

  • lock_id – A lock_id acquired from a previous call to get_write_lock()

static get_connection(connection_id: str) Dict[source]

Retrieve connection information including secrets by connection ID.

Parameters

connection_id – string with UUID of connection

static get_write_lock(connection_id: str, role: str, secret_type: str, expires_in: Optional[datetime.datetime]) Dict[source]

Attempt to acquire an exclusive write lock.

Parameters
  • connection_id – string with UUID of connection

  • role – A role such as ?oauth?

  • secret_type – A secret type such as ?oauth_token?

  • expires_in – (Optional) A DateTime value in which to ask for the lock to be held for in milliseconds.

static update_connection_secret(connection_id: str, lock_id: str, role: str, secret_type: str, value: str, expires_on: Optional[datetime.datetime], parameters: Optional[Dict[str, str]]) Dict[source]

Update a single secret for role and secret_type to value as well as the optional expires_on and parameters.

Parameters
  • connection_id – A connection ID

  • lock_id – A lock ID acquired from get_write_lock()

  • role – A role such as ?oauth?

  • secret_type – A secret type such as ?oauth_token?

  • value – The new value to store for the secret

  • expires_on – (Optional) DateTime expiration of this secret

  • parameters – Dict of parameter values for this secret (this is arbitrary user data stored as JSON)

class ayx_python_sdk.providers.amp_provider.repositories.EnvironmentRepository(*args, **kwargs)[source]

Bases: object

Repository that stores environment information.

clear_repository() None[source]

Clear the repository.

get_alteryx_install_dir() pathlib.Path[source]

Get the directory where designer is stored.

Returns

The Alteryx install directory as a Path object.

Return type

Path

get_alteryx_locale() Locale[source]

Get the locale code from Alteryx user settings.

Returns

The language / region that Alteryx is using to display messages.

Return type

Locale

get_designer_version() str[source]

Get the version of designer that is running the tool.

Returns

A version in the format of 1.2.3.4

Return type

str

get_proxy_configuration() dict[source]
get_temp_dir() str[source]

Get the directory where designer-managed temp files are created.

Returns

The path to the directory where temporary files are stored.

Return type

str

get_tool_id() int[source]

Get the ID of the tool.

Returns

Tool’s ID (specified by developer).

Return type

int

get_update_mode() ayx_python_sdk.core.environment_base.UpdateMode[source]

Get the type of tool update running.

Returns

Enum corresponding to the type of update mode designer is running in. (Quick, Full, No Update)

Return type

UpdateMode

get_update_only() bool[source]

Check if the tool is running in update only mode.

Returns

True if workflow isn’t being run.

Return type

bool

get_workflow_dir() pathlib.Path[source]

Get the directory where the workflow is running the tool.

Returns

The workflow directory as a Path object.

Return type

Path

save_engine_constants(constants: Dict[str, str]) None[source]

Save engine constants to repo.

Parameters

constants – The dictionary of engine constants received through gRPC

save_tool_config(new_config: dict) None[source]

Update the tool’s configuration file.

Parameters

new_config – The new configuration to set for the tool.

save_update_mode(update_mode: int) None[source]

Save the passed in update mode.

Parameters

update_mode – An int that corresponds to the protobuf enumeration for the update mode that designer is running in.

class ayx_python_sdk.providers.amp_provider.repositories.GrpcRepository(*args, **kwargs)[source]

Bases: object

Class used to get the grpc client/server.

clear_repository() None[source]

Clear the repo.

clear_sdk_engine_client() None[source]

Clear the client.

get_sdk_engine_client() SdkEngineStub[source]

Get the client.

Returns

The SdkEngineClient to make calls with.

Return type

SdkEngineStub

get_sdk_tool_server() Server[source]

Get the server.

Returns

The SdkToolServer.

Return type

Server

get_sdk_tool_server_address() SocketAddress[source]

Get the server address.

Returns

The IP address and port that the server is listening on.

Return type

SocketAddress

save_sdk_engine_client(client: SdkEngineStub) None[source]

Save the client.

Parameters

client – gRPC SdkEngineClient that can make calls to the services defined in the SdkEngineServicer.

save_sdk_tool_server(server: Server) None[source]

Save the server.

Parameters

server – The SdkToolServer that is running on the Python process.

save_sdk_tool_server_address(address: SocketAddress) None[source]

Save the server address.

Parameters

address – The IP address and port that the server is listening on.

class ayx_python_sdk.providers.amp_provider.repositories.IORepository(*args, **kwargs)[source]

Bases: object

Repository that stores IO information.

static decrypt_password(password: str) str[source]

Decrypt password.

Parameters

password – The password to decrypt.

Returns

The decrypted password.

Return type

str

static get_temp_file(extension: str = 'tmp') pathlib.Path[source]

Create a temporary file managed by Designer.

Parameters

extension – The file extension of the temp file.

Returns

The path to where the temp file is.

Return type

Path

static get_translate_msg(msg: str, *args: Any) str[source]

Translate a message to the current locale.

Parameters
  • msg – Message to translate.

  • *args – Interpolation data for the string.

Returns

The message, translated into the locale.

Return type

str

static save_error(error_msg: str) None[source]

Display an error message in the Results window.

Parameters

error_msg – The error message to be output.

static save_info(info_msg: str) None[source]

Display an info message in the Results window.

Parameters

info_msg – The info message to be output.

static save_warn(warn_msg: str) None[source]

Display a warning message in the Results window.

Parameters

warn_msg – The warning message to be output.

static update_progress(percent: float) None[source]

Update tool progress.

Parameters

percent – The progress (how close the connection is to processing all records) as a percentage.

class ayx_python_sdk.providers.amp_provider.repositories.InputAnchorRepository(*args, **kwargs)[source]

Bases: object

Class defines methods and properties to read/write/delete input anchors.

clear_repository() None[source]

Delete all data in the repository.

delete_anchor(anchor_name: str) None[source]

Delete InputAnchor object associated with the anchor name.

Parameters

anchor_name – The name of the anchor to delete from the repository.

get_anchor(anchor_name: str) AMPInputAnchor[source]

Retrieve InputAnchor object associated with the anchor name.

Parameters

anchor_name – The name of the anchor to fetch from the repository.

Return type

The input anchor object with corresponding name.

save_anchor(anchor: AMPInputAnchor) None[source]

Save AMP input anchor to repository.

Parameters

anchor – The AMPInputAnchor to be saved.

save_grpc_anchor(input_anchor: ProtobufInputAnchor) None[source]

Convert an Input Anchor from Protobuf to AMP and saves it to the repository.

Parameters

input_anchor – The protobuf representation of an input anchor to be saved.

class ayx_python_sdk.providers.amp_provider.repositories.InputConnectionRepository(*args, **kwargs)[source]

Bases: object

Repository that stores input connection information.

clear_repository() None[source]

Delete all data in the repository.

delete_connection(anchor_name: str, connection_name: str) None[source]

Delete the connection associated with the given anchor name and connection name.

Parameters
  • anchor_name – The name of the anchor that the connection is associated with.

  • connection_name – The name of the input connection to delete.

get_all_connections(anchor_name: str) List[AMPInputConnection][source]

Get the connections associated with the given anchor name.

get_connection(anchor_name: str, connection_name: str) AMPInputConnection[source]

Get the connection associated with the given anchor name and connection name.

Parameters
  • anchor_name – The name of the anchor that the connection is associated with.

  • connection_name – The name of the input connection to retrieve.

get_connection_packet_size(anchor_name: str, connection_name: str) Optional[int][source]

Retrieve packet size associated with a given input connection/anchor name.

Parameters
  • anchor_name – The name of the anchor that the connection is associated with.

  • connection_name – The name of the input connection to get the status of.

Returns

The max packet size on the conenction, if set, otherwise None.

Return type

int, optional

get_connection_status(anchor_name: str, connection_name: str) ayx_python_sdk.core.input_connection_base.InputConnectionStatus[source]

Retrieve input connection status associated with a given input connection/anchor name.

Parameters
  • anchor_name – The name of the anchor that the connection is associated with.

  • connection_name – The name of the input connection to get the status of.

Returns

Enumeration value (1,2,3, or 4) that corresponds to the status of this connection. (Created, Initialized, Receiving records, Closed)

Return type

InputConnectionStatus

save_connection(anchor_name: str, connection: AMPInputConnection) None[source]

Save input connection information for the assoiciated anchor name.

Parameters
  • anchor_name – The name of the input anchor object that the connection is associated with.

  • connection – The AMPInputConnection object itself, to be saved to the repository.

save_connection_packet_size(anchor_name: str, connection_name: str, size: Optional[int]) None[source]

Save packet size associated with a given input connection/anchor name.

Parameters
  • anchor_name – The name of the anchor that the connection is associated with.

  • connection_name – The name of the input connection.

  • size – The max number of packets allowed.

save_connection_status(anchor_name: str, connection_name: str, status: ayx_python_sdk.core.input_connection_base.InputConnectionStatus) None[source]

Save input connection status associated with a given input connection/anchor name.

Parameters
  • anchor_name – The name of the anchor that the connection is associated with.

  • connection_name – The name of the input connection to set the status of.

  • status – Enumeration value (1,2,3, or 4) that corresponds to the status of this connection. (Created, Initialized, Receiving records, Closed)

save_grpc_connection(anchor: AMPInputAnchor, connection: ProtobufInputConnection) None[source]

Save input connection object given a protobuf object.

Parameters
  • anchor – The input anchor object that the connection is associated with.

  • connection – The protobuf representation of the input connection, to be serialized into AMP and saved to the repository.

class ayx_python_sdk.providers.amp_provider.repositories.InputMetadataRepository(*args, **kwargs)[source]

Bases: object

Repository that stores input metadata information.

clear_repository() None[source]

Delete all data in the repository.

delete_metadata(anchor_name: str, connection_name: str) None[source]

Delete the input metadata associated with the given anchor name and connection name.

Parameters
  • anchor_name – The name of the input anchor that the metadata is associated with.

  • connection_name – The name of the input connection that the metadata is associated with.

get_metadata(anchor_name: str, connection_name: str) CoreMetadata[source]

Get the input metadata associated with the given anchor name and connection name.

Parameters
  • anchor_name – The name of the input anchor that the metadata is associated with.

  • connection_name – The name of the input connection that the metadata is associated with.

Returns

The metadata information for the anchor and connection.

Return type

CoreMetadata

save_grpc_metadata(anchor_name: str, connection_name: str, metadata: ProtobufMetadata) None[source]

Save input metadata information for the associated anchor name and connection name given a Protobuf metadata message.

Parameters
  • anchor_name – The name of the input anchor that the metadata is associated with.

  • connection_name – The name of the input connection that the metadata is associated with.

  • metadata – The protobuf metadata information for the anchor and connection.

save_metadata(anchor_name: str, connection_name: str, metadata: CoreMetadata) None[source]

Save input metadata information for the associated anchor name and connection name.

Parameters
  • anchor_name – The name of the input anchor that the metadata is associated with.

  • connection_name – The name of the input connection that the metadata is associated with.

  • metadata – The metadata information for the anchor and connection.

class ayx_python_sdk.providers.amp_provider.repositories.InputRecordPacketRepository(*args, **kwargs)[source]

Bases: object

Repository that stores input record packets.

clear_repository() None[source]

Delete all data in the repository.

peek_record_packet(anchor_name: str, connection_name: str) RecordPacketBase[source]

Get the next record packet without popping from the queue.

Parameters
  • anchor_name – The name of the input anchor that the metadata is associated with.

  • connection_name – The name of the input connection that the metadata is associated with.

Returns

The AMPRecordPacket at the front of the internal queue.

Return type

RecordPacketBase

pop_record_packet(anchor_name: str, connection_name: str) RecordPacketBase[source]

Retrieve record packet if there are enough records to meet the max packet size criteria.

Parameters
  • anchor_name – The name of the input anchor that the metadata is associated with.

  • connection_name – The name of the input connection that the metadata is associated with.

Returns

The AMPRecordPacket that was popped off the internal queue.

Return type

RecordPacketBase

push_record_packet(anchor_name: str, connection_name: str, record_packet: RecordPacketBase) None[source]

Save a record packet.

save_grpc_record_packet(anchor_name: str, connection_name: str, grpc_record_packet: ProtobufRecordPacket, metadata: Metadata) None[source]

Save a record packet from its protobuffer format.

class ayx_python_sdk.providers.amp_provider.repositories.OutputAnchorRepository(*args, **kwargs)[source]

Bases: object

Repository class, output anchors.

clear_repository() None[source]

Delete all data in the repository.

delete_anchor(anchor_name: str) None[source]

Remove an AMPOutputAnchor object from the repository if it’s already been saved.

Parameters

anchor_name – The name of the output anchor to delete from the repository.

get_all_anchor_names() List[str][source]

Pull a list of all anchor names in the repository.

Returns

List of all anchor names that exist in the repository.

Return type

List[str]

get_anchor(anchor_name: str) CoreOutputAnchor[source]

Retrieve an AMPOutputAnchor object from the repository if it’s already been saved.

Parameters

anchor_name – The name of the output anchor to get from the repository.

Returns

The retrieved output anchor that corresponds to the anchor name.

Return type

CoreOutputAnchor

save_anchor(anchor: CoreOutputAnchor) None[source]

Save an AMPOutputAnchor object to the repository.

Parameters

anchor – The AMP output anchor to save to the repository.

save_grpc_anchor(anchor: GrpcOutputAnchor) None[source]

Save a protobuf Output Anchor to the repository.

Parameters

anchor – The grpc representation of the output anchor.

class ayx_python_sdk.providers.amp_provider.repositories.OutputMetadataRepository(*args, **kwargs)[source]

Bases: object

Repository that stores output metadata information.

clear_repository() None[source]

Delete all data in the repository.

delete_metadata(anchor_name: str) None[source]

Delete the output metadata associated with the given anchor name.

Parameters

anchor_name – The name of the anchor to delete.

get_grpc_metadata(anchor_name: str) ProtobufMetadata[source]

Get the output Protobuf metadata message associated with the given anchor name.

Parameters

anchor_name – The name of the anchor.

Returns

The metadata of the record packets that will be associated with this anchor as a protobuf object.

Return type

ProtobufMetadata

get_metadata(anchor_name: str) CoreMetadata[source]

Get the output metadata associated with the given anchor name.

Parameters

anchor_name – The name of the anchor.

Returns

Retrieves the metadata that is associatd with the specified anchor.

Return type

CoreMetadata

save_metadata(anchor_name: str, metadata: CoreMetadata) None[source]

Save output metadata information for the associated anchor name.

Parameters
  • anchor_name – The name of the anchor.

  • metadata – The metadata of the record packets that will be associated with this anchor.

class ayx_python_sdk.providers.amp_provider.repositories.OutputRecordPacketRepository(*args, **kwargs)[source]

Bases: object

Repository that stores output record packets.

clear_repository() None[source]

Delete all data in the repository.

get_anchor_progress(anchor_name: str) float[source]

Get the anchor progress.

Parameters

anchor_name – The name of the anchor to delete.

Returns

The progress percentage of the anchor.

Return type

progress

get_grpc_record_packets(anchor_name: str) List[record_packet_pb2.RecordPacket][source]

Get a record packet in protobuf format.

Parameters

anchor_name – The name of the anchor to delete.

Returns

The list of protobuf record packets that are associated with the passed in anchor name.

Return type

List[ProtobufRecordPacket]

get_record_packet(anchor_name: str) RecordPacketBase[source]

Get a record packet.

Parameters

anchor_name – The name of the output anchor that the record packet is associated with.

Returns

The record packet associated with the anchor name.

Return type

RecordPacketBase

save_anchor_progress(anchor_name: str, progress: float) None[source]

Save the anchor progress.

Parameters
  • anchor_name – The name of the anchor to delete.

  • progress – The progress percentage of the anchor.

save_record_packet(anchor_name: str, record_packet: RecordPacketBase) None[source]

Save a record packet.

Parameters
  • anchor_name – The name of the anchor that the record packet is associated with.

  • record_packet – The record packet to save to the repository.

class ayx_python_sdk.providers.amp_provider.repositories.PluginClassRepository(*args, **kwargs)[source]

Bases: object

Repository that stores plugin class.

clear_repository() None[source]

Delete all data in the repository.

get_plugin_class() Type[ayx_python_sdk.core.plugin.Plugin][source]

Get the plugin class.

Returns

The custom Plugin class that’s being used.

Return type

Type[Plugin]

save_plugin_class(plugin_class: Type[ayx_python_sdk.core.plugin.Plugin]) None[source]

Save plugin class.

Parameters

plugin_class – The custom Plugin class that’s being used.

class ayx_python_sdk.providers.amp_provider.repositories.Singleton[source]

Bases: type

Implements the Singleton Design Pattern using metaclasses.

References

[1] Mastering Python Design Patterns, Singleton.

class ayx_python_sdk.providers.amp_provider.repositories.ToolConfigRepository(*args, **kwargs)[source]

Bases: object

Repository that stores tool configuration information.

clear_repository() None[source]

Delete all data in the repository.

get_tool_config() Dict[str, Any][source]

Get the tool configuration.

Returns

The Tool Config XML associated with the current plugin.

Return type

Dict[str, Any]

save_tool_config(tool_config: Dict[str, Any]) None[source]

Save tool configuration dictionary.

Parameters

tool_config – Dictionary form of the Tool Config XML.

save_xml_tool_config(tool_config_xml: str) None[source]

Save the tool configuration xml as a dictionary.

Parameters

tool_config_xml – The Tool Config XML as a raw string.

ayx_python_sdk.providers.amp_provider.repositories.clear_repositories(exclude: Optional[Iterable] = None) None[source]

Clear all repositories.