Skip to main content

AsyncConnector

This is the base class for all async connectors, and it defines the interface that all connectors must implement. The connector service is responsible for invoking connectors. The executor will communicate with the connector service to create tasks, get the status of tasks, and delete tasks.

Attributes

AttributeTypeDescription
namestring = "Async Connector"Human-readable identifier for the connector used for logging and identification purposes.
task_type_namestringThe unique string identifier for the specific task type this connector is responsible for handling.
task_type_versioninteger = 0The version number of the task type, used by the Connector Service to look up the correct connector implementation.
metadata_type[ResourceMeta](resourcemeta.md?sid=flyte_connectors__connector_resourcemeta)The specific ResourceMeta class type used to store and retrieve stateful information about the external task.

Methods


create()

@classmethod
def create(
task_template: tasks_pb2.TaskTemplate,
output_prefix: str,
inputs: Optional[Dict[str, typing.Any]] = None,
task_execution_metadata: Optional[TaskExecutionMetadata] = None
) - > [ResourceMeta](resourcemeta.md?sid=flyte_connectors__connector_resourcemeta)

Return a resource meta that can be used to get the status of the task.

Parameters

NameTypeDescription
task_templatetasks_pb2.TaskTemplateThe protobuf definition containing the configuration and requirements for the task to be executed
output_prefixstrThe storage location prefix where task execution results and artifacts should be persisted
inputsOptional[Dict[str, typing.Any]] = NoneA dictionary of input parameters and values required for the task execution
task_execution_metadataOptional[TaskExecutionMetadata] = NoneContextual metadata about the current execution environment and workflow identity

Returns

TypeDescription
[ResourceMeta](resourcemeta.md?sid=flyte_connectors__connector_resourcemeta)The metadata object containing unique identifiers and state information for the newly created external resource

get()

@classmethod
def get(
resource_meta: [ResourceMeta](resourcemeta.md?sid=flyte_connectors__connector_resourcemeta)
) - > [Resource](resource.md?sid=flyte_connectors__connector_resource)

Return the status of the task, and return the outputs in some cases. For example, bigquery job can't write the structured dataset to the output location, so it returns the output literals to the propeller, and the propeller will write the structured dataset to the blob store.

Parameters

NameTypeDescription
resource_meta[ResourceMeta](resourcemeta.md?sid=flyte_connectors__connector_resourcemeta)The metadata handle used to identify and locate the specific task in the external system

Returns

TypeDescription
[Resource](resource.md?sid=flyte_connectors__connector_resource)The current state of the external resource, including its status and any available output data

delete()

@classmethod
def delete(
resource_meta: [ResourceMeta](resourcemeta.md?sid=flyte_connectors__connector_resourcemeta)
)

Delete the task. This call should be idempotent. It should raise an error if fails to delete the task.

Parameters

NameTypeDescription
resource_meta[ResourceMeta](resourcemeta.md?sid=flyte_connectors__connector_resourcemeta)The metadata handle identifying the external resource to be terminated or removed

get_metrics()

@classmethod
def get_metrics(
resource_meta: [ResourceMeta](resourcemeta.md?sid=flyte_connectors__connector_resourcemeta)
) - > GetTaskMetricsResponse

Return the metrics for the task.

Parameters

NameTypeDescription
resource_meta[ResourceMeta](resourcemeta.md?sid=flyte_connectors__connector_resourcemeta)The metadata handle identifying the task for which metrics are being requested

Returns

TypeDescription
GetTaskMetricsResponseA response object containing performance and execution metrics collected from the external task

get_logs()

@classmethod
def get_logs(
resource_meta: [ResourceMeta](resourcemeta.md?sid=flyte_connectors__connector_resourcemeta)
) - > GetTaskLogsResponse

Return the metrics for the task.

Parameters

NameTypeDescription
resource_meta[ResourceMeta](resourcemeta.md?sid=flyte_connectors__connector_resourcemeta)The metadata handle identifying the task for which logs are being retrieved

Returns

TypeDescription
GetTaskLogsResponseA response object containing log links or log data generated during the task execution