WIP : output_management - #54
Open
bilalderouich wants to merge 5 commits into
Open
Conversation
pradal
reviewed
May 9, 2018
| # Ne marche que si : | ||
| # Le log_mere contient toutes les variables a transmettre, dont les dictionnaires et leurs indices. | ||
| for var in self.df: | ||
| var.append(kwargs[var]) |
Contributor
There was a problem hiding this comment.
self.df[var].append(kwargs.get(var, default_value))
pradal
reviewed
May 9, 2018
|
|
||
| def log(self, **kwds): | ||
| """log each logger """ | ||
| if self.loggers is not None: |
Contributor
There was a problem hiding this comment.
How do you dispatch the log to the different loggers?
pradal
reviewed
May 9, 2018
| def log_Apex_Sirius(Apex_Sirius_dico_df, day, current_temperature, _Tempcum, duree_du_jour, latitude, DOY, StA): | ||
| apex = Apex_Sirius_dico_df | ||
|
|
||
|
|
Contributor
There was a problem hiding this comment.
def log_Apex_Sirius(...):
logger = get_global_logger()
logger.log(name='ApexSirius',
Elapsed_time=day,
Temperature=current_temperature, ...)
Contributor
There was a problem hiding this comment.
_LOGGER = None
def get_global_logger():
if _LOGGER is None:
global _LOGGER
_LOGGER = Logger()
return _LOGGER
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
isolate the output management in a external module in several steps.
"The output management means saving the simulation outputs at each stage of the simulation including global variables and simulation status"
gather the logs ( or trace of execution) just before the produce to extract them from if and else in order to simplify better. This will be done in a separate branch and test to be merge in master rapidly
make a first move of everything concerning the outputs management in an external file output_manager (copy-paste only). test this branch with global test.
Think of new design patterns to resume the outputs management like same name of attributs (1) or a ordered dict which does the changes for keys and values.
make loger converge to take as input only module data objects (Bud, ...). To do so, create a Logger class that can be called within walter.lpy to save values of updated global variables (DOY, Temperature,GAI ...) and then used by log member function dedicated to log the different modules only with module as arg.
see whether output names could match instance member names to simplify output log functions. Meantime add a {output_name: member_name} mapping to modules to automate the job of the log functions
(1) exemple = Temp_cum -> tempcum (not the same)
see whether the maping is really required or if alternatively all (instead of user defined for almost all) instance variable should be loged, to increase robustness of log function