Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sandbox: Deprecate the --eager-package-loading flag. #11404

Merged
1 commit merged into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ledger/daml-on-sql/src/main/scala/on/sql/Cli.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ private[sql] final class Cli(
.withContractIdSeeding(defaultConfig, Some(Seeding.Strong), Some(Seeding.Weak))
.parser

parser
.opt[Unit]("eager-package-loading")
.optional()
.text(
"Whether to load all the packages in the .dar files provided eagerly, rather than when needed as the commands come."
)
.action((_, config) => config.copy(eagerPackageLoading = true))

parser
.opt[String]("sql-backend-jdbcurl-env")
.optional()
Expand Down
4 changes: 4 additions & 0 deletions ledger/daml-on-sql/src/test/suite/scala/on/sql/CliSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class CliSpec
config shouldEqual None
}

"parse the eager package loading flag when given" in {
checkOption(Array("--eager-package-loading"), _.copy(eagerPackageLoading = true))
}

"reject when sql-backend-jdbcurl-env points to a non-existing environment variable" in {
val config =
cli.parse(Array("--ledgerid", "test-ledger", "--sql-backend-jdbcurl-env", "JDBC_URL"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ private[sandbox] object Cli extends SandboxCli {
" Two identifier formats are supported: Module.Name:Entity.Name (preferred) and Module.Name.Entity.Name (deprecated, will print a warning when used)." +
s" Also note that instructing $Name to load a scenario will have the side effect of loading _all_ the .dar files provided eagerly (see --eager-package-loading)."
)
parser
.opt[Unit]("eager-package-loading")
.optional()
.text(
"Whether to load all the packages in the .dar files provided eagerly, rather than when needed as the commands come."
)
.action((_, config) => config.copy(eagerPackageLoading = true))
parser
.opt[String]("sql-backend-jdbcurl")
.optional()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class CliSpec extends CommonCliSpecBase(Cli) {
)
}

"parse the eager package loading flag when given" in {
checkOption(Array("--eager-package-loading"), _.copy(eagerPackageLoading = true))
}

"parse the sql-backend-jdbcurl flag when given" in {
val jdbcUrl = "jdbc:postgresql://localhost:5432/test?user=test"
checkOption(Array("--sql-backend-jdbcurl", jdbcUrl), _.copy(jdbcUrl = Some(jdbcUrl)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,6 @@ class CommonCliBase(name: LedgerName) {

com.daml.cliopts.Logging.logLevelParse(this)((f, c) => c.copy(logLevel = f(c.logLevel)))

opt[Unit]("eager-package-loading")
.optional()
.text(
"Whether to load all the packages in the .dar files provided eagerly, rather than when needed as the commands come."
)
.action((_, config) => config.copy(eagerPackageLoading = true))

JwtVerifierConfigurationCli.parse(this)((v, c) =>
c.copy(authService = Some(AuthServiceJWT(v)))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,6 @@ abstract class CommonCliSpecBase(
)
}

"parse the eager package loading flag when given" in {
checkOption(Array("--eager-package-loading"), _.copy(eagerPackageLoading = true))
}

"parse a console metrics reporter when given" in {
checkOption(
Array("--metrics-reporter", "console"),
Expand Down
2 changes: 0 additions & 2 deletions ledger/sandbox/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,13 @@ NEXT_SERVERS = {
"server_args": [
"--contract-id-seeding=testing-weak",
"--port=6865",
"--eager-package-loading",
],
},
"postgresql": {
"binary": ":sandbox-ephemeral-postgresql",
"server_args": [
"--contract-id-seeding=testing-weak",
"--port=6865",
"--eager-package-loading",
],
},
}
Expand Down
14 changes: 14 additions & 0 deletions ledger/sandbox/src/main/scala/platform/sandboxnext/Cli.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ private[sandboxnext] object Cli extends SandboxCli {
Some(Seeding.Static),
)
.parser

parser
.opt[Unit]("eager-package-loading")
.hidden()
.optional()
.text("Deprecated. This flag no longer has any effect.")
.action((_, config) => {
System.err.println(
"WARNING: The `--eager-package-loading` flag no longer has any effect in the Sandbox. Packages are always loaded eagerly."
)
config
})

parser
.opt[Boolean](name = "implicit-party-allocation")
.optional()
Expand All @@ -29,6 +42,7 @@ private[sandboxnext] object Cli extends SandboxCli {
s"When referring to a party that doesn't yet exist on the ledger, $Name will implicitly allocate that party."
+ s" You can optionally disable this behavior to bring $Name into line with other ledgers."
)

parser
.opt[String]("sql-backend-jdbcurl")
.optional()
Expand Down