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

FR: Add parallel execution option and task execution stages #581

Closed
paslandau opened this issue Jan 3, 2019 · 0 comments
Closed

FR: Add parallel execution option and task execution stages #581

paslandau opened this issue Jan 3, 2019 · 0 comments

Comments

@paslandau
Copy link

Q A
Version 0.14.3
Bug? no
New feature? yes
Question? yes
Documentation? probably
Related tickets

On bigger code bases and / or long task chains, the grumphp execution can take a considerable amount of time. Most of the performed tasks are probably unrelated and don't affect each other (e.g. large_file and phpstan can run independently). Thus, running those tasks in parallel would greatly improve performance.

On the other hand, there might be tasks that should run in a certain order, e.g. parallel-lint should usually be run before phpcs or phpstan as failing early makes sense in this case. Thus, there should be a way to "group" tasks and define an execution order.

Proposal

Consider the following grumphp.yml

parameters:
  processes: 4
  tasks:
    parallel-lint: 
      stage: 0
    composer: 
      stage: 1
    composer_require_checker:
      stage: 1

processes denotes the number of parallel running tasks (can be omitted or 1 for to keep current behavior / avoid BC)
stage acts a an alternative to the already supported priority option. The value has to be an integer so that

  • stages can be run in a predefined order (same logic as priority)
  • tasks can be grouped into one stage
  • all tasks in the same stage can run in parallel
    -priority is ignored if stages are used

Use cases

  • Already mentioned in the description: This will greatly (usually ~linear to the number of cores) improve performance.

Implementation

This is probably a bigger change. Possible solution:

Thoughts?

Cheers
Pascal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants