Skip to content

Never run benchmarks concurrently, always output to console #3663#3666

Merged
mgsloan merged 2 commits intomasterfrom
fix-parallel-final-tasks-3663
Dec 24, 2017
Merged

Never run benchmarks concurrently, always output to console #3663#3666
mgsloan merged 2 commits intomasterfrom
fix-parallel-final-tasks-3663

Conversation

@mgsloan
Copy link
Contributor

@mgsloan mgsloan commented Dec 17, 2017

Also generally cleans up code related to parallel execution of tasks. Instead of
locking happening among "final tasks" (tests and benchmark running), it's now
possible to mark some tasks as work that shouldn't be done in parallel with
anything else. This is what makes sense for benchmark running - they shouldn't
be run concurrently with either building or running tests.

Previously benchmarks and tests shared the same final task. The mechanism to
execute one task exclusively is part of Control.Concurrent.Execute. If they were
kept in the same task, then if any benchmarks were enabled, then tests would be
run without any concurrency. In order to have as much concurrency as possible,
they are now split into two different "final" tasks.

Note: Documentation fixes for https://docs.haskellstack.org/en/stable/ should target the "stable" branch, not master.

Please include the following checklist in your PR:

  • Any changes that could be relevant to users have been recorded in the ChangeLog.md
  • The documentation has been updated, if necessary.

Tested via the repro in #3663

@mgsloan mgsloan requested review from borsboom and snoyberg December 17, 2017 22:51
@mgsloan
Copy link
Contributor Author

mgsloan commented Dec 17, 2017

I quite like that now all benchmark output will be visible. Might consider doing this for tests too if concurrent-tests is set to false. However, as implemented here, when this option is set to false, it will still run tests concurrently with build steps, so they can't be sent to the output.

ChangeLog.md Outdated
* Run the Cabal file checking in the `sdist` command more reliably by
allowing the Cabal library to flatten the
`GenericPackageDescription` itself.
* Benchmarks used to be run concurrently with other benchmarks
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm assuming the reason for this is to not confuse the benchmark results with other CPU activities, right? May be worth pointing that out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, done!

sortActions :: [Action] -> [Action]
sortActions = sortBy (compareConcurrency `on` actionConcurrency)
where
compareConcurrency ConcurrencyAllowed ConcurrencyDisallowed = LT
Copy link
Contributor

Choose a reason for hiding this comment

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

What about deriving Ord on the Concurrency type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered that, but it would be easy for someone to add a constructor and not realize its impact on the usage of Ord. I've added a note about it.

@mgsloan mgsloan force-pushed the fix-parallel-final-tasks-3663 branch from 3db9fc6 to f0f2a8b Compare December 23, 2017 15:49
Also generally cleans up code related to parallel execution of tasks. Instead of
locking happening among "final tasks" (tests and benchmark running), it's now
possible to mark some tasks as work that shouldn't be done in parallel with
anything else.  This is what makes sense for benchmark running - they shouldn't
be run concurrently with either building or running tests.

Previously benchmarks and tests shared the same final task. The mechanism to
execute one task exclusively is part of Control.Concurrent.Execute. If they were
kept in the same task, then if any benchmarks were enabled, then tests would be
run without any concurrency. In order to have as much concurrency as possible,
they are now split into two different "final" tasks.
@mgsloan
Copy link
Contributor Author

mgsloan commented Dec 23, 2017

@snoyberg I've addressed your feedback. I'm particularly interested to know if you like the change to default to outputting benchmark results?

@mgsloan mgsloan force-pushed the fix-parallel-final-tasks-3663 branch from f0f2a8b to 4346cfd Compare December 23, 2017 15:51
Copy link
Contributor

@snoyberg snoyberg left a comment

Choose a reason for hiding this comment

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

Seems like a good change to me, no objection.

@mgsloan mgsloan merged commit f47a2f9 into master Dec 24, 2017
@mgsloan mgsloan deleted the fix-parallel-final-tasks-3663 branch January 2, 2018 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants