dry-orange-3870
03/14/2024, 4:18 PMtest
) if file changes are detected, it automatically cancels and restarts the rules or goal_rule.
We have a repo with some custom plugins and an assortment of goal_rule
and rule
functions. Some of these involve running a bunch of operations using Pants, and then making an API call to an external service. We commonly run into situations where these external API calls / side-effecting operations happen twice. Based on what I see in the pants logs, it looks like notify invalidation
is just slow to catch up with the filesystem; this is common when merging with main
and then immediately running one of our custom pants goals.
How can I work around this? Is there some way I can tag the `rule`s themselves to tell Pants that it should fail them instead of re-running them when a file system change is detected?
EDIT: we're currently on 2.18.0
, but could likely upgrade without too much hasslecurved-television-6568
03/14/2024, 4:23 PMdry-orange-3870
03/14/2024, 4:36 PMsleeping a bit after updating the worktreeI'm not sure I follow this. Are you suggesting I just count 10 ten after merging with main?
dry-orange-3870
03/14/2024, 4:38 PManother option could be to disable file watching when running the custom goal (but this would also result in restarting pantsd..)Would I just put a
cli.alias
in my pants.toml
that calls the goal but with --no-pantsd
on it to avoid this filesystem inotify thing?dry-orange-3870
03/14/2024, 4:52 PMnotify invalidation
logs to stop populating. I then ran my custom goal rule. Zero notify invalidation
logs happened while it ran, but for some reason, some of the underlying rules were run twicecurved-television-6568
03/15/2024, 7:39 AM> sleeping a bit after updating the worktree
I'm not sure I follow this. Are you suggesting I just count 10 ten after merging with main?yea, but it's a horrible idea I hope you can avoid 😉
curved-television-6568
03/15/2024, 7:41 AMOn closer inspection, it seems my root cause is not necessarily correct.is it possible there are multiple paths leading to your rule? my hypothesis here being that it may be called once, it starts processing but before it finishes it is called again, starting the second iteration rather than using the cached result of a previous call as it wasn't completed yet.
happy-kitchen-89482
03/15/2024, 11:02 PMhappy-kitchen-89482
03/15/2024, 11:02 PM