Skip to main content

Plugin

No overview available.

Methods


setRegistry()

@classmethod
def setRegistry(
r: [Registry](registry.md?sid=flyteplugins_go_tasks_plugins_webapi_connector_registry)
)

Sets the registry for the plugin. This method is used to provide the plugin with access to the registry, which manages various components and services.

Parameters

NameTypeDescription
r[Registry](registry.md?sid=flyteplugins_go_tasks_plugins_webapi_connector_registry)The Registry instance to be set for the plugin.

GetConfig()

@classmethod
def GetConfig() - > webapi.PluginConfig

Retrieves the configuration for the plugin. Callers use this to access the current operational settings of the plugin.

Returns

TypeDescription
webapi.PluginConfigThe configuration object for the plugin.

ResourceRequirements()

@classmethod
def ResourceRequirements(
_: context.Context,
_: webapi.TaskExecutionContextReader
) - > (namespace core.ResourceNamespace, constraints core.ResourceConstraintsSpec, err error)

Determines the resource requirements for a task. This method is used to specify the necessary resources (e.g., CPU, memory) for executing a task within the plugin's context.

Parameters

NameTypeDescription
_context.ContextThe context for the operation, typically used for cancellation and deadlines.
_webapi.TaskExecutionContextReaderA reader for the task execution context, providing information about the task being executed.

Returns

TypeDescription
(namespace core.ResourceNamespace, constraints core.ResourceConstraintsSpec, err error)A tuple containing the resource namespace, resource constraints specification, and an error if any occurred.

Create()

@classmethod
def Create(
ctx: context.Context,
taskCtx: webapi.TaskExecutionContextReader
) - > (webapi.ResourceMeta, webapi.Resource, error)

Creates a new resource. This method is invoked to provision and initialize a resource managed by the plugin.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, typically used for cancellation and deadlines.
taskCtxwebapi.TaskExecutionContextReaderA reader for the task execution context, providing information about the task requesting resource creation.

Returns

TypeDescription
(webapi.ResourceMeta, webapi.Resource, error)A tuple containing the resource metadata, the created resource, and an error if the creation failed.

Get()

@classmethod
def Get(
ctx: context.Context,
taskCtx: webapi.GetContext
) - > (latest webapi.Resource, err error)

Retrieves the latest state of a resource. Callers use this method to fetch the current details and status of a specific resource.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, typically used for cancellation and deadlines.
taskCtxwebapi.GetContextThe context for the get operation, including identifiers for the resource to retrieve.

Returns

TypeDescription
(latest webapi.Resource, err error)A tuple containing the latest version of the resource and an error if the retrieval failed.

Delete()

@classmethod
def Delete(
ctx: context.Context,
taskCtx: webapi.DeleteContext
) - > error

Deletes a specified resource. This method is used to remove a resource managed by the plugin.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, typically used for cancellation and deadlines.
taskCtxwebapi.DeleteContextThe context for the delete operation, including identifiers for the resource to delete.

Returns

TypeDescription
errorAn error if the deletion failed, otherwise nil.

getEventInfoForConnectorApp()

@classmethod
def getEventInfoForConnectorApp(
taskCtx: webapi.StatusContext,
resource: [ResourceWrapper](resourcewrapper.md?sid=flyteplugins_go_tasks_plugins_webapi_connector_resourcewrapper)
) - > []*flyteIdl.TaskLog

Retrieves event information for a connector application. This method is used to gather logs or event details related to a specific connector application's execution.

Parameters

NameTypeDescription
taskCtxwebapi.StatusContextThe context for retrieving status, including information about the task.
resource[ResourceWrapper](resourcewrapper.md?sid=flyteplugins_go_tasks_plugins_webapi_connector_resourcewrapper)The wrapper around the resource for which event information is needed.

Returns

TypeDescription
[]*flyteIdl.TaskLogA slice of task logs associated with the connector application, or an error if retrieval fails.

Status()

@classmethod
def Status(
ctx: context.Context,
taskCtx: webapi.StatusContext
) - > (phase core.PhaseInfo, err error)

Retrieves the current status of a resource. Callers use this method to check the progress and state of a resource managed by the plugin.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, typically used for cancellation and deadlines.
taskCtxwebapi.StatusContextThe context for retrieving status, including information about the task.

Returns

TypeDescription
(phase core.PhaseInfo, err error)A tuple containing the current phase information of the resource and an error if status retrieval failed.

getAsyncConnectorClient()

@classmethod
def getAsyncConnectorClient(
ctx: context.Context,
connector: *Deployment
) - > connectorPb.AsyncConnectorServiceClient

Obtains an asynchronous client for a connector. This method is used to establish a connection and interact with a specific connector service asynchronously.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, typically used for cancellation and deadlines.
connector*DeploymentA pointer to the Deployment object representing the connector configuration.

Returns

TypeDescription
connectorPb.AsyncConnectorServiceClientAn asynchronous client for the connector service, or an error if client creation fails.

watchConnectors()

@classmethod
def watchConnectors(
ctx: context.Context,
connectorService: *ConnectorService
)

Monitors connectors for changes or events. This method sets up a watch mechanism to observe the state and activity of connector services.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, typically used for cancellation and deadlines.
connectorService*ConnectorServiceA pointer to the ConnectorService instance to be watched.

getFinalConnector()

@classmethod
def getFinalConnector(
taskCategory: *connectorPb.TaskCategory,
cfg: *Config,
project: string,
domain: string
) - > *Connector

Determines the final connector configuration based on task category, plugin configuration, project, and domain. This method resolves and returns the appropriate connector to be used for a given task.

Parameters

NameTypeDescription
taskCategory*connectorPb.TaskCategoryA pointer to the task category, which helps in identifying the type of connector needed.
cfg*ConfigA pointer to the plugin's configuration, providing global settings.
projectstringThe project identifier associated with the task.
domainstringThe domain identifier associated with the task.

Returns

TypeDescription
*ConnectorA pointer to the resolved Connector object, or an error if the connector cannot be determined.