Closed nealmcb closed 7 years ago
@nealmcb, what do you see if you do (with jq
in your path):
curl -XGET "http://localhost:8080/election/1/outcome" 2>/dev/null | jq
Incidentally, this is a useful little script for poking at backend URLs:
#!/usr/bin/env bash
path="${1}"
shift
curl -XGET "http://localhost:8080${path}" 2>/dev/null | jq "${@}"
If it is in your path as e.g. rla-get
, then you can do: rla-get /election/1/outcome
.
Ahh - nice script! Now I just need to know the API for the server!
$ rla-get /election/1/outcome
[
{
"shares": [
{
"id": 51,
"share": 0.8
},
{
"id": 52,
"share": 0.2
}
],
"id": 1006
},
{
"shares": [
{
"id": 53,
"share": 0.2
},
{
"id": 54,
"share": 0.8
}
],
"id": 1007
}
]
Oh, and I think you want a "." after jq in your script.
@nealmcb just added issue #62 for backend API documentation. In the meantime, you can at least see what all the routes are in this file: https://github.com/FreeAndFair/OpenRLA/blob/workflow-assistant/openrla-assistant/backend/src/OpenRLA.hs
(re the script, I'm not assuming a filter, but intentionally passing all the remaining args to jq
so you can give it other opt args, e.g. rla-get /election/1/outcome '.[0]' -c
)
@nealmcb hm, your JSON response looks right. I'm suspecting some sort of upload error. If you want to send me the application database out of band, I'll poke around some more!
Closing this unless it occurs again and we can repro. The need for better error handling overall is filed in #6.
Makes sense. For future reference, can you document here the best way to "send me the application database out of band"? Exactly what files are needed? Should we perhaps provide a make
target for collecting that and any other evidence or logs?
You bet!
In this case, all I would've wanted is the underlying SQLite database. This lives in the application "data directory". Currently, that is just a subdirectory of the executable's directory. Concretely, when you run make run
, the file will be called openrla.db
. If $BACKEND
is the backend
subdirectory of the repo on your machine, then the path will be something like (on my system):
${BACKEND}/.stack-work/install/x86_64-osx/lts-7.16/8.0.1/bin/data
To figure this out programmatically, if you are in the backend
dir of the repo, you can compute the data dir and backend database path like so:
DATA_DIR="$(stack path --local-install-root)/bin/data"
DB_PATH="${DATA_DIR}/openrla.db"
No idea what this means. I think I defined everything right, but while auditing, I see no progress in the Test statistic (which remains "1"), and see this for most every ballot audited in the stdout:
Prelude.foldr1: empty list
e.g.