Skip to content

Add logger examples in eval script#59

Open
gchhablani wants to merge 2 commits into
Cloud-CV:masterfrom
gchhablani:patch-1
Open

Add logger examples in eval script#59
gchhablani wants to merge 2 commits into
Cloud-CV:masterfrom
gchhablani:patch-1

Conversation

@gchhablani

Copy link
Copy Markdown
Contributor

This PR adds examples for logger in evaluation script and adds some suggestions in the README.

Comment thread README.md

11. To update the challenge on EvalAI, make changes in the repository and push on `challenge` branch and wait for the build to complete.

### Printing and Logging in Evaluation Script

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Change to Logging in Evaluation Script

Comment thread evaluation_script/main.py
Comment on lines +9 to +17
eval_script_logger = logging.getLogger(name='eval_script')
eval_script_logger.setLevel(logging.DEBUG)

handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
eval_script_logger.addHandler(handler)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you create a new method called get_logger in this script and use that to get the logger here?

Comment thread README.md
### Printing and Logging in Evaluation Script
`print` statements will show up on the console directly.
In order to get `logging` statements from the evaluation script, ensure that the logger has a `stdout` handler added. We redirect the output from `stdout` to the submission workers console.
An example logger can be created like so:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Change to Here's an example of setting up a logger:

Comment thread README.md
eval_script_logger.addHandler(handler)
```

Then, we can use this logger anywhere in the script and the corresponding level logs will show up in the output.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Chnage to Once set up, you can use the logger anywhere in the evaluation script to display logs on EvalAI manage tab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants