Run ex-bond-issuance automation from command line
- jamesljaworski85OP
Hey DAMLer’s!
After exploring
ex-bond-issuancerepo and after talking to @Richard_Kapolnai, I do want to try and incorporate the triggers in the repo. I was previously going to try and incorporate without the automation but the triggers seem pretty slick and I want to give them a shot.Earlier, I got things up and running in Standalone from the windows command line with the help of @Gary_Verhaegen and @cocreature. These were the steps we cam up with:
python scripts/getfinlib.py 1.7.0 daml build -o target/bond-issuance.dar daml start --sandbox-option --address=localhost --sandbox-option -w --open-browser no ## insert manual 'make automation' steps here daml codegen js target/bond-issuance.dar -o daml.js daml codegen js target/finlib-1.7.0.dar -o daml.js cd ui-js yarn install set NODE_ENV=development yarn startI’d like to now add the
make automationsteps to the sequence. From theMakefile, the steps are:.PHONY: automation automation: JAVA_TOOL_OPTIONS=-Xmx128m \ scripts/waitForSandbox.sh localhost 6865 && \ scripts/startTriggers.sh localhost 6865 target/bond-issuance.darMy guess is that they would look something like this:
set JAVA_TOOL_OPTIONS=-Xmx128m java scripts/waitForSandbox.sh localhost 6865 java scripts/startTriggers.sh localhost 6865 target/bond-issuance.darWhen I do this, this is the result:
C:\Users\James Jaworski\OneDrive\Optimis\bloqbook-v2\ex-bond-issuance-master>set JAVA_TOOL_OPTIONS=-Xmx128m C:\Users\James Jaworski\OneDrive\Optimis\bloqbook-v2\ex-bond-issuance-master>java scripts/waitForSandbox.sh localhost 6865 Picked up JAVA_TOOL_OPTIONS: -Xmx128m Error: Could not find or load main class scripts.waitForSandbox.shIt looks like the environment variable is being set, but the rest is not running. Is anyone familiar with running this type of command on a Windows machine? My version of java is:
C:\Users\James Jaworski\OneDrive\Optimis\bloqbook-v2\ex-bond-issuance-master>java -version Picked up JAVA_TOOL_OPTIONS: -Xmx128m java version "1.8.0_231" Java(TM) SE Runtime Environment (build 1.8.0_231-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)Thanks!
- cocreature 2
Hi @jamesljaworski85, the
.shextension of the two scripts indicates that this is a shell script (more specifically bash). Running those usingjavais not going to work. Instead you have to look at the content of those scripts and translate it to powershell/cmd.exe commands.wait_for_sandbox.shdoesn’t do anything except for waiting for Sandbox to start so the easiest option is probably to just wait until you see Sandbox starting up before you invoke the next command.startTriggers.shactually starts the triggers. If you look at the contents, you can see that it invokes the following 10 times for different triggers ex-bond-issuance/startTriggers.sh at 9f801c393e8bd6be0a2a59105284521b8628e2a1 · digital-asset/ex-bond-issuance · GitHub. Since triggers are long-running processes you need to invoke that from 10 different terminals replacing the DAR, the trigger name, the party and the ledger host and port in the command.daml trigger \ --wall-clock-time \ --dar "${DAR_FILE}" \ --trigger-name "$trigger_name" \ --ledger-host "${SANDBOX_HOST}" \ --ledger-port "${SANDBOX_PORT}" \ --ledger-party "$party" - jamesljaworski85 2
Thanks @cocreature. After reading that it would take 10 different command windows (in addition to the two others I already had running), I decided to download Gitbash and run it from there. I was able to get it up and running and work through some of the examples.
Thanks for your help!
- cocreature 1
Glad to hear that you got it working!