Yicong-Huang commented on code in PR #5557: URL: https://github.com/apache/texera/pull/5557#discussion_r3393741733
########## .github/workflows/benchmarks-pr-comment.yml: ########## @@ -0,0 +1,255 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Posts (or upserts) a PR comment with bench results AFTER the Benchmarks +# workflow completes. +# +# Why a separate workflow_run-triggered file: +# - The Benchmarks workflow runs on `pull_request`, which for fork PRs +# gets a read-only GITHUB_TOKEN and zero secret access — GitHub's +# hard-coded security model. We can't comment from there. +# - `workflow_run` runs in the BASE repo's context (apache/texera) +# with normal token + secret access, so it CAN comment on fork PRs. +# - This is the ASF-approved pattern; `pull_request_target` is policy- +# forbidden for any action that handles tokens. +# +# Why workflow_run is safe here vs pull_request_target: +# - We only READ a small, opaque artifact (pr-number.txt + the bench +# JSON / CSV) produced by the upstream run; we don't execute any +# PR-author code in this workflow. +# - The PR number is validated against ^[0-9]+$ before being used in +# any API call, blocking ref injection. + +name: Benchmarks PR Comment Review Comment: Resolving — covered by the conversation above and the fork-validation evidence in the PR description (post-merge to `main` seeds the gh-pages baseline, then subsequent PRs compare against it for alert-on-regression). ########## amber/src/bench/scala/org/apache/texera/amber/bench/ArrowFlightActorBench.scala: ########## @@ -0,0 +1,584 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.texera.amber.engine.architecture.pythonworker.bench + +import org.apache.pekko.actor.{Actor, ActorRef, ActorSystem, PoisonPill, Props} +import org.apache.pekko.testkit.TestProbe +import org.apache.texera.amber.clustering.SingleNodeListener +import org.apache.texera.amber.core.executor.OpExecWithCode +import org.apache.texera.amber.core.tuple.{Attribute, AttributeType, Schema, Tuple} +import org.apache.texera.amber.core.virtualidentity.{ + ActorVirtualIdentity, + ChannelIdentity, + EmbeddedControlMessageIdentity, + WorkflowIdentity +} +import org.apache.texera.amber.core.workflow.{PhysicalLink, PortIdentity} +import org.apache.texera.amber.engine.architecture.common.WorkflowActor.{NetworkAck, NetworkMessage} +import org.apache.texera.amber.engine.architecture.pythonworker.PythonWorkflowWorker +import org.apache.texera.amber.engine.architecture.rpc.controlcommands._ +import org.apache.texera.amber.engine.architecture.rpc.controlreturns.ReturnInvocation +import org.apache.texera.amber.engine.architecture.scheduling.config.WorkerConfig +import org.apache.texera.amber.engine.architecture.sendsemantics.partitionings.OneToOnePartitioning +import org.apache.texera.amber.engine.common.AmberRuntime +import org.apache.texera.amber.engine.common.ambermessage.{DataFrame, WorkflowFIFOMessage} +import org.apache.texera.amber.engine.common.ambermessage.WorkflowMessage.getInMemSize +import org.apache.texera.amber.util.VirtualIdentityUtils + +import java.io.PrintWriter +import java.nio.file.{Files, Paths} +import scala.concurrent.Await +import scala.concurrent.duration._ + +/** + * End-to-end micro-benchmark of the real Arrow Flight data path through a + * live PythonWorkflowWorker actor. + * + * Each measured config spawns a fresh PythonWorkflowWorker (real Pekko actor, + * real Python subprocess via texera_run_python_worker.py, real Arrow Flight + * transport), wires up an identity Python UDF, and times the round-trip of + * `numBatches` DataFrames send→echo through the actor mailbox. + * + * Output: + * - stdout summary per config + * - benchmark-results.csv (one row per config) — overwritten each run + * + * Run with: + * sbt "WorkflowExecutionService/Test/runMain \ + * org.apache.texera.amber.engine.architecture.pythonworker.bench.ArrowFlightActorBench" + * + * Caveat: `Utils.amberHomePath` does a `Files.walk(cwd, 2).findAny` for any + * dir ending in `amber`. If `.claude/amber/` exists locally, the Python + * subprocess may end up trying to launch from that path; move it aside for + * the run, or fix `amberHomePath` upstream. + */ +object ArrowFlightActorBench { Review Comment: Done in `bdd79c72f` — file moved to `amber/src/bench/scala/org/apache/texera/amber/bench/ArrowFlightActorBench.scala`. `amber/build.sbt` adds `src/bench/scala` as an additional Test source dir (same pattern as `src/test/integration/`), so scalafmt / scalafix coverage stays + `sbt Test/runMain` keeps working, just from a physically separate directory that won't be conflated with regression tests. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
