wepy.reporter.dashboard module¶
WIP: Reporter that produces a text file that gives high level information on the progress of a simulation.
-
class
wepy.reporter.dashboard.
DashboardReporter
(resampler_dash=None, runner_dash=None, bc_dash=None, **kwargs)[source]¶ Bases:
wepy.reporter.reporter.ProgressiveFileReporter
A text based report of the status of a wepy simulation.
This serves as a container for different dashboard components to go inside.
- Parameters
resampler_dash –
runner_dash –
bc_dash –
-
FILE_ORDER
= ('dashboard_path',)¶ Specify an ordering of file paths. Should be customized.
-
SUGGESTED_EXTENSIONS
= ('dash.org',)¶ Suggested extensions for file paths for use with the automatic reparametrization feature. Should be customized.
-
SIMULATION_SECTION_TEMPLATE
= '\nInit Datetime: {{ init_date_time }}\nLast write Datetime: {{ curr_date_time }}\n\nTotal Run time: {{ total_run_time }} s\n\nLast Cycle Index: {{ last_cycle_idx }}\nNumber of Cycles: {{ n_cycles }}\n\n** Walkers Summary\n\n{{ walker_cycle_summary_table }}\n\n'¶
-
PERFORMANCE_SECTION_TEMPLATE
= '\nAverage Cycle Time: {{ avg_cycle_time }}\n\n{% if avg_runner_time %}Average Runner Time: {{ avg_runner_time }}{% else %}{% endif %}\n{% if avg_bc_time %}Average Boundary Conditions Time: {{ avg_bc_time }}{% else %}{% endif %}\n{% if avg_resampling_time %}Average Resampling Time: {{ avg_resampling_time }}{% else %}{% endif %}\n\n\nWorker Avg. Segment Times:\n\n{{ worker_avg_segment_time }}\n\n** Cycle Performance Log\n\n{{ cycle_log }}\n\n** Worker Performance Log\n\n{{ performance_log }}\n\n\n'¶
-
DASHBOARD_TEMPLATE
= '* Simulation\n\n{{ simulation }}\n\n{% if resampler %}* Resampler{% else %}{% endif %}\n{% if resampler %}{{ resampler }}{% else %}{% endif %}\n\n{% if boundary_condition %}* Boundary Condition{% else %}{% endif %}\n{% if boundary_condition %}{{ boundary_condition }}{% else %}{% endif %}\n\n{% if runner %}* Runner{% else %}{% endif %}\n{% if runner %}{{ runner }}{% else %}{% endif %}\n\n* Performance\n\n{{ performance }}\n\n'¶
-
init
(**kwargs)[source]¶ Construct a ProgressiveFileReporter.
This is exactly the same as the FileReporter.
- Parameters
See also
-
report
(**kwargs)[source]¶ Given data concerning the main simulation components state, perform I/O operations to persist that data.
Void method for reporter base class.
Reporters can expect to have the following key word arguments passed to them during a simulation by the sim_manager.
- Parameters
cycle_idx (int) –
new_walkers (list of Walker objects) – List of walkers that were produced from running their dynamics by the runner.
warp_data (list of dict of str : value) – List of dict-like records for each warping event from the last cycle.
bc_data (list of dict of str : value) – List of dict-like records specifying the changes to the state of the boundary conditions in the last cycle.
progress_data (dict str : list) – A record indicating the progress values for each walker in the last cycle.
resampling_data (list of dict of str : value) – List of records specifying the resampling to occur at this cycle.
resampler_data (list of dict of str : value) – List of records specifying the changes to the state of the resampler in the last cycle.
n_segment_steps (int) – The number of dynamics steps that were completed in the last cycle
worker_segment_times (dict of int : list of float) – Mapping worker index to the times they took for each segment they processed.
cycle_runner_time (float) – Total time runner took in last cycle.
cycle_bc_time (float) – Total time boundary conditions took in last cycle.
cycle_resampling_time (float) – Total time resampler took in last cycle.
resampled_walkers (list of Walker objects) – List of walkers that were produced from the new_walkers from applying resampling and boundary conditions.
-
DEFAULT_MODE
= 'x'¶ The default mode to set for opening files if none is specified (create if doesn’t exist, fail if it does.)
-
DEFAULT_SUGGESTED_EXTENSION
= 'report'¶ The default file extension used for files during dynamic reparametrization, if none is specified
-
MODES
= ('x', 'w', 'w-', 'r', 'r+')¶ Valid modes accepted for files.
-
SUGGESTED_FILENAME_TEMPLATE
= '{config}{narration}{reporter_class}.{ext}'¶ Template to use for dynamic reparametrization of file path names.
The fields in the template are:
config : indicator of the runtime configuration used
narration : freeform description of the instance
- reporter_classthe name of the class that produced the
output. When no specific name is given for a file report generated from a reporter this is used to disambiguate, along with the extension.
ext : The file extension, for multiple files produced from one reporter this should be sufficient to disambiguate the files.
The ‘config’ and ‘narration’ should be the same across all reporters in the same simulation manager, and the ‘narration’ is considered optional.
-
_validate_mode
(mode)¶ Check if the mode spec is a valid one.
-
cleanup
(**kwargs)¶ Teardown routines for the reporter at the end of the simulation.
Use to cleanly and safely close I/O connections or other cleanup I/O.
Use to close file descriptors, database connections etc.
Reporters can expect to have the following key word arguments passed to them during a simulation by the sim_manager.
- Parameters
runner (Runner object) – The runner at the end of the simulation
work_mapper (WorkeMapper object) – The work mapper at the end of the simulation
resampler (Resampler object) – The resampler at the end of the simulation
boundary_conditions (BoundaryConditions object) – The boundary conditions at the end of the simulation
reporters (list of Reporter objects) – The list of reporters at the end of the simulation
-
property
file_path
¶ For single file path reporters the file path to that file spec.
-
property
file_paths
¶ The file paths for this reporter, in order.
-
property
mode
¶ For single file path reporters the mode of that file.
-
property
modes
¶ The modes for the files, in order.
-
reparametrize
(file_paths, modes)¶ Set the file paths and modes for all files in the reporter.
- Parameters
file_paths (list of str) – New file paths for each file, in order.
modes (list of str) – New modes for each file, in order.
-
set_mode
(file_idx, mode)¶ Set the mode for a single indexed file.
-
class
wepy.reporter.dashboard.
ResamplerDashboardSection
(resampler=None, name=None, **kwargs)[source]¶ Bases:
object
-
RESAMPLER_SECTION_TEMPLATE
= '\nResampler: {{ name }}\n'¶
-
-
class
wepy.reporter.dashboard.
RunnerDashboardSection
(runner=None, name=None, **kwargs)[source]¶ Bases:
object
-
RUNNER_SECTION_TEMPLATE
= '\nRunner: {{ name }}\n'¶
-
-
class
wepy.reporter.dashboard.
BCDashboardSection
(bc=None, discontinuities=None, name=None, **kwargs)[source]¶ Bases:
object
-
BC_SECTION_TEMPLATE
= '\n\nBoundary Condition: {{ name }}\n\nTotal Number of Dynamics segments: {{ total_n_walker_segments }}\n\nTotal Number of Crossings: {{ total_crossings }}\n\nCumulative Boundary Crossed Weight: {{ total_crossed_weight }}\n\n** Warping Log\n\n{{ warping_log }}\n\n'¶
-
WARP_RECORD_COLNAMES
= ('cycle_idx', 'walker_idx', 'weight', 'target_idx', 'discontinuous')¶
-