-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workflow for the ledger-api-bench-tool defined in YAML file [DPP-669] (…
…#11682) * Moved StreamConfig to a separate class WorkflowConfig * Change streams from Option[List[]] to List[] * Simplifying * Dedicated PartyFilter case class * Use String instead of Identifier in filter config to allow using short names * Submission config * Switched to unified WorkflowConfig * Minor change * Minor change * Workflow config parser tests * Removed leftovers * Added more tests * Removed leftovers * Updated CLI * Complete stream configuration support in the YAML file in the ledger-api-bench-tool CHANGELOG_BEGIN - [Integration Kit] - ledger-api-bench-tool - All stream configuration parameters can be defined through the YAML configuration file. CHANGELOG_END * Addressed review comments (renaming).
- Loading branch information
Showing
21 changed files
with
805 additions
and
574 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 0 additions & 98 deletions
98
ledger/ledger-api-bench-tool/src/main/scala/com/daml/ledger/api/benchtool/Config.scala
This file was deleted.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
...r/ledger-api-bench-tool/src/main/scala/com/daml/ledger/api/benchtool/ConfigEnricher.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package com.daml.ledger.api.benchtool | ||
|
||
import com.daml.ledger.api.benchtool.config.WorkflowConfig.StreamConfig | ||
import com.daml.ledger.api.benchtool.submission.CommandSubmitter | ||
import com.daml.ledger.api.v1.value.Identifier | ||
import com.daml.ledger.test.model.Foo.{Foo1, Foo2, Foo3} | ||
import scalaz.syntax.tag._ | ||
|
||
object ConfigEnricher { | ||
|
||
def enrichStreamConfig( | ||
streamConfig: StreamConfig, | ||
submissionSummary: Option[CommandSubmitter.SubmissionSummary], | ||
): StreamConfig = { | ||
streamConfig match { | ||
case config: StreamConfig.TransactionsStreamConfig => | ||
config.copy(filters = enrichFilters(config.filters, submissionSummary)) | ||
case config: StreamConfig.TransactionTreesStreamConfig => | ||
config.copy(filters = enrichFilters(config.filters, submissionSummary)) | ||
case config: StreamConfig.ActiveContractsStreamConfig => | ||
config.copy(filters = enrichFilters(config.filters, submissionSummary)) | ||
case config: StreamConfig.CompletionsStreamConfig => | ||
config.copy(party = convertParty(config.party, submissionSummary)) | ||
} | ||
} | ||
|
||
private def convertParty( | ||
party: String, | ||
submissionSummary: Option[CommandSubmitter.SubmissionSummary], | ||
): String = | ||
submissionSummary match { | ||
case None => party | ||
case Some(summary) => | ||
summary.observers | ||
.map(_.unwrap) | ||
.find(_.contains(party)) | ||
.getOrElse(throw new RuntimeException(s"Observer not found: $party")) | ||
} | ||
|
||
private def enrichFilters( | ||
filters: List[StreamConfig.PartyFilter], | ||
submissionSummary: Option[CommandSubmitter.SubmissionSummary], | ||
): List[StreamConfig.PartyFilter] = { | ||
def identifierToFullyQualifiedString(id: Identifier) = | ||
s"${id.packageId}:${id.moduleName}:${id.entityName}" | ||
def fullyQualifiedTemplateId(template: String): String = | ||
template match { | ||
case "Foo1" => identifierToFullyQualifiedString(Foo1.id.unwrap) | ||
case "Foo2" => identifierToFullyQualifiedString(Foo2.id.unwrap) | ||
case "Foo3" => identifierToFullyQualifiedString(Foo3.id.unwrap) | ||
case other => other | ||
} | ||
|
||
filters.map { filter => | ||
StreamConfig.PartyFilter( | ||
party = convertParty(filter.party, submissionSummary), | ||
templates = filter.templates.map(fullyQualifiedTemplateId), | ||
) | ||
} | ||
} | ||
|
||
} |
53 changes: 0 additions & 53 deletions
53
...ger-api-bench-tool/src/main/scala/com/daml/ledger/api/benchtool/DescriptorConverter.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.