Merge lp:~linaro-validation/lava-core/main into lp:lava-core
Status: | Merged |
---|---|
Merged at revision: | 13 |
Proposed branch: | lp:~linaro-validation/lava-core/main |
Merge into: | lp:lava-core |
Prerequisite: | lp:~zyga/lava-core/scratch |
Diff against target: |
375 lines (+352/-1) 2 files modified
lava/core/main.py (+346/-0) setup.py (+6/-1) |
To merge this branch: | bzr merge lp:~linaro-validation/lava-core/main |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Linaro Validation Team | Pending | ||
Review via email: mp+105000@code.launchpad.net |
Description of the change
This branch adds the main module (as in "main" function in C). Please have a look at the output of $ lava-dev --help, if you can and suggest changes to the content displayed there.
NOTE: There is an unrelated code remove from lava.commands module that just need to wait a little longer but was not spotted before (in the demo -> trunk transplant that I'm doing). That code works, it just needs dependencies that come later.
Add lava.core.main
The .main module defines one, relatively big, lava.commands.
subclass, LavaDispatcher, that is specialized for being the entry point
to all of lava form the shell. There are a number of customizations as
compared to the plain Dispatcher class.
There is a custom argument parser, as produced by construct_parser(), that has
a lot of additional options for debugging and logging. There is a set of
methods that conditionally enable plain logging, verbose logging,
exception/crash logging, and developer-debug logging. Those are all called from
the private method _adjust_
API)
There way commands are processed, via dispatch(), is customized to handle
various exceptions, including CommandError which is considered normal (not an
application crash) and KeyboardInterrupt (which, by default, is not producing a
backtrace). This function also knows how to spawn pdb, the python debugger, for
a post-mortem session, if requested.
Lastly there is a helper method save_history_now() that exists there to work
around scratch space going away by the time the command finishes (as typically
commands manage their scratch space internally). This part could be changed so
that commands get a scratch space from the Dispatcher (and thus extend the
lifetime of temporary files long enough so that the dispatcher gets to save
global history, including any attachments, just before discarding the top-level
Scratch object)
Hi. This seems mostly fine. Two comments:
1) I don't think the help for -D is quite right: yes it enables DEBUG on the root logger, but the debug output only goes to ~/.cache/ lava/logs/ debug.log right? The way the help is written I think I expected it to be on stdout/stderr. I think the behaviour you have is better, can you update the description.
2) When I run lava-dev --help, I see this: http:// people. linaro. org/~mwh/ lava-dev- help.png -- all that epilog stuff is not what I want to see! Compare bzr --help or git --help. It's good information and should be accessible somewhere, but maybe it should be somewhere else? I don't know where. bzr has 'topics' -- bzr help topics -- maybe something like that?