ExecutableStageTranslation { public static String generateNameFromStagePayload(ExecutableStagePayload stagePayload) { StringBuilder sb = new StringBuilder(); RunnerApi.Components components = stagePayload.getComponents(); final int transformsCount = stagePayload.getTransformsCount(); sb.append("[").append(transformsCount).append("]"); Collection<String> names = new ArrayList<>(); for (int i = 0; i < transformsCount; i++) { String name = components.getTransformsOrThrow(stagePayload.getTransforms(i)).getUniqueName(); name = name.replaceFirst("/ParMultiDo\\(Anonymous\\)$", ""); names.add(name); } sb.append(generateNameFromTransformNames(names, true)); return sb.toString(); }  static ExecutableStagePayload getExecutableStagePayload(
      AppliedPTransform<?, ?, ?> appliedTransform); static String generateNameFromStagePayload(ExecutableStagePayload stagePayload); static String generateNameFromTransformNames(
      Collection<String> names, boolean truncateSiblingComposites);  }
@Test public void testOperatorNameGeneration() throws Exception { Pipeline p = Pipeline.create(); p.apply(Impulse.create()) .apply( ParDo.of( new DoFn<byte[], String>() { @ProcessElement public void processElement( ProcessContext processContext, OutputReceiver<String> outputReceiver) {} })) .apply( "MyName", ParDo.of( new DoFn<String, Integer>() { @ProcessElement public void processElement( ProcessContext processContext, OutputReceiver<Integer> outputReceiver) {} })) .apply( "Composite/Nested/ParDo", ParDo.of( new DoFn<Integer, Integer>() { @ProcessElement public void processElement( ProcessContext processContext, OutputReceiver<Integer> outputReceiver) {} })); ExecutableStage firstEnvStage = GreedyPipelineFuser.fuse(PipelineTranslation.toProto(p)).getFusedStages().stream() .findFirst() .get(); RunnerApi.ExecutableStagePayload basePayload = RunnerApi.ExecutableStagePayload.parseFrom( firstEnvStage.toPTransform("foo").getSpec().getPayload()); String executableStageName = ExecutableStageTranslation.generateNameFromStagePayload(basePayload); assertThat(executableStageName, is("[3]{ParDo(Anonymous), MyName, Composite}")); }