Skip to content

Commit

Permalink
Start making some Armada GRPC test calls.
Browse files Browse the repository at this point in the history
Add functions for querying Armada GRPC endpoints for health and job
status. Also, use symlinks to armada protobuf directory and add for gogo
protobuf file. Add (commented-out) attempt to use sbt protoc path
inclusion in build.sbt, but it does not yet work.
  • Loading branch information
richscott committed Dec 10, 2024
1 parent 237a4da commit 6d546a7
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 303 deletions.
4 changes: 4 additions & 0 deletions client/scala/scala-armada-client/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value
)

// Additional directories to search for imports:
// Compile / PB.includePaths ++= Seq(file("../../../proto"), file("../../../proto/armada"))
// Compile / PB.protoSources ++= Seq(file("../../../proto"))

libraryDependencies ++= Seq(
"io.grpc" % "grpc-netty" % scalapb.compiler.Version.grpcJavaVersion,
"com.thesamet.scalapb" %% "scalapb-runtime-grpc" % scalapb.compiler.Version.scalapbVersion
Expand Down
1 change: 1 addition & 0 deletions client/scala/scala-armada-client/src/main/protobuf/armada
296 changes: 0 additions & 296 deletions client/scala/scala-armada-client/src/main/protobuf/armada/event.proto

This file was deleted.

This file was deleted.

This file was deleted.

27 changes: 22 additions & 5 deletions client/scala/scala-armada-client/src/main/scala/Main.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
import api.event.EventGrpc
import api.health.HealthCheckResponse
import api.submit.Job
import com.google.protobuf.empty
import io.grpc.ManagedChannelBuilder
import queryapi.queryapi.QueryApiGrpc
import queryapi.queryapi.JobStatusResponse

@main def hello(): Unit =
println("Hello world!")
val host = "localhost"
val port = 30002

Job(id = "test ID")
@main def getArmadaHealth(): Unit =
val channel = ManagedChannelBuilder.forAddress(host, port).usePlaintext().build
val blockingStub = EventGrpc.blockingStub(channel)

println(msg)
val reply: HealthCheckResponse = blockingStub.health(empty.Empty())

def msg = "I was compiled by Scala 3. :) api.submit.Job exists"
println(reply.status)

def getJobStatus(): Unit =
val channel = ManagedChannelBuilder.forAddress(host, port).usePlaintext().build
val blockingStub = QueryApiGrpc.blockingStub(channel)

val jsReq = queryapi.queryapi.JobStatusRequest(jobId = "foobar")
val reply: queryapi.queryapi.JobStatusResponse = blockingStub.getJobStatus(jsReq)

println(reply)

0 comments on commit 6d546a7

Please sign in to comment.