-
Notifications
You must be signed in to change notification settings - Fork 388
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
new storage #717
new storage #717
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.
Some initial comments, not a throughout review, since it is still work in progress.
api/report_viewer_server.thrift
Outdated
// store checker run related data to the database | ||
// by default updates the results if name was already found | ||
// using the force flag removes existing analysis results for a run | ||
i64 addCheckerRun( |
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.
The comments should be full sentences.
Does the force parameter make sense in the new model? Maybe it should be removed?
api/report_viewer_server.thrift
Outdated
4: bool force) | ||
throws (1: shared.RequestFailed requestError), | ||
|
||
bool replaceConfigInfo( |
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.
Since the whole run is stored again in incremental mode, maybe this API call no longer makes sense.
@@ -22,6 +21,7 @@ | |||
from libcodechecker.analyze.analyzers import result_handler_clang_tidy | |||
from libcodechecker.analyze.analyzers import result_handler_plist_to_db | |||
from libcodechecker.analyze.analyzers import result_handler_plist_to_stdout | |||
from libcodechecker.cmd.cmd_line_client import setup_client |
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 is a pretty strange dependency for this module.
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.
setup_client
handles authentication and creates the local Thrift endpoint that can be used (after an optional authentication, if needed) to transmit data.
I would definitely introduce, akin to the other imports like this, a notice:
# TODO: This is a cross-subpackage reference.
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.
Or maybe such code should be pulled out from the cmd_line_client into a separate helper module to avoid layering violations.
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.
That's why I'd go with introducing a TODO
at this point. There are a lot of such TODO
s that are to be handled later on. I would like this pull request to be minimal in terms of changes related to the new storage system, for review and history's sake.
Cross-package imports are another concern, they can be refactored out in a batch.
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.
In these scenarios I am more fond of having a separate pull request to pull this code out and rebase this one after that one is accepted, to avoid the excess amount of TODOs.
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 I know this is not the way it should be handled but I did not wanted to do more refactoring during the development and importing this way was easy to get the functionality.
I've factored out to an api_client
package which can be used by the command line client and the store.
self.buildaction.analyzer_type, | ||
source_file_name) | ||
|
||
assert self.analyzer_returncode == 0 |
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.
Maybe assert is not the best way to handle the error here. The return code is not zero is not due to a programming error. It might be a configuration error.
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.
Actually after splitting up the analyze and store functionality the analyzer return code is set in store.py which is not connected to the actual analysis.
Checking this value with the new setup is not necessary.
README.md
Outdated
|
||
### Start a web server | ||
|
||
Start a CodeChecker web and storage server in another terminal or as a background process. By default it will listen on `localhost:8001' |
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.
Sentence is not terminated.
api/report_viewer_server.thrift
Outdated
1: string command, | ||
2: string name, | ||
3: string version, | ||
4: bool force) |
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.
In general, please normalise the style of this file. At some places, the closing )
of the argument list is newline, in some cases (like this one), it is not.
@@ -279,6 +285,93 @@ service codeCheckerDBAccess { | |||
2: i64 new_run_id, | |||
3: DiffType diff_type, | |||
4: ReportFilterList reportFilters) | |||
throws (1: shared.RequestFailed requestError) | |||
throws (1: shared.RequestFailed requestError), |
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.
Does calling this file report_viewer_server.thrift
proper anymore? It integrates multiple functionality. Maybe report_server.thrift
?
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.
☑️ This has been done, just GitHub is not picking it up. 😉
api/report_viewer_server.thrift
Outdated
|
||
|
||
|
||
|
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'd rather, though, introduce some comments that separate the functionality handled by this service.
docs/user_guide.md
Outdated
@@ -86,6 +87,12 @@ _CodeChecker_. It analyzes your project and stores the reported code defects | |||
in a database, which can be viewed in a Web Browser later on (via `CodeChecker | |||
server`). | |||
|
|||
With the server command start the server where the results will be stored and |
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 somehow merge this with the previous paragraph. CodeChecker server
is mentioned twice.
libcodechecker/libhandlers/store.py
Outdated
@@ -100,6 +118,20 @@ def add_arguments_to_parser(parser): | |||
"the '--name' parameter given to 'codechecker-" | |||
"analyze' will be used, if exists.") | |||
|
|||
parser.add_argument('--host', |
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 introduce an argument_group
for these arguments and explain that they are used to specify where the resultes are store
d.
libcodechecker/libhandlers/check.py
Outdated
@@ -152,6 +152,20 @@ def add_arguments_to_parser(parser): | |||
"the '--name' parameter given to 'codechecker-" | |||
"analyze' will be used, if exists.") | |||
|
|||
parser.add_argument('--host', |
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.
(Same as comment in store.py
.)
libcodechecker/libhandlers/store.py
Outdated
default='localhost', | ||
help="CodeChecker server host.") | ||
|
||
parser.add_argument('--port', |
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.
CodeChecker server
and CodeChecker cmd
has -p
as shorthand for --port
.
8127d19
to
395d679
Compare
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.
Very minor stuff. Otherwise, the code looks good.
I'll come up with better help messages, though.
LOG.critical("No authentication methods were reported by the server " | ||
"that this client could support.") | ||
sys.exit(1) | ||
login = 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.
Statement can be simplified: login = 'logout' in args
. And then the variable can be inlined into the function call.
from libcodechecker import suppress_file_handler | ||
from libcodechecker.api_client.client import setup_client |
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.
Minor thing, but I don't like the package name for this. We should make it somehow inline with the not-subcommand-related libcodechecker subfolders, like libauth
or libhandlers
.
Maybe it could go straight into libauth
? Or libclient
? Something with lib
on the beginning of it.
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 choose the libclient
name.
@@ -11,6 +11,7 @@ | |||
import unittest | |||
|
|||
from codeCheckerDBAccess.ttypes import ReportFilter | |||
from shared.ttypes import SuppressBugData |
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.
Is this import used?
@@ -12,6 +12,7 @@ | |||
import random | |||
import string | |||
import unittest | |||
import base64 |
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.
Import name alphabetical order violated.
189814a
to
5307da2
Compare
@gyorb There is an issue. |
@whisperity the login problem should be fixed now |
55f1a18
to
f1aadbf
Compare
|
|
||
if auth_token and handshake.sessionStillActive: | ||
LOG.info("You are already logged in.") | ||
return |
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.
This early return prevents logout.
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.
Fixed this.
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.
Apart from the --logout
issue mentioned earlier (that was not made broken in the current changeset, it seems it was broken and not triaged earlier!) and a little comment, looking good. 😉
run_id) | ||
|
||
elif buildaction.analyzer_type == CLANG_TIDY: | ||
res_handler = result_handler_clang_tidy.ClangTidyPlistToDB( |
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.
Removing this distintiction here made result_handler_clang_tidy.ClangTidyPlistToDB
an obsolete class. Is this intended?
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 the storing of plist files to the database should not depend on the analyzer which generated it.
This functionality should be refactored so that there should be only one plist to database handler.
I did not wanted to increase the size of this pull request with this refactoring. It should be a separate development.
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.
Oh, yeah, one more thing: We should introduce a simple test case somewhere that covers (maybe tests/functional/authentication
is the best place for this?) getting an error if store is called with a server and without authentication.
One server should handle all of the requests to store and view the results. * merge report server api and implementation into the report viewer * only one common server is started to store and view the results * authentication is introduced for the storage api too * store and check should use a codechecker server host and port no direct connection to the database is available * database arguments in store and check are deprecated * authentication and client api was factored out from the command line client modul to a common client module * new test which tries to store results to an authenticated server
Resolves #683