mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
b35c9fcb3d
* restate the submit stage as a Flow and derived Sink * take submit out of the trigger-to-submit flow * type for the failures produced directly by command submission * directly connect the msgSource failure queue to the submitter output * parens * slow down submission as we exceed max parallel submissions * restricting alterF so it will be usable with ConcurrentMap * disable buffer for the delay * split out the delay function * drafting a retry loop * degenerate test for retry loop, factoring the forAllFuture utility * map input to retrying properly * make retrying accessible to tests * test happy path and fix off-by-one * further tests for retrying * reveal that elements can get lost * more determinism in test * let failures block further elements from being attempted - Previously failures would go into a separate queue, where they awaited expiry of their delay and further initial upstream elements were given their first tries. However, closing the upstream could mean that queue was dropped, and detecting that situation is not trivial. So, instead, we don't use a separate queue. * plug retrying into the trigger submission flow * no changelog CHANGELOG_BEGIN CHANGELOG_END * remove throttle; pendingCommandIds may leak * report random parameter on failure * revert comment about throttling * explanation for fail in the error queue - suggested by @cocreature; thanks
169 lines
6.2 KiB
Python
169 lines
6.2 KiB
Python
# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
load(
|
|
"//bazel_tools:scala.bzl",
|
|
"da_scala_binary",
|
|
"da_scala_library",
|
|
"da_scala_test",
|
|
)
|
|
load(
|
|
"//bazel_tools/client_server:client_server_test.bzl",
|
|
"client_server_test",
|
|
)
|
|
load("@build_environment//:configuration.bzl", "sdk_version")
|
|
|
|
DAML_LF_VERSIONS = [
|
|
"1.dev",
|
|
"", # SDK default
|
|
]
|
|
|
|
[
|
|
genrule(
|
|
name = "acs" + suffix,
|
|
srcs =
|
|
glob(["**/*.daml"]) + [
|
|
"//triggers/daml:daml-trigger%s.dar" % suffix,
|
|
"//daml-script/daml:daml-script%s.dar" % suffix,
|
|
"//docs:source/triggers/template-root/src/CopyTrigger.daml",
|
|
],
|
|
outs = ["acs%s.dar" % suffix],
|
|
cmd = """
|
|
set -eou pipefail
|
|
TMP_DIR=$$(mktemp -d)
|
|
mkdir -p $$TMP_DIR/daml
|
|
cp -L $(location :daml/ACS.daml) $$TMP_DIR/daml
|
|
cp -L $(location :daml/Retry.daml) $$TMP_DIR/daml
|
|
cp -L $(location :daml/ExerciseByKey.daml) $$TMP_DIR/daml
|
|
cp -L $(location :daml/CreateAndExercise.daml) $$TMP_DIR/daml
|
|
cp -L $(location :daml/MaxInboundMessageTest.daml) $$TMP_DIR/daml
|
|
cp -L $(location :daml/Numeric.daml) $$TMP_DIR/daml
|
|
cp -L $(location :daml/CommandId.daml) $$TMP_DIR/daml
|
|
cp -L $(location :daml/PendingSet.daml) $$TMP_DIR/daml
|
|
cp -L $(location :daml/TemplateIdFilter.daml) $$TMP_DIR/daml
|
|
cp -L $(location :daml/Time.daml) $$TMP_DIR/daml
|
|
cp -L $(location :daml/Heartbeat.daml) $$TMP_DIR/daml
|
|
cp -L $(location //docs:source/triggers/template-root/src/CopyTrigger.daml) $$TMP_DIR/daml
|
|
cp -L $(location //triggers/daml:daml-trigger{suffix}.dar) $$TMP_DIR/daml-trigger.dar
|
|
cp -L $(location //daml-script/daml:daml-script{suffix}.dar) $$TMP_DIR/daml-script.dar
|
|
cat << EOF > $$TMP_DIR/daml.yaml
|
|
sdk-version: {sdk}
|
|
name: acs
|
|
source: daml
|
|
version: 0.0.1
|
|
dependencies:
|
|
- daml-stdlib
|
|
- daml-prim
|
|
- daml-trigger.dar
|
|
- daml-script.dar
|
|
EOF
|
|
test -z "{lf_version}" || echo "build-options: [--target={lf_version}]" >> $$TMP_DIR/daml.yaml
|
|
$(location //compiler/damlc) build --project-root=$$TMP_DIR -o $$PWD/$(location acs{suffix}.dar)
|
|
rm -rf $$TMP_DIR
|
|
""".format(
|
|
sdk = sdk_version,
|
|
lf_version = lf_version,
|
|
suffix = suffix,
|
|
),
|
|
tools = ["//compiler/damlc"],
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
for lf_version in DAML_LF_VERSIONS
|
|
for suffix in [("-" + lf_version) if lf_version else ""]
|
|
]
|
|
|
|
da_scala_library(
|
|
name = "test-utils",
|
|
srcs = [
|
|
"src/test/scala/com/digitalasset/daml/lf/engine/trigger/test/AbstractFuncTests.scala",
|
|
"src/test/scala/com/digitalasset/daml/lf/engine/trigger/test/AbstractTriggerTest.scala",
|
|
],
|
|
deps = [
|
|
"//bazel_tools/runfiles:scala_runfiles",
|
|
"//daml-lf/archive:daml_lf_archive_reader",
|
|
"//daml-lf/archive:daml_lf_dev_archive_java_proto",
|
|
"//daml-lf/data",
|
|
"//daml-lf/interpreter",
|
|
"//daml-lf/language",
|
|
"//daml-lf/transaction",
|
|
"//language-support/scala/bindings",
|
|
"//language-support/scala/bindings-akka",
|
|
"//ledger-api/rs-grpc-bridge",
|
|
"//ledger-api/testing-utils",
|
|
"//ledger/ledger-api-auth",
|
|
"//ledger/ledger-api-common",
|
|
"//ledger/ledger-api-domain",
|
|
"//ledger/ledger-resources",
|
|
"//ledger/sandbox-classic",
|
|
"//ledger/sandbox-classic:sandbox-classic-scala-tests-lib",
|
|
"//ledger/sandbox-common",
|
|
"//ledger/sandbox-common:sandbox-common-scala-tests-lib",
|
|
"//ledger/test-common",
|
|
"//libs-scala/contextualized-logging",
|
|
"//libs-scala/ports",
|
|
"//libs-scala/resources",
|
|
"//triggers/runner:trigger-runner-lib",
|
|
"@maven//:com_typesafe_akka_akka_stream_2_12",
|
|
"@maven//:org_scalactic_scalactic_2_12",
|
|
"@maven//:org_scalatest_scalatest_2_12",
|
|
"@maven//:org_scalaz_scalaz_core_2_12",
|
|
],
|
|
)
|
|
|
|
# For now turning this into a scala_test_suite has too much overhead and ends up making
|
|
# things slower rather than faster. Once we have more tests, we might want to reconsider.
|
|
[
|
|
da_scala_test(
|
|
name = "trigger-integration-tests" + suffix,
|
|
srcs = [
|
|
"src/test/scala/com/digitalasset/daml/lf/engine/trigger/test/%s.scala" % f
|
|
for f in [
|
|
"FuncTestsStaticTime",
|
|
"FuncTestsWallClock",
|
|
"Jwt",
|
|
"Tls",
|
|
"RunnerSpec",
|
|
"UnfoldStateSpec",
|
|
]
|
|
],
|
|
data = [
|
|
":acs%s.dar" % suffix,
|
|
"//ledger/test-common/test-certificates",
|
|
],
|
|
resources = ["//triggers/runner:src/main/resources/logback.xml"],
|
|
deps = [
|
|
":test-utils",
|
|
"//bazel_tools/runfiles:scala_runfiles",
|
|
"//daml-lf/archive:daml_lf_archive_reader",
|
|
"//daml-lf/data",
|
|
"//daml-lf/interpreter",
|
|
"//daml-lf/language",
|
|
"//language-support/scala/bindings",
|
|
"//language-support/scala/bindings-akka",
|
|
"//ledger-api/rs-grpc-bridge",
|
|
"//ledger-api/testing-utils",
|
|
"//ledger/caching",
|
|
"//ledger/ledger-api-auth",
|
|
"//ledger/ledger-api-common",
|
|
"//ledger/ledger-api-domain",
|
|
"//ledger/ledger-resources",
|
|
"//ledger/participant-integration-api",
|
|
"//ledger/participant-state",
|
|
"//ledger/sandbox-classic",
|
|
"//ledger/sandbox-classic:sandbox-classic-scala-tests-lib",
|
|
"//ledger/sandbox-common",
|
|
"//ledger/sandbox-common:sandbox-common-scala-tests-lib",
|
|
"//ledger/test-common",
|
|
"//libs-scala/ports",
|
|
"//libs-scala/resources",
|
|
"//libs-scala/scalatest-utils",
|
|
"//triggers/runner:trigger-runner-lib",
|
|
"@maven//:com_typesafe_akka_akka_stream_2_12",
|
|
"@maven//:org_scalacheck_scalacheck_2_12",
|
|
"@maven//:org_scalaz_scalaz_core_2_12",
|
|
],
|
|
)
|
|
for lf_version in DAML_LF_VERSIONS
|
|
for suffix in [("-" + lf_version) if lf_version else ""]
|
|
]
|