-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Feature/graphman test run #3079
Feature/graphman test run #3079
Conversation
Requires some discussion about how the comparison tests should be run. Maybe they could be hooked to releases (not build graphman in the action to make it faster), maybe they could be in a different repository, maybe they could start a bigger matrix of runs, in parallel. |
cc0a767
to
e21a011
Compare
This PR is a first step in merging #3079. In this upcoming, we had copied a bunch of methods from `main.rs`, mainly those around instantiating elements to connect to chains and prepare them. In this PR, we moved - `create_ipfs_clients` - `create_ethereum_networks` (formely `create_networks`) - `create_firehose_networks` - `connect_ethereum_networks` - `connect_firehose_networks` To a common module `chain` under `graph-node` crate. There is no functionality changed in this PR, only moving code around. Small differences are the renamed of `create_networks` and its `config` argument that is now received as a reference to `Config` (instead of a owned `Config`).
* graph-node: factorize some methods inside a shared component This PR is a first step in merging #3079. In this upcoming, we had copied a bunch of methods from `main.rs`, mainly those around instantiating elements to connect to chains and prepare them. In this PR, we moved - `create_ipfs_clients` - `create_ethereum_networks` (formely `create_networks`) - `create_firehose_networks` - `connect_ethereum_networks` - `connect_firehose_networks` To a common module `chain` under `graph-node` crate. There is no functionality changed in this PR, only moving code around. Small differences are the renamed of `create_networks` and its `config` argument that is now received as a reference to `Config` (instead of a owned `Config`).
8de8594
to
56b602f
Compare
* graph-node: factorize some methods inside a shared component This PR is a first step in merging #3079. In this upcoming, we had copied a bunch of methods from `main.rs`, mainly those around instantiating elements to connect to chains and prepare them. In this PR, we moved - `create_ipfs_clients` - `create_ethereum_networks` (formely `create_networks`) - `create_firehose_networks` - `connect_ethereum_networks` - `connect_firehose_networks` To a common module `chain` under `graph-node` crate. There is no functionality changed in this PR, only moving code around. Small differences are the renamed of `create_networks` and its `config` argument that is now received as a reference to `Config` (instead of a owned `Config`).
b6640dc
to
2a1b0c4
Compare
@mangas ^ I've just removed the Github Actions part of this PR (by force-pushing rebased version over my feature-branch)
|
node/src/bin/manager.rs
Outdated
@@ -582,6 +605,30 @@ async fn main() { | |||
sleep, | |||
) | |||
} | |||
TestRun { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any objection to calling this Run and having stop block as an optional flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just see the possible confusion about the purpose of this (the purpose is to do a test run, no to run production on this! it does not work in parallel with a graph-node writing on the same database, etc.)
@maoueh ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm with @mangas, graphman run
feels better.
About your concerns @sduchesneau , graphman
is a tool that is deemed for "management of graph-node" instances, so I don't think it will be confused as production means to run a graph node.
@lutter What do you think about this, do you think there could be some confusions if we use graphman run
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm +1 on run
, but we can keep the stop block as a required flag if that's how it's meant to be used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am also +1 on run
- I think we should just say in the help message that this is for test purposes only. Another option would be to call this exec
which to me already sounds a bit more dangerous than run
Adding @leoyvens for review as well as I don't really trust my reviews yet 😄 |
…r on - Copied a bunch of stuff that can be shared with `main.rs` - Can refactor even more `main.rs` to be shared with stuff made for `test-run` - Implement some form of stop mechanism (block_count, stop block, time based, etc)
3b93149
to
3c247c1
Compare
} | ||
_ => {} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a little weird that we stop after getting the block but before processing it - that way, the last block we'll actually process (and have entities for) will be stop_block - 1
. It's probably fine, but will need to be documented in graphman run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The instance manager stops after seeing (and before processing) the block HIGHER THAN the stop block:
if block_ptr.number > stop_block
So the behavior is to process up to stop_block INCLUSIVE, as you would expect (well, it Works on My Machine ™️)
subgraph: String, | ||
|
||
/// Number of block to process | ||
stop_block: i32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to say that the latest entities we'll have in the database will be for stop_block - 1
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed if my previous claim is right 😃
node/src/bin/manager.rs
Outdated
@@ -582,6 +605,30 @@ async fn main() { | |||
sleep, | |||
) | |||
} | |||
TestRun { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am also +1 on run
- I think we should just say in the help message that this is for test purposes only. Another option would be to call this exec
which to me already sounds a bit more dangerous than run
@@ -411,6 +434,10 @@ impl Context { | |||
pools | |||
} | |||
|
|||
async fn store_builder(self) -> StoreBuilder { | |||
StoreBuilder::new(&self.logger, &self.node_id, &self.config, self.registry).await | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh .. the whole point of this Context
struct was so that we wouldn't have to pass the StoreBuilder
around because that obscures what exactly a command might be doing with the store. It would be better to add a utility method to the Context
that returns the NetworkStore
, the primary pool, and the chain head listener and pass those into commands::run
Also, StoreBuilder::new
will run migrations - avoiding that is a big reason why there are all these other methods on StoreBuilder
so that using the wrong graphman
version won't screw up the database schema.
I would change this method to call Self::store_and_primary
and then copy the few lines that create a ChainHeadUpdateListener
from StoreBuilder::new
to here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We changed it exactly to be able to run ... migrations :D I notice the differences indeed. Migrations was required first for CI since it always starts fresh but it's also quite good when using it for development purposes as I often starts from a fresh database.
The best will be to discuss that over a video chat to see what you be the best course of action here. Two things come to mind:
- Run only on pristine database
- Run only when specific flag is provided
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lutter Need to chat more about this, indeed, we are using this command mostly on a completely empty database (in dev/test flow), so we need all the migrations bells and whistles...
* graph-node: factorize some methods inside a shared component This PR is a first step in merging #3079. In this upcoming, we had copied a bunch of methods from `main.rs`, mainly those around instantiating elements to connect to chains and prepare them. In this PR, we moved - `create_ipfs_clients` - `create_ethereum_networks` (formely `create_networks`) - `create_firehose_networks` - `connect_ethereum_networks` - `connect_firehose_networks` To a common module `chain` under `graph-node` crate. There is no functionality changed in this PR, only moving code around. Small differences are the renamed of `create_networks` and its `config` argument that is now received as a reference to `Config` (instead of a owned `Config`).
graphman test-run
graphman test-run
command (implements stop-block mechanism to stop when the subgraph's end block is reached)(github implementation pushed to next PR)