Skip to content
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

feat: simplify pipeline model #301

Merged
merged 1 commit into from
May 26, 2024
Merged

Conversation

brianmcgee
Copy link
Member

@brianmcgee brianmcgee commented May 24, 2024

For each path we determine the list of formatters that are interested in formatting it. From there, we sort
the list of formatters first by priority (lower value, higher priority) and then by name (lexicographically).

With this information we create a batch key which is based on the unique sequence of formatters. When enough paths with the same sequence is ready we apply them in order to each formatter.

By default, with no special configuration, this model guarantees that a given path will only be processed by one formatter at a time.

If a user wishes to influence the order in which formatters are applied they can use the priority field.

TODO

  • profile and determine why sometimes formatting nixpkgs takes significantly longer than usual
  • update docs

Signed-off-by: Brian McGee brian@bmcgee.ie

@brianmcgee brianmcgee requested a review from zimbatm May 24, 2024 10:43
@brianmcgee
Copy link
Member Author

@zowoq this is my first attempt at making it easier to configure the ordering of formatters and make it easier to handle nix-community/infra#1266 (comment)

I'm keen to get your feedback.

@brianmcgee brianmcgee force-pushed the feat/better-concurrency-model branch from 734bf50 to 01ab21a Compare May 24, 2024 11:06
@brianmcgee brianmcgee changed the title feat: simplifies pipeline model feat: simplify pipeline model May 24, 2024
Copy link
Member

@zimbatm zimbatm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. I tried separating concerns even further in the comments but honestly it's not needed.

cli/format.go Outdated Show resolved Hide resolved
cli/format.go Show resolved Hide resolved
cli/format.go Outdated Show resolved Hide resolved
cli/format.go Show resolved Hide resolved
@zowoq
Copy link

zowoq commented May 24, 2024

This looks good, thank you!

@brianmcgee brianmcgee force-pushed the feat/better-concurrency-model branch from b003614 to 82518f6 Compare May 26, 2024 15:19
For each path we determine the list of formatters that are interested in formatting it. From there, we sort
the list of formatters first by priority (lower value, higher priority) and then by name (lexicographically).

With this information we create a batch key which is based on the unique sequence of formatters. When enough paths with the same sequence is ready we apply them in order to each formatter.

By default, with no special configuration, this model guarantees that a given path will only be processed by one formatter at a time.

If a user wishes to influence the order in which formatters are applied they can use the priority field.

Signed-off-by: Brian McGee <brian@bmcgee.ie>
@brianmcgee brianmcgee force-pushed the feat/better-concurrency-model branch from 82518f6 to ce14ee8 Compare May 26, 2024 15:52
@brianmcgee brianmcgee requested a review from zimbatm May 26, 2024 15:52
@brianmcgee brianmcgee marked this pull request as ready for review May 26, 2024 15:52
@brianmcgee
Copy link
Member Author

@zimbatm did some cleanup and updated the docs.

@brianmcgee brianmcgee mentioned this pull request May 26, 2024
@brianmcgee
Copy link
Member Author

@mergify queue

Copy link
Contributor

mergify bot commented May 26, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 06f15f4

@mergify mergify bot merged commit 06f15f4 into main May 26, 2024
13 checks passed
@mergify mergify bot deleted the feat/better-concurrency-model branch May 26, 2024 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants