src.output_manager module¶
Implementation of the OutputManager plugin, which templates HTML and organizes the PODs’ output files.
-
class
src.output_manager.AbstractOutputManager(case)[source]¶ Bases:
abc.ABCAbstract interface for any OutputManager.
-
src.output_manager.html_templating_dict(pod)[source]¶ Returns the dict of recognized substitutions to perform in HTML templating.
-
class
src.output_manager.HTMLSourceFileMixin[source]¶ Bases:
objectConvienience method to define location of HTML templates in one place.
-
property
CASE_TEMP_HTML¶ Temporary top-level html file for case that gets appended to as PODs finish.
-
html_src_file(file_name)[source]¶ Returns full path to a framework-supplied HTML template file_name or other part of the output page.
-
__init__()¶ Initialize self. See help(type(self)) for accurate signature.
-
property
-
class
src.output_manager.HTMLPodOutputManager(pod, output_mgr)[source]¶ Bases:
src.output_manager.HTMLSourceFileMixinPerforms cleanup tasks when the POD has finished running.
-
__init__(pod, output_mgr)[source]¶ Copy configuration info from POD object.
- Parameters
( (pod) – class:`~src.diagnostic.Diagnostic): POD which generated the output files being processed.
output_mgr – OutputManager plugin handling the overall processing of output files from all PODs.
-
make_pod_html()[source]¶ Perform templating on POD’s html results page(s).
Wraps
append_html_template(). Looks for all html files in$POD_CODE_DIR, templates them, and copies them to$POD_WK_DIR, respecting subdirectory structure (seerecursive_copy()).
-
convert_pod_figures(src_subdir, dest_subdir)[source]¶ Convert all vector graphics in
$POD_WK_DIR/src_subdir to .png files using ghostscript (included in the _MDTF_base conda environment).All vector graphics files (identified by extension) in any subdirectory of
$POD_WK_DIR/src_subdir are converted to .png files by running ghostscript in a subprocess. Afterwards, any bitmap files (identified by extension) in any subdirectory of$POD_WK_DIR/src_subdir are moved to$POD_WK_DIR/dest_subdir, preserving subdirectories (viarecursive_copy().)- Parameters
src_subdir – Subdirectory tree of
$POD_WK_DIRto search for vector graphics files.dest_subdir – Subdirectory tree of
$POD_WK_DIRto move converted bitmap files to.
-
cleanup_pod_files()[source]¶ Copy and remove remaining files to
$POD_WK_DIR.In order, this 1) copies any bitmap figures in any subdirectory of
$POD_OBS_DATAto$POD_WK_DIR/obs(needed for legacy PODs without digested observational data), 2) removes vector graphics if requested, 3) removes netCDF scratch files in$POD_WK_DIRif requested.Settings are set at runtime, when
ConfigManageris initialized.
-
make_output()[source]¶ Top-level method to make POD-specific output, post-init. Split off into its own method to make subclassing easier.
In order, this 1) creates the POD’s HTML output page from its included template, replacing
CASENAMEand other template variables with their current values, and adds a link to the POD’s page from the top-level HTML report; 2) converts the POD’s output plots (in PS or EPS vector format) to a bitmap format for webpage display; 3) Copies all requested files to the output directory and deletes temporary files.
-
property
CASE_TEMP_HTML¶ Temporary top-level html file for case that gets appended to as PODs finish.
-
POD_HTML(pod)¶ Path to pod’s HTML output file in the working directory.
-
html_src_file(file_name)¶ Returns full path to a framework-supplied HTML template file_name or other part of the output page.
-
static
pod_html_template_file_name(pod)¶ Name of the HTML template file for POD pod.
-
write_data_log_file()¶ Writes *.data.log file to output containing info on data files used.
-
-
class
src.output_manager.HTMLOutputManager(case)[source]¶ Bases:
src.output_manager.AbstractOutputManager,src.output_manager.HTMLSourceFileMixinOutputManager that collects all the PODs’ output as HTML pages. Currently the only value for the OutputManager plugin, selected by default.
Instantiates
HTMLPodOutputManagerobjects to handle output of each POD.-
append_result_link(pod)[source]¶ Update the top level index.html page with a link to this POD’s results.
This simply appends one of two html fragments to index.html:
src/html/pod_result_snippet.htmlif the POD completed successfully, orsrc/html/pod_error_snippet.htmlif an exception was raised during the POD’s setup or execution.
-
verify_pod_links(pod)[source]¶ Check for missing files linked to from POD’s html page.
See documentation for
LinkVerifier. This method callsLinkVerifierto check existence of all files linked to from the POD’s own top-level html page (after templating). If any files are missing, an error message listing them is written to the run’sindex.htmlpage (located insrc/html/pod_missing_snippet.html).
-
backup_config_files()[source]¶ Record user input configuration in a file named
config_save.jsonfor rerunning.
-
make_output()[source]¶ Top-level method for doing all output activity post-init. Spun into a separate method to make subclassing easier.
-
property
CASE_TEMP_HTML¶ Temporary top-level html file for case that gets appended to as PODs finish.
-
POD_HTML(pod)¶ Path to pod’s HTML output file in the working directory.
-
html_src_file(file_name)¶ Returns full path to a framework-supplied HTML template file_name or other part of the output page.
-
static
pod_html_template_file_name(pod)¶ Name of the HTML template file for POD pod.
-
write_data_log_file()¶ Writes *.data.log file to output containing info on data files used.
-