m3dev / gokart

Gokart solves reproducibility, task dependencies, constraints of good code, and ease of use for Machine Learning Pipeline.
https://gokart.readthedocs.io/en/latest/
MIT License
318 stars 57 forks source link

change default loglevel of gokart.build as ERROR #249

Closed Hi-king closed 3 years ago

Hi-king commented 3 years ago

As issued in #211 , gokart was hard to debug because of less fexible logging. With #212 log_level arg is introduced in gokart.build . In this PR, I suggest changing default value of this log_level arg.

Of course I know there might be discussion about pros/cons of lower loglevel. But I believe following drawback is critical one especially for first-time user of gokart.

Problem

The major drawback of suppressing logs are that we can't see traceback of failed tasks (So we need to run tasks again with lower loglevel after facing failed tasks)

class Task(gokart.TaskOnKart):
    def run(self):
        raise Exception()
gokart.build(Task(), log_level=logging.CRITICAL)
GokartBuildError:
===== Luigi Execution Summary =====

Scheduled 1 tasks of which:
* 1 failed:
- 1 Task(...)

This progress looks :( because there were failed tasks

===== Luigi Execution Summary =====
---------------------------------------------------------------------------
GokartBuildError                          Traceback (most recent call last)
...

Solution?

With log_level=ERROR,

gokart.build(Task(), log_level=logging.ERROR)

we can see more comprehensive messages.

ERROR: [pid 7101] Worker Worker(salt=857636714, workers=1, host=m3-2019mac58, username=keisuke.ogaki, pid=7101) failed    Task()
Traceback (most recent call last):
  File "/Users/keisuke.ogaki/.pyenv/versions/anaconda3-5.3.1/lib/python3.7/site-packages/luigi/worker.py", line 191, in run
    new_deps = self._run_get_new_deps()
  File "/Users/keisuke.ogaki/.pyenv/versions/anaconda3-5.3.1/lib/python3.7/site-packages/luigi/worker.py", line 133, in _run_get_new_deps
    task_gen = self.task.run()
  File "<ipython-input-5-8523995f898f>", line 3, in run
    raise Exception()
Exception
GokartBuildError:
===== Luigi Execution Summary =====

Scheduled 1 tasks of which:
* 1 failed:
- 1 Task(...)

This progress looks :( because there were failed tasks

===== Luigi Execution Summary =====
---------------------------------------------------------------------------
GokartBuildError                          Traceback (most recent call last)
...
mski-iksm commented 3 years ago

LGTM!

mski-iksm commented 3 years ago

@Hi-king I've merged this PR. Thank you for the contribution.