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 job return logging #2111

Merged
merged 2 commits into from
Mar 29, 2022
Merged

Add job return logging #2111

merged 2 commits into from
Mar 29, 2022

Conversation

jieru-hu
Copy link
Contributor

@jieru-hu jieru-hu commented Mar 25, 2022

I tried a fews ways to add the logging in hydra core without a callback. However didn't find a clean way to add the logging in both RUN and MULTIRUN mode without adding much more noise to the console.

Add logging as a callback means: 1) job return will be logged together with the rest of the application log, 2) users can opt in.

related to #2100

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 25, 2022
@jieru-hu jieru-hu force-pushed the i2100 branch 2 times, most recently from 8948e68 to 33cbcb1 Compare March 25, 2022 22:01
@jieru-hu jieru-hu requested review from Jasha10 and pixelb March 25, 2022 22:13
Copy link
Contributor

@pixelb pixelb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a callback we might be able to enable by default?
I.e. what are the disadvantages of enabling it?
Does it result in more console output?

In any case the code looks good. thanks

Comment on lines 8 to 10
import {ExampleGithubLink} from "@site/src/components/GithubLink"

<ExampleGithubLink text="Examples" to="hydra/experimental"/>
Copy link
Collaborator

@Jasha10 Jasha10 Mar 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think users might be confused when this "Examples" button redirects to the hydra/experimental directory; there are some things in that directory that are unrelated to callbacks.

What if we create a file hydra/experimental/callbacks.py that contains all the callback implementations (instead of using separate files log_job_return_callback.py and pickle_job_info_callback.py)? The ExampleGithubLink in the docs could then point to that specific file callbacks.py.
This would make the yaml files simpler too: users would write _target_: hydra.experimental.callbacks.LogJobReturnCallback instead of _target_: hydra.experimental.log_job_return_callback.LogJobReturnCallback.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great idea! Since this would mean touching the PickleJobCallback as well, I will create that PR as a follow up.
For now I will remove this change.

@Jasha10
Copy link
Collaborator

Jasha10 commented Mar 27, 2022

Is this a callback we might be able to enable by default? I.e. what are the disadvantages of enabling it? Does it result in more console output?

It does result in more console output. Here is an example:

$ cd examples/tutorials/basic/running_your_hydra_app/5_basic_sweep
$ python my_app.py -m db=mysql,postgresql '+hydra.callbacks.foo._target_=hydra.experimental.log_job_return_callback.LogJobReturnCallback' hydra.job.chdir=true
[2022-03-27 09:14:38,045][HYDRA] Launching 4 jobs locally
[2022-03-27 09:14:38,045][HYDRA]        #0 : db=mysql db.timeout=5
driver=mysql, timeout=5
[2022-03-27 09:14:38,141][hydra.experimental.log_job_return_callback][INFO] - Succeeded with return value: None
[2022-03-27 09:14:38,142][HYDRA]        #1 : db=mysql db.timeout=10
driver=mysql, timeout=10
[2022-03-27 09:14:38,233][hydra.experimental.log_job_return_callback][INFO] - Succeeded with return value: None
[2022-03-27 09:14:38,233][HYDRA]        #2 : db=postgresql db.timeout=5
driver=postgresql, timeout=5
[2022-03-27 09:14:38,323][hydra.experimental.log_job_return_callback][INFO] - Succeeded with return value: None
[2022-03-27 09:14:38,324][HYDRA]        #3 : db=postgresql db.timeout=10
driver=postgresql, timeout=10
[2022-03-27 09:14:38,414][hydra.experimental.log_job_return_callback][INFO] - Succeeded with return value: None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants