repast-simphony

Repast: suppress errors during batch run


I have a model with some calculations associated with a number of hubs, each with a unique hub code. Hence I configure the batch run as a list of hub codes. However, there could be some errors happens for certain hubs. In such case, the batch run will be auto stopped at the time error happens.

I am wondering if I could configure to tell the batch run to auto jump the hubs that are reporting errors and continue to calculate the remaining hubs to finish the entire batch run list of hubs.

Update on issue clarification:

I have a batch run configuration consists of two key parameters. The hub name and the date. "Hub name" is a list of all hub codes. I have 300 hubs to simulate. The "date" indicates the demand data of a particular date for a hub. I have set the date range from 1 to 5. Thereafter, I have 300 x 5 combination of scenarios to simulate, which forms the batch run configuration.

The batch run, however is likely to be interrupted as some part of the input data is missing for simulating certain hub scenarios (e.g. some hub does not have full 5 days demand data, when the model pulls the input data of a particular date which is missing, the model reports runtime error causing the whole batch run ended). Hence, in reality there is not full 300 X 5 viable scenarios, some are missing or invalid.

I want the batch run to jump simulating the scenarios if there are some errors and continue to simulate the rest of the valid scenarios. e.g. if I have hub-1, hub-2, hub-3, hub-4, hub-5 as the batch scenarios. if these 5 scenarios are happen to be allocated to the same cpu core, I hope it will finish whatever it can finish. i.e. if hub-3 reportes an error, batch run will jump it and continue to simulate hub-4 and hub-5 scenarios. so finally I can still get hub-1,2,4,5 results except hub-3 being error reportred and hence empty result.

Update: the traceback info: (it seems try catch exception (RunEnvironment.getInstance().endRun();) won't work in initialization (context builder)

INFO [AWT-EventQueue-0] 14:11:03,592 repast.simphony.batch.gui.BatchConfigMediator - Writing batch run config file to: C:\Users\xxx\Desktop\Repast\Hub_Unload\output\config.props INFO [AWT-EventQueue-0] 14:11:03,692 repast.simphony.batch.gui.BatchConfigMediator - Unrolling batch parameter file: C:\Users\xxx\Desktop\Repast\Hub_Unload\batch\batch_params.xml to C:\Users\xxx\AppData\Local\Temp\unrolledParamFile.txt INFO [SwingWorker-pool-2-thread-1] 14:11:13,463 repast.simphony.batch.ssh.LocalSession - Copying locally C:\Users\xxx\AppData\Local\Temp\Jie_localhost7191822269942717344.zip to C:\Users\xxx\AppData\Local\Temp\simphony_model_1595484669853 ... INFO [SwingWorker-pool-2-thread-1] 14:11:13,492 repast.simphony.batch.ssh.LocalSession - Copying Finished. INFO [SwingWorker-pool-2-thread-1] 14:11:13,494 repast.simphony.batch.ssh.SessionsDriver - Initialization Time: 0.0606 INFO [SwingWorker-pool-2-thread-1] 14:11:13,494 repast.simphony.batch.ssh.LocalSession - Unzipping model C:\Users\xxx\AppData\Local\Temp\simphony_model_1595484669853\Jie_localhost7191822269942717344.zip INFO [SwingWorker-pool-2-thread-1] 14:11:13,955 repast.simphony.batch.ssh.LocalSession - Running model on localhost ... INFO [Thread-0] 14:11:21,769 repast.simphony.batch.ssh.LocalSession - WARNING: An illegal reflective access operation has occurred INFO [Thread-0] 14:11:21,769 repast.simphony.batch.ssh.LocalSession - WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/C:/Users/xxx/AppData/Local/Temp/simphony_model_1595484669853/lib/xstream-1.4.7.jar) to field java.util.TreeMap.comparator INFO [Thread-0] 14:11:21,769 repast.simphony.batch.ssh.LocalSession - WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields INFO [Thread-0] 14:11:21,770 repast.simphony.batch.ssh.LocalSession - WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations INFO [Thread-0] 14:11:21,770 repast.simphony.batch.ssh.LocalSession - WARNING: All illegal access operations will be denied in a future release INFO [Thread-0] 14:11:21,806 repast.simphony.batch.ssh.LocalSession - INFO [Thread-0] 14:11:21,807 repast.simphony.batch.ssh.LocalSession - Hub Code: 769WX INFO [Thread-0] 14:11:21,807 repast.simphony.batch.ssh.LocalSession - Date: 2 INFO [Thread-0] 14:11:21,807 repast.simphony.batch.ssh.LocalSession - INFO [Thread-0] 14:11:21,807 repast.simphony.batch.ssh.LocalSession - Header a.require_id,a.line_code,a.send_zone_code,a.arrive_zone_code,a.line_level,a.arr_date,a.arr_time,sim_date,sim_date_adj,arr_time_adj,shift,shift_start,shift_last_arr,shift_end,a.car_type,sum_qty,sum_t77,sum_und3_qty,sum_und3bag_qty,sum_lt_qty,sum_hv_qty INFO [Thread-0] 14:11:21,810 repast.simphony.batch.ssh.LocalSession - Header ��ת������,ж���ڱ���,���߱��,ж������,ж��������ж����,���ػ�ж���ٶȣ���/Сʱ��,�ػ�ж���ٶȣ���/Сʱ��,�����������(��/Сʱ) INFO [Thread-0] 14:11:21,817 repast.simphony.batch.ssh.LocalSession - Dock INFO [Thread-0] 14:11:21,866 repast.simphony.batch.ssh.LocalSession - WARN [main] 14:11:21,864 repast.simphony.query.AbstractPropertyQuery - Possible error while creating property query INFO [Thread-0] 14:11:21,866 repast.simphony.batch.ssh.LocalSession - java.lang.IllegalArgumentException: Property 'arr_tm' not found. INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.query.AbstractPropertyQuery.propertyNotFound(AbstractPropertyQuery.java:88) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.query.PropertyLessThanEquals.createPredicate(PropertyLessThanEquals.java:94) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.query.AbstractPropertyQuery.query(AbstractPropertyQuery.java:83) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at hub_Unload.Initialization_Builder.build(Initialization_Builder.java:274) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.dataLoader.engine.ClassNameContextBuilder.build(ClassNameContextBuilder.java:41) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.dataLoader.engine.DataLoaderControllerAction.runInitialize(DataLoaderControllerAction.java:48) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.engine.controller.DefaultController$2.visit(DefaultController.java:214) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.engine.controller.DefaultController$2.visit(DefaultController.java:1) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:292) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:295) INFO [Thread-0] 14:11:21,867 repast.simphony.batch.ssh.LocalSession - at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:295) INFO [Thread-0] 14:11:21,868 repast.simphony.batch.ssh.LocalSession - at repast.simphony.util.collections.NaryTree.preOrderTraversal(NaryTree.java:288) INFO [Thread-0] 14:11:21,868 repast.simphony.batch.ssh.LocalSession - at repast.simphony.engine.controller.DefaultController.runInitialize(DefaultController.java:212) INFO [Thread-0] 14:11:21,868 repast.simphony.batch.ssh.LocalSession - at repast.simphony.engine.controller.DefaultController.runInitialize(DefaultController.java:383) INFO [Thread-0] 14:11:21,868 repast.simphony.batch.ssh.LocalSession - at repast.simphony.batch.OneRunBatchRunner.run(OneRunBatchRunner.java:101) INFO [Thread-0] 14:11:21,868 repast.simphony.batch.ssh.LocalSession - at repast.simphony.batch.InstanceRunner.run(InstanceRunner.java:195) INFO [Thread-0] 14:11:21,868 repast.simphony.batch.ssh.LocalSession - at repast.simphony.batch.InstanceRunner.main(InstanceRunner.java:217) INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - ERROR [main] 14:11:21,869 repast.simphony.batch.InstanceRunner - Error while running model INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 0 INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248) INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - at java.base/java.util.Objects.checkIndex(Objects.java:372) INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - at java.base/java.util.ArrayList.get(ArrayList.java:458) INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - at hub_Unload.Initialization_Builder.build(Initialization_Builder.java:308) INFO [Thread-0] 14:11:21,871 repast.simphony.batch.ssh.LocalSession - at repast.simphony.dataLoader.engine.ClassNameContextBuilder.build(ClassNameContextBuilder.java:41) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.dataLoader.engine.DataLoaderControllerAction.runInitialize(DataLoaderControllerAction.java:48) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.engine.controller.DefaultController$2.visit(DefaultController.java:214) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.engine.controller.DefaultController$2.visit(DefaultController.java:1) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:292) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:295) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:295) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.util.collections.NaryTree.preOrderTraversal(NaryTree.java:288) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.engine.controller.DefaultController.runInitialize(DefaultController.java:212) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.engine.controller.DefaultController.runInitialize(DefaultController.java:383) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.batch.OneRunBatchRunner.run(OneRunBatchRunner.java:101) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.batch.InstanceRunner.run(InstanceRunner.java:195) INFO [Thread-0] 14:11:21,872 repast.simphony.batch.ssh.LocalSession - at repast.simphony.batch.InstanceRunner.main(InstanceRunner.java:217)


Solution

  • If you catch the exception and call RunEnvironment.getInstance().endRun() that may be enough to exit gracefully. You may end up with empty output though.

    If this happens during initialization, you can catch the error and schedule the run to end at some very small number before any model behavior occurs.