<@U06RKAMK0UC> is there a java equivalent of `flyt...
# ask-ai
f
@ancient-wolf-19325 is there a java equivalent of
flytekit.remote.remote.FlyteRemote
to fetch and register launch plans?
j
The Flyte's documentation I have ingested does not mention how to fetch and register launch plans using a Java equivalent of `flytekit.remote.remote.FlyteRemote`; all references to programmatic registration and remote interaction with Flyte entities are centered around the Python SDK (
flytekit
) and its
FlyteRemote
class. If you are looking for similar functionality in Java, please specify your use case or any existing Java SDKs you are considering, as this context could help clarify your requirements. If this doesn't help, please reach out to the Flyte support team for further assistance. 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
f
i'm trying to figure out if it is possible to implement fetching and registering of launch plans in my scala-based backend services
@ancient-wolf-19325 i'm trying to figure out if it is possible to implement fetching and registering of launch plans in my scala-based backend services
j
It seems likely that there is no official Scala or Java equivalent of Python's
FlyteRemote
for fetching and registering launch plans directly, based on the available documentation. The Flyte Java/Scala SDKs focus on authoring and registering workflows, but do not appear to expose a high-level remote client for dynamic fetch/register operations like
FlyteRemote
in Python. Registration for Java/Scala is typically handled via JFlyte or CLI, not via a remote API client at runtime (source, source). However, since Flyte's control plane (FlyteAdmin) exposes a gRPC/REST API, it is theoretically possible to implement your own Scala client to interact with these endpoints for fetching and registering launch plans. This would require manual implementation using the FlyteIDL protobuf definitions and/or REST endpoints (source). Would you like more detail on how to approach this with gRPC or REST in Scala? Sources: - Flyte Java/Scala SDK and registration discussion - https://github.com/flyteorg/flyte/pull/1183 - https://github.com/flyteorg/flyte/blob/master/flyteadmin/README.md 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
f
@ancient-wolf-19325 yes, show me how to do this with REST
j
It seems likely that you can interact with FlyteAdmin's REST API to fetch and register launch plans from Scala by making HTTP requests to the appropriate endpoints. FlyteAdmin exposes a REST API (via grpc-gateway) for managing entities like launch plans, and you can use standard HTTP clients in Scala to call these endpoints (source, source). A typical flow would be: 1. Use HTTP GET to fetch launch plans (e.g.,
/api/v1/launch_plans
). 2. Use HTTP POST to register a new launch plan (e.g.,
/api/v1/launch_plan
), sending the launch plan spec as JSON. Here is a simplified Scala example using the popular sttp client:
Copy code
import sttp.client3._
import sttp.model._

val backend = HttpURLConnectionBackend()
val baseUrl = "http://<flyteadmin-host>:<port>/api/v1"

// Fetch launch plans
val fetchRequest = basicRequest
  .get(uri"$baseUrl/launch_plans?project=myproject&domain=development")
  .response(asString)

val fetchResponse = fetchRequest.send(backend)
println(fetchResponse.body)

// Register a launch plan (replace <jsonPayload> with your launch plan JSON)
val registerRequest = basicRequest
  .post(uri"$baseUrl/launch_plan")
  .contentType(MediaType.ApplicationJson)
  .body("""{ ... }""") // your launch plan JSON here
  .response(asString)

val registerResponse = registerRequest.send(backend)
println(registerResponse.body)
You will need to construct the JSON payloads according to the FlyteAdmin API schema, which you can explore via the Swagger UI after starting a Flyte demo (source). Would you like more detail on the required JSON structure or authentication? Sources: - https://www.union.ai/docs/flyte/deployment/flyte-configuration/swagger/ 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
f
@ancient-wolf-19325 what about grpc?
j
Yes, you can interact with FlyteAdmin's gRPC API from Scala by generating gRPC client stubs from the FlyteIDL protobuf definitions. FlyteAdmin exposes all core operations (including fetching and registering launch plans) via gRPC, and these APIs are language-agnostic (source, source). To do this in Scala: 1. Download the FlyteIDL proto files (see flyteidl). 2. Use ScalaPB or another gRPC code generator to generate Scala client stubs. 3. Use the generated stubs to call methods like
ListLaunchPlans
and
CreateLaunchPlan
on the FlyteAdmin service. Would you like a step-by-step example of generating Scala gRPC clients for FlyteAdmin? Sources: - https://www.union.ai/docs/flyte/deployment/flyte-configuration/swagger/ 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
f
@ancient-wolf-19325 looks like I can use what's in
flyteidl-protos/src/main/proto/flyteidl
?
j
Yes, you can use the proto files in
flyteidl-protos/src/main/proto/flyteidl
to generate Scala (or Java) gRPC client stubs. These proto files define the FlyteAdmin service and all related messages, enabling you to interact with FlyteAdmin's gRPC API for operations like fetching and registering launch plans (source, source). Would you like detailed steps on generating Scala gRPC clients from these proto files? Sources: - https://github.com/flyteorg/flyte/blob/master/flyteidl/README.md - https://github.com/flyteorg/flyte/blob/master/flyteidl/protos/docs/contributing.md 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.