trueblocks-core
trueblocks-core copied to clipboard
Enhancement to the Monitor code
Currently, in the command.fil, we accept only export commands, but we could easily accept other commands. For example,
scrape run-once
which could be stored at the top of the file and would scrape once every time the monitor runs, but it only goes through one pass to catch up to the front of the chain.
Another command could be
init
or
init -all
which would freshen the local index without requiring the end user to be running the scraper.
@dawid -- thought you might find this interesting. Seems like it would be easy, and it would work.
Seriously Thomas, I thought we are over it already. For years now, you are trying to convince me to get into this project, and I still really don't care. I prefer watching The Office for the third time...
Sorry -- wrong Dawid. I meant @dszlachta. Go back to your TV :-).
Haha 🤣 @tjayrush you can check if you're tagging me by trying to pronounce the username. If you cannot, it's me.
Could this file be YAML? As a new "--file arg user" (I started using it few weeks ago to test Docker) I already find it confusing and if we add special meaning to the top of the file, it would make it even more confusing (also for us as developers, because we would have to guess if the top is scrape's or export's argument). Instead, we could have:
scrape:
- run-once
- whatever-future-argument and-its-value
export:
- appearances
- logs
- group: # I think the current file supports "grouping" the commands
- articulate
- neighbors
I'm totally open to YAML. Sounds like a much better idea. Like the github action. (We can even steal ideas from there.)
Is this implemented? If you make a PR, I can merge it.
This was only a discussion, I think. Let's put on our roadmap.
I suggest we steal heavily from GitHub actions (but eliminate a lot of what's available there). For example:
name: Export
every: 15 seconds
jobs:
Export Logs:
steps:
- name: Freshen
run: |
chifra list ${{address}}
chifra export --logs ${{address}}
Publish:
needs: Freshen
on: freshen
steps:
- name: Summarize
with:
Generate totals
- name: Update database
with:
Commands to update databaseså
- name: Send notifications
with:
subject: New transaction ${{ TX_LINK }}
recipient: ${{ EMAIL }}
script: |
email whatever
Of course, the above is very bogus and will evolve with time.
Another idea would be to steal from The Graph which describes similar behaviour in the subgraph files.
A third idea would be to steal both.