Skip to content

Miscellaneous tools for Flyte contributors

License

Notifications You must be signed in to change notification settings

flyteorg/flytetools

Repository files navigation

Flyte Tools

This repository contains miscellaneous tools for Flyte contributors.

Tools

Swagger Client Code Generator

Because Flyte IDL takes advantage of the grpc-gateway project, the proto file generated by the Swagger gRPC generator is mostly Swagger/OpenAPI compliant. That is, we can run a code generator on top of the OpenAPI spec that's produced. See the file in gen/pb-go/flyteidl/service/admin.swagger.json.

However, in generating HTTP clients from the publicly available Docker images, we found two issues. The Dockerfile in the swagger-codegen-cli directory fixes these and the final image is used in the `flyteidl generate script <https://github.com/lyft/flyteidl/blob/master/generate_protos.sh`_.

  1. GO constant redefinition (detailed here)
  2. Use version 2.4.0 to solve the pointer struct fields.

To create the image

cd swagger-codegen-cli
make docker_build

The Dockerfile will

  • Re-build swagger-codegen-cli.jar with the fixed go template using Maven mvn clean package.
  • Follows the pattern in the original CLI to create one with our changes.

Currently, the default host is localhost for both the clients and the version is 1.0.0.

The GO client can be tested creating a main file, like

cfg := flyteadmin.NewConfiguration()
cfg.BasePath += ":30081" // default localhost.
client := flyteadmin.NewAPIClient(cfg)

// e.g. This calls the list projects endpoint.
projects, _, err := client.AdminServiceApi.ListProjects(context.Background())