From 83910aea2fe349cd5169e0b3674c1be569223387 Mon Sep 17 00:00:00 2001 From: Mark Driver <mdd31@alumni.cam.ac.uk> Date: Mon, 30 Mar 2020 20:04:22 +0100 Subject: [PATCH] update logging statements. --- phasecalculator/phasecalculatorcli.py | 18 +++++++++++++----- .../runners/phasecalculatorrunner.py | 6 ++++++ .../runners/phasexmlcreatorrunner.py | 4 ++++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/phasecalculator/phasecalculatorcli.py b/phasecalculator/phasecalculatorcli.py index d9d479a..d298363 100755 --- a/phasecalculator/phasecalculatorcli.py +++ b/phasecalculator/phasecalculatorcli.py @@ -33,13 +33,16 @@ import puresolventinformation.information as pureinf logging.basicConfig() LOGGER = logging.getLogger(__name__) -LOGGER.setLevel(logging.WARN) +LOGGER.setLevel(logging.INFO) INFO_LOGGER = logging.getLogger(__name__) INFO_LOGGER.setLevel(logging.INFO) +phasecrun.LOGGER.setLevel(logging.INFO) +phasecrun.phasexmlrun.LOGGER.setLevel(logging.DEBUG) + def main(): - """Main function run when program called. + """Run function when program called. Returns ------- @@ -49,8 +52,11 @@ def main(): """ # Create parser parser = create_phasecalculator_argparser() + LOGGER.info("created porser") # parse args args = parser.parse_args() + LOGGER.info("parsed args:") + LOGGER.info(args) return process_args(args) @@ -104,6 +110,8 @@ def process_phasecalculator(args): """ xml_filename = args.file system_collection = read_calculator_xml(xml_filename) + LOGGER.info("system collection: ") + LOGGER.info(system_collection) if args.memreq is not None: run_system_collection(system_collection, memory_req=args.memreq) else: @@ -111,7 +119,7 @@ def process_phasecalculator(args): def create_system_collection(args): - """Create SystemCollection from input arguments + """Create SystemCollection from input arguments. Parameters ---------- @@ -143,7 +151,7 @@ def create_system_collection(args): def create_output_inf( fgip_output, similarity_output, similarity_output_type, vle_output ): - """Create OutputInformation + """Create OutputInformation. Parameters ---------- @@ -168,7 +176,7 @@ def create_output_inf( def create_runtime_inf(jar_path, scratch_dir, output_dir): - """Create RuntimeInformation + """Create RuntimeInformation. Parameters ---------- diff --git a/phasecalculator/runners/phasecalculatorrunner.py b/phasecalculator/runners/phasecalculatorrunner.py index 79d8861..0fca2c0 100755 --- a/phasecalculator/runners/phasecalculatorrunner.py +++ b/phasecalculator/runners/phasecalculatorrunner.py @@ -51,14 +51,20 @@ def run_all_analysis(system_info, **kwargs): None. """ + LOGGER.info("Creating phase and solvent filename lists") phase_filename, solvent_list = create_phase_and_solvent_xml_files( system_info, **kwargs ) + LOGGER.info("Phase filename: %s", phase_filename) + LOGGER.info("Solvent filename list: %s", solvent_list) if system_info.calc_vle(): + LOGGER.info("Running VLE calc") run_vle_analysis(system_info, phase_filename, **kwargs) if system_info.calc_fgip(): + LOGGER.info("Running FGIP calc") run_fgip_analysis(system_info, solvent_list, **kwargs) if system_info.calc_similarity(): + LOGGER.info("Running similarity calc") run_similarity_analysis(system_info, solvent_list, **kwargs) diff --git a/phasecalculator/runners/phasexmlcreatorrunner.py b/phasecalculator/runners/phasexmlcreatorrunner.py index 0ab2360..bcb7d3b 100755 --- a/phasecalculator/runners/phasexmlcreatorrunner.py +++ b/phasecalculator/runners/phasexmlcreatorrunner.py @@ -57,9 +57,12 @@ def create_phase_and_solvent_files(system_info, filestem="system", **kwargs): create_scratch_dir(system_info) phase_file = None solvent_list = None + LOGGER.info("System calcs: VLE: %s, FGIP: %s, SIM: %s", system_info.calc_vle(), + system_info.calc_fgip(), system_info.calc_similarity()) if system_info.calc_vle(): phase_file = create_phase_file(system_info, filestem + "phase", **kwargs) if system_info.calc_fgip() or system_info.calc_similarity(): + LOGGER.info("Creating solvents") solvent_list = create_solvent_files(system_info, filestem + "solvent", **kwargs) return phase_file, solvent_list @@ -125,6 +128,7 @@ def create_solvent_files(system_info, filestem, **kwargs): mole_fractions_by_temp_dict = system_info.get_phase_compositions_by_temperature() ssip_filename_list = system_info.get_ssip_file_locations() solvent_list = [] + LOGGER.info("SSIP filename list: %s", ssip_filename_list) for temp_info, mole_fraction_dict_list in mole_fractions_by_temp_dict.items(): solvent_filename = create_solvent_file( mole_fraction_dict_list, -- GitLab