Uploaded image for project: 'OptaPlanner'
  1. OptaPlanner
  2. PLANNER-683

Partitioned Search: add a test to check if exception on partition child thread propogates to solver thread and stops all partition child threads

    XMLWordPrintable

Details

    • 2017 Week 36-37, 2017 Week 38-39, 2017 Week 40-41-42
    • NEW
    • NEW

    Description

      I've tested it manually locally (it works on my machine, but there is no regression test). Follows up on PLANNER-491. Currently the work for that is still on my branch (work in progress): https://github.com/droolsjbpm/optaplanner/pull/229

      This isn't easy to test, but some idea's:

      • Use a "Solver<TestdataSolution> solver" (there are some unit tests that do this already) by using PlannerTestUtils.buildSolverFactory(...)
      • Use a custom SimpleScoreDirector that is designed to throw an exception on 1 (and only 1) partition child thread.
      • Check if it bubbles up on the solver thread (it will be in the exception chain).
      • Somehow check if all the child threads stopped running... Not sure how to do this properly (so without Thread.sleep()). If you do end up using sleeps, don't use 1 big sleep (for example 10 seconds), but use a loop to do multiple small sleeps that check the condition (for example for (i = 0 -> 50) { sleep(200ms); if (condition) break;}

        , so a successful run takes less than 5 seconds on modern hardware.

      Attachments

        Issue Links

          Activity

            People

              jlocker Jiří Locker
              gdesmet@redhat.com Geoffrey De Smet
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: