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

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major Major
    • 7.5.0.Final
    • 7.0.0.Beta3
    • optaplanner-core
    • None
    • 2017 Week 36-37, 2017 Week 38-39, 2017 Week 40-41-42
    • NEW
    • NEW

      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.

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

                Created:
                Updated:
                Resolved: