TranslatorService
This class implements the TranslatorServiceHandler interface for translating between Flyte literals and JSON representations. It is served from the dataproxy binary to avoid routing translation requests through the control plane.
Methods
LiteralsToLaunchFormJson()
@classmethod
def LiteralsToLaunchFormJson(
ctx: context.Context,
req: *connect.Request[workflow.LiteralsToLaunchFormJsonRequest]
) - > *connect.Response[workflow.LiteralsToLaunchFormJsonResponse]
Translates Flyte literals into a JSON representation suitable for a launch form. This method is used to prepare literal data for display or interaction in a user interface.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| req | *connect.Request[workflow.LiteralsToLaunchFormJsonRequest] | The request containing the Flyte literals to be translated. |
Returns
| Type | Description |
|---|---|
*connect.Response[workflow.LiteralsToLaunchFormJsonResponse] | A Connect response containing the JSON representation of the literals. |
readOffloadedLiterals()
@classmethod
def readOffloadedLiterals(
ctx: context.Context,
req: *workflow.LiteralsToLaunchFormJsonRequest
) - > []*task.NamedLiteral
Reads offloaded Flyte literals from storage. This method is used internally to retrieve large literal data that has been stored externally.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| req | *workflow.LiteralsToLaunchFormJsonRequest | The request containing information needed to locate and read the offloaded literals. |
Returns
| Type | Description |
|---|---|
[]*task.NamedLiteral | A slice of named literals read from storage. |
LaunchFormJsonToLiterals()
@classmethod
def LaunchFormJsonToLiterals(
ctx: context.Context,
req: *connect.Request[workflow.LaunchFormJsonToLiteralsRequest]
) - > *connect.Response[workflow.LaunchFormJsonToLiteralsResponse]
Translates a JSON representation from a launch form back into Flyte literals. This method is used to convert user input from a form into a format that can be processed by Flyte.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| req | *connect.Request[workflow.LaunchFormJsonToLiteralsRequest] | The request containing the JSON data from a launch form to be translated. |
Returns
| Type | Description |
|---|---|
*connect.Response[workflow.LaunchFormJsonToLiteralsResponse] | A Connect response containing the Flyte literals derived from the JSON input. |
TaskSpecToLaunchFormJson()
@classmethod
def TaskSpecToLaunchFormJson(
ctx: context.Context,
req: *connect.Request[workflow.TaskSpecToLaunchFormJsonRequest]
) - > *connect.Response[workflow.TaskSpecToLaunchFormJsonResponse]
Translates a task specification into a JSON representation suitable for a launch form. This method helps in dynamically generating launch forms based on task definitions.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| req | *connect.Request[workflow.TaskSpecToLaunchFormJsonRequest] | The request containing the task specification to be translated. |
Returns
| Type | Description |
|---|---|
*connect.Response[workflow.TaskSpecToLaunchFormJsonResponse] | A Connect response containing the JSON representation of the task specification. |
JsonValuesToLiterals()
@classmethod
def JsonValuesToLiterals(
ctx: context.Context,
req: *connect.Request[workflow.JsonValuesToLiteralsRequest]
) - > *connect.Response[workflow.JsonValuesToLiteralsResponse]
Translates generic JSON values into Flyte literals. This method provides a flexible way to convert arbitrary JSON data into Flyte's internal literal format.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the request, used for cancellation and deadlines. |
| req | *connect.Request[workflow.JsonValuesToLiteralsRequest] | The request containing the JSON values to be translated into Flyte literals. |
Returns
| Type | Description |
|---|---|
*connect.Response[workflow.JsonValuesToLiteralsResponse] | A Connect response containing the Flyte literals derived from the JSON values. |