Skip to content

Commit 93f736e

Browse files
author
Tomas
committed
making hub_and_spoke_dict manipulation a function instead of a separate module
1 parent 5f10194 commit 93f736e

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

Diff for: doc/src/generic_cylinders.rst

+10
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ needed even with the ``--help`` argument, e.g.,
2828
.. Note::
2929
This functionality is at the level of alpha-release.
3030

31+
Advanced manipulation of the hub and spokes dicts
32+
-------------------------------------------------
33+
34+
Advanced users might want to directly manipulate the hub and spoke dicts
35+
immediately before ``spin_the_wheel()`` is called. If the module (or class)
36+
contains a function called ``hub_and_spoke_dict_callback()``, it will be called
37+
immediately before the ``WheelSpinner`` object is created, and the ``hub_dict`` and
38+
``list_of_spoke_dict`` will be passed to it. See ``generic_cylinders.py`` for details.
39+
40+
3141
Pickled Scenarios
3242
-----------------
3343

Diff for: mpisppy/generic_cylinders.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ def _parse_args(m):
9898
default=None)
9999
# TBD - think about adding directory for json options files
100100

101-
cfg.add_to_config("hub_and_spoke_dict_callback",
102-
description="[FOR EXPERTS ONLY] Module that contains the function hub_and_spoke_dict_callback that will be passed the hubdict and list of spokedicts prior to spin-the-wheel (last chance for intervention)",
103-
domain=str,
104-
default=None)
105101

106102
cfg.parse_command_line(f"mpi-sppy for {cfg.module_name}")
107103

@@ -367,10 +363,10 @@ def _do_decomp(module, cfg, scenario_creator, scenario_creator_kwargs, scenario_
367363
list_of_spoke_dict.append(reduced_costs_spoke)
368364

369365
# if the user dares, let them mess with the hubdict prior to solve
370-
if cfg.hub_and_spoke_dict_callback is not None:
371-
module = sputils.module_name_to_module(cfg.hub_and_spoke_dict_callback)
366+
if hasattr(module,'hub_and_spoke_dict_callback'):
372367
module.hub_and_spoke_dict_callback(hub_dict, list_of_spoke_dict)
373368

369+
374370
wheel = WheelSpinner(hub_dict, list_of_spoke_dict)
375371
wheel.spin()
376372

0 commit comments

Comments
 (0)