ef3f8d221a5afefb01d655448ce7e3f537399810,src/python/pants/engine/exp/engine.py,LocalMultiprocessEngine,reduce,#LocalMultiprocessEngine#Any#Any#,446

Before Change


    // we limit pending submissions to the number of pool workers.  This gives us a bounded number
    // of items to check for submission readiness, ie: we"ll never need to scan more than the pool
    // size, commonly the number of cores, no matter the size and shape of the execution graph.
    for promise, plan in execution_graph.walk():
      pending_submission[promise] = plan
      submit_satisfied_pending()
      // Saturate the pool before we block on a result for maximum processing parallelism.

After Change


    // 1. Whenever we don"t have enough work to saturate the pool, request more.
    // 2. Whenever the pool is not saturated, submit currently pending work.
    for step_batch in self._scheduler.schedule(build_request):
      if not step_batch:
        // A batch should only be empty if all dependency work is currently blocked/running.
        if not in_flight and not pending_submission:
          raise Exception("Scheduler provided an empty batch while no work is in progress!")
      else:
        // Submit and wait for work for as long as we"re able to keep the pool saturated.
        pending_submission.update(step_batch)
        while submit_until(self._pool_size) > 0:
          await_one()
      // Await at least one entry per scheduling loop.
      submit_until(0)
      if in_flight:
        await_one()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: pantsbuild/pants
Commit Name: ef3f8d221a5afefb01d655448ce7e3f537399810
Time: 2016-01-26
Author: stuhood@gmail.com
File Name: src/python/pants/engine/exp/engine.py
Class Name: LocalMultiprocessEngine
Method Name: reduce


Project Name: pantsbuild/pants
Commit Name: da0989f9f00cf2a9eca58410a721d23a1fdf72bb
Time: 2019-08-19
Author: ericarellano@me.com
File Name: contrib/python/tests/python/pants_test/contrib/python/checks/tasks/checkstyle/test_checkstyle.py
Class Name: CheckstyleTest
Method Name: build_checker_wheel


Project Name: pantsbuild/pants
Commit Name: 461bb39fbdd9f49ff21a6be038ffbd2e7ae622b0
Time: 2015-07-30
Author: mateorod9@gmail.com
File Name: src/python/pants/backend/android/tasks/dx_compile.py
Class Name: DxCompile
Method Name: execute