-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Reintroduce the fsNotify trigger #1562
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1562 +/- ##
=========================================
- Coverage 46.18% 46.1% -0.08%
=========================================
Files 118 118
Lines 4961 4986 +25
=========================================
+ Hits 2291 2299 +8
- Misses 2439 2456 +17
Partials 231 231
Continue to review full report at Codecov.
|
@@ -38,7 +38,7 @@ func NewCmdDev(out io.Writer) *cobra.Command { | |||
} | |||
AddRunDevFlags(cmd) | |||
cmd.Flags().BoolVar(&opts.TailDev, "tail", true, "Stream logs from deployed objects") | |||
cmd.Flags().StringVar(&opts.Trigger, "trigger", "polling", "How are changes detected? (polling or manual)") | |||
cmd.Flags().StringVar(&opts.Trigger, "trigger", "polling", "How are changes detected? (polling, manual or notify)") |
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.
"notify" is rather specific to Go and Linux. I can't think of a better term, but perhaps we can add some more text to describe it? It's also odd that we use "trigger" here but the related options are "watch".
How are changes detected? (polling, manual or notify) polling periodically looks for new files (see
--watch-poll-interval
), whereas notify leverages OS filesystem notifications (more efficient). manual waits for keyboard input to trigger a new build.
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.
Some documentation would be good, yes.
The idea is that Skaffold knows all the dependencies for an artifact and can compute a "snapshot" of those dependencies (mostly last mod time). Now, to actually recompute a snapshot, do a diff and maybe trigger a rebuild/redeploy, it needs a trigger.
That trigger can be either:
- a timer, that runs by default every 500ms. but then Skaffold has to compute the list of deps and the mod times every 500ms
- a manual trigger. The user presses a key when they want Skaffold to compute the diff
- a inotify based file watcher that watches the workspace as a whole and tells Skaffold.
iNotify based watchers are not good at watching folders and files that might be disapear. but it's quite good at recursively watching a top level folder that's always there.
By combining the snapshot mechanism and a inotify trigger, we get the best of both world.
IDE integration would work the same: The IDE would detect changes, notify Skaffold that "something" changed, no details. Then Skaffold would run a diff
I all cases, Skaffold is capable of debouncing rapid streams of triggers so that it behaves well when a lot of files are changed in a short period of time.
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'd like to see this documented so users know what the expected behavior is for each option
This reverts commit 9cf3292.
luser error: I used the wrong command-line 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.
a few nits but otherwise LGTM
|
||
// Start Listening for file system changes | ||
func (t *fsNotifyTrigger) Start(ctx context.Context) (<-chan bool, error) { | ||
// TODO(@dgageot): If file changes happen too quickly, events might be lost |
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 could compute the number of files in the watch directory at start up time and use that for the buffer size. just a thought
@@ -38,7 +38,7 @@ func NewCmdDev(out io.Writer) *cobra.Command { | |||
} | |||
AddRunDevFlags(cmd) | |||
cmd.Flags().BoolVar(&opts.TailDev, "tail", true, "Stream logs from deployed objects") | |||
cmd.Flags().StringVar(&opts.Trigger, "trigger", "polling", "How are changes detected? (polling or manual)") | |||
cmd.Flags().StringVar(&opts.Trigger, "trigger", "polling", "How are changes detected? (polling, manual or notify)") |
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'd like to see this documented so users know what the expected behavior is for each option
Hi @dgageot , Unfortunately this does not work for very large projects. Here's the error message I get when working on my project ( multiple maven modules + angular frontend)
|
Could you try doing some digging with lsof and see what process has lots of open files? |
@briandealwis Given that skaffold dies printing this message I don't see how I can do a lsof on a dead command. |
Sorry @ltouati! I missed the Cleaning up… part. |
@briandealwis no worries :) |
To make sure we don't require CGO, I've added the
kqueue
tag at build time.We should test if it behaves as well as the cgo version on OSX
Fixes #1513
cc @ltouati