Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add verbose argument to Chain for logging of steps in chain #274

Open
mtb-za opened this issue Jun 25, 2020 · 2 comments
Open

Add verbose argument to Chain for logging of steps in chain #274

mtb-za opened this issue Jun 25, 2020 · 2 comments
Labels
enhancement Idea or request for a new feature

Comments

@mtb-za
Copy link

mtb-za commented Jun 25, 2020

Description of the desired feature

Add an optional parameter to allow for Chain to provide an update on where it is during fitting. It will print log messages (and collect execution times?) if True, with a default to False. The idea is that for long-running processing chains, one can see what is most time-consuming, as well as get information that it is continuing to run in the background. It will also allow for someone to provide the logs along with results, if needed, providing an audit trail outside the script used to create a given output.

At minimum, this would require importing logging and then providing an appropriate logging level (probably INFO?) in the loop that calls each step. That would make the Chain.fit method look something like the following:

    args = coordinates, data, weights
    for _, step in self.steps:
        args = step.filter(*args)
        info(f'{step} completed.'})
    return self

It is also possible to add some additional support for timing of how long each step takes to run. Something similar could be added to Chain.predict, but that is usually much faster, so might be less useful there.

Possible downsides are that the code itself becomes less clean, since there are now additional things being added that will clutter existing methods.

Are you willing to help implement and maintain this feature? Yes

@welcome
Copy link

welcome bot commented Jun 25, 2020

👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible.

You might also want to take a look at our Contributing Guide and Code of Conduct.

@leouieda leouieda added the enhancement Idea or request for a new feature label Jun 25, 2020
@leouieda
Copy link
Member

@mtb-za thanks for opening the issue 👍 Yep, I guess putting some log messages and capturing execution time with time.time() calls would be more than good enough. Some messages to include:

  • Initial message saying that Chain is being run
  • step {name}... Done ({time} s) (the name is part of the chain definition)
  • Final message saying the entire chain is done and reporting total time.

To test this, see the Pooch tests. They include a context manager to capture the log messages and verify that they are running. It would be fine to copy that to Verde.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Idea or request for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants