-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Verbose #218
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
Verbose #218
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, thank you very much for this contribution.
Just two things :
-
I tested it and passed
--ffpmeg 0,--ffpmeg -8,--ffpmeg 16
as flag (since these values are choices on the flag --ffmpeg you added), and it didn't change anything. As I'm not familiar with that at all, it would be nice if you could enlight me on the reasons. -
Suggestion : Why not adding , in addition to --verbose flag, a flag that would disable progressbar ? Here, progressbar is disabled only when DEBUG or INFO is not enabled, which is cool but it woulc be better if we could have debug logs without progress bar if wanted. I would like to have other's opinion on this point.
REMINDER : Please do not merge it until @leotrs approved, as it touches config and I want to be sure that it this done the correct way. |
manim/constants.py
Outdated
VERBOSE_CHOICES = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] | ||
VERBOSE_FFMPEG_MAP = { | ||
"DEBUG": "error", | ||
"INFO": "error", | ||
"WARNING": "error", | ||
"ERROR": "error", | ||
"CRITICAL": "fatal", | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
VERBOSE_FFMPEG_MAP = {
 "DEBUG": "error",
 "INFO": "error",
 "WARNING": "error",
 "ERROR": "error",
 "CRITICAL": "fatal",
}
VERBOSE_CHOICES = VERBOSE_FFMPEG_MAP.keys()
manim/default.cfg
Outdated
# -q, --quiet | ||
quiet = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should delete this, yes?
manim/scene/scene.py
Outdated
disable = not file_writer_config["progress_bar"] | ||
time_progression = ProgressDisplay( | ||
times, total=n_iterations, | ||
leave=file_writer_config['leave_progress_bars'], | ||
ascii=True if platform.system() == 'Windows' else None | ||
ascii=True if platform.system() == 'Windows' else None, | ||
disable=disable, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: just do time_progression = ProgressDisplay(..., disable=not file_writer_config["progress_bar"], ...)
.
manim/utils/config_utils.py
Outdated
quiet = getattr(args, "quiet") | ||
if not quiet and default.getboolean("quiet", None) is not None: | ||
quiet = default.getboolean("quiet") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit confusing to me to have both verbose
and quiet
flags. Is there any way to keep only one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes absolutely quiet
is just a shortcut for verbose CRITICAL
. I thought it could be easier for a user that wants almost no output to remember quiet
than verbose CRITICAL
. However it does add an additional option so if it is confusing I'll remove it.
manim/utils/config_utils.py
Outdated
@@ -122,6 +121,27 @@ def _parse_file_writer_config(config_parser, args): | |||
[fw_config["save_last_frame"], fw_config["from_animation_number"]] | |||
) | |||
|
|||
# Read in the log level |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: "parse the verbose and quiet flags to read in the log level".
All other comments indicate which CLI flags they are dealing with, so this one should too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okey, I'll keep it in mind when modifying.
manim/utils/config_utils.py
Outdated
verbose = getattr(args, "verbose") | ||
verbose = "CRITICAL" if verbose is None and quiet else verbose | ||
verbose = default["verbose"] if verbose is None else verbose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I can follow this logic easily. Also, it seems that one of the conditionals here is catching the case when args
doesn't have a verbose
attribute, which presumably happens when the user doesn't pass the verbose
flag. This is not how we want to handle things.
The config system is meant to be used as follows: if the user passes a value through CLI flag, we use that value. If they don't, we use whatever value is in the library-wide config file default.cfg
. So the logic should be something like this:
verbose = args.verbose if args.verbose is not None else default["verbose"]
which takes just one line. Does this make sense? Does this yield the same logic as what you wrote before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does yield the same logic except if verbose
is not passed in the CLI flags but if quiet
is (or if quiet
is in the default.cfg
). If the flag quiet
flag is removed I'll write it as you put it.
manim/utils/config_utils.py
Outdated
"-v", "--verbose", | ||
type=str, | ||
help="Verbosity level. Also changes the ffmpeg log level unless the latter is specified", | ||
metavar="loglevel", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: what is a metavar? What is the difference from dest
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think metavar
is the display name when asking details through --help
. On the other hand dest
is the name of the attribute that will be generated.
This means that in the help message it will print --verbose loglevel
but the attribute will be accessed through args.verbose
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would strongly prefer if the print message and the attribute be called the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okey, I removed the metavar attribute to keep the default behavior which is to show in the help message all possible values.
manim/utils/config_utils.py
Outdated
type=str, | ||
help="Display the progress bar", | ||
metavar="on/off", | ||
choices=["on", "off"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: change to Boolean.
Something I don't like about this PR is that it's adding three new CLI flags. I think some of them can be just config options. For example, I don't think we need a flag to switch between showing or not showing the progress bar. What do you all think? |
I strongly disagree on the flag for the progress bar, it would be a useful flag. Nevertheless, I think that ffmpeg_vebose shouldn't be a flag, maybe. |
I'll remove then the flag quiet and keep ffmpeg_loglevel only in config file and not in the CLI flags. |
I also removed the fact that changing the |
@azarzadavila sounds good to me! Can you please resolve the conflicts before we can merge this? |
Also, when this is merged please remember to close #107 |
manim/utils/config_utils.py
Outdated
"-v", "--verbose", | ||
type=str, | ||
help="Verbosity level. Also changes the ffmpeg log level unless the latter is specified", | ||
metavar="loglevel", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would strongly prefer if the print message and the attribute be called the same.
I also see there is now a new attribute |
@Aathish04 and @naveen521kk can you please comment on how this relates to #180? Thanks. |
No, those things in |
I think @naveen521kk is in a better position to answer what changing |
Sounds good! Now the problem will be that we will now have two flags |
I agree the names are confusing between those two flags. I see |
@naveen521kk could you tell us exactly what |
Proposal to solve #107 .
This PR introduces two CLI args :
verbose
: string which controls the global verbosityffmpeg
: int which controls the log level of ffmpegI think they are mainly four sources of output when executing manim :
I suggest to use the levels of logger as the main parameter, which can be in : DEBUG, INFO, WARNING, ERROR, CRITICAL.
The offered solution is by default to pass the global config of verbose to the logger and then to map this config for the other sources of outputs.
Namely,
However as an user may be interested over more control for ffmpeg, one can also pass the arg
--ffmpeg
to override the mapping.I also kept the
--quiet
option equivalent to--verbose CRITICAL
.The three discussed options can be passed on command arguments or on default.cfg but the presence of
ffmpeg
andquiet
in the configuration file is not mandatory.