-
Notifications
You must be signed in to change notification settings - Fork 379
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
Run history #885
Run history #885
Conversation
api/report_server.thrift
Outdated
@@ -32,6 +32,13 @@ struct RunData { | |||
} | |||
typedef list<RunData> RunDataList | |||
|
|||
struct RunHistoryData { | |||
1: string tag, // tag of the report |
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.
Yet again, format the comments here as a full string, and below, etc.
api/report_server.thrift
Outdated
@@ -188,6 +197,9 @@ service codeCheckerDBAccess { | |||
throws (1: shared.RequestFailed requestError), | |||
|
|||
// PERMISSION: PRODUCT_ACCESS | |||
RunHistoryDataList getRunHistory(1: i64 runId) | |||
throws (1: shared.RequestFailed requestError), | |||
|
|||
ReportData getReport( |
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 comment line for what permission is needed to getReport()
went missing as the new function was introduced above.
libcodechecker/libhandlers/store.py
Outdated
dest="tag", | ||
required=False, | ||
default=argparse.SUPPRESS, | ||
help="Tag which identifies a certain run update.") |
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.
Okay... there are a lot of concepts not really explained here. "Update"? "Tag"? I think this help message should be made better...
I believe An identifier for this individual store of results in the run's history.
(Run history is used on the GUI.)
@@ -107,6 +107,13 @@ def add_arguments_to_parser(parser): | |||
"the '--name' parameter given to 'codechecker-" | |||
"analyze' will be used, if exists.") | |||
|
|||
parser.add_argument('--tag', |
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.
A new argument is added, but the documentation for the store
command was not updated.
ForeignKey('runs.id', deferrable=True, | ||
initially="DEFERRED", ondelete='CASCADE'), | ||
index=True) | ||
tag = Column(String) |
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.
Tags need not be unique then?
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.
If it would be unique, how would I add the same tag for the same or for a different run?
E.g:
run_id | tag | user | date |
---|---|---|---|
1 | v1.0 | Anonymous | 2017-09-06 16:56:33.681858 |
1 | v1.0 | Anonymous | 2017-09-06 17:56:33.681858 |
The question is, do we want to allow the user to do 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.
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 tag should be unique at least within a run, because it should "uniquely" identify a single update within a run. most probably users will use it to identify the version of software they are analyzing (e.g. the git hash).
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 the name using the name version tag
would be more obvious.
@@ -198,6 +217,9 @@ class Report(Base): | |||
'reopened', | |||
name='detection_status')) | |||
|
|||
detected_at = Column(DateTime) |
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 believe a NOT NULL
constraint should exist on the detected_at
column? Every report is expected to have at least a detection date.
@@ -11,6 +11,7 @@ | |||
import codecs | |||
from collections import defaultdict | |||
import datetime | |||
from datetime import timedelta |
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 only use timedelta
at one place, I'd rather not have a separate import just for this.
|
||
if report_filter.fixedDate: | ||
date = datetime.strptime(report_filter.fixedDate, '%Y-%m-%d') | ||
tomorrow = date + timedelta(days=1) |
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.
Please use datetime.timedelta()
if it is possible. At other places, datetime.strfptime()
is used in a similar manner.
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.
If I'm using this way I'm getting the following error:
type object 'datetime.datetime' has no attribute 'timedelta'
I used the following import to resolve this problem:
from datetime import datetime, timedelta
@@ -527,6 +553,36 @@ def getRunData(self, run_name_filter): | |||
session.close() | |||
|
|||
@timeit | |||
def getRunHistory(self, run_id): | |||
try: |
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.
Only users who have access to the product should be able to query run history.
self.__require_access()
, before the try
statement.
@@ -2300,10 +2357,15 @@ def massStoreRun(self, name, version, b64zip, force): | |||
file_content, | |||
None) | |||
|
|||
user = self.__auth_session.user \ | |||
if self.__auth_session else "Anonymous" |
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.
'Anonymous'
api/report_server.thrift
Outdated
@@ -94,7 +101,9 @@ struct ReportFilter_v2 { | |||
4: list<string> reportHash, | |||
5: list<shared.Severity> severity, | |||
6: list<shared.ReviewStatus> reviewStatus, | |||
7: list<shared.DetectionStatus> detectionStatus | |||
7: list<shared.DetectionStatus> detectionStatus, | |||
8: optional string detectedDate, |
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.
Isn't it better to store something like an ID to the run in the history where it was first detected/fixed?
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 CodeChecker 6, a run ID is a very, very long running stable variable. A run is only introduced once and then for the entire lifespan of the project, it is not expected to be deleted, only updated (stored into) later on. Storing does not change the run ID.
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.
Though I would like it better if dates would be sent as at least integers (in epoch time), not strings, and let the client do the formatting of these values (perhaps different clients with region-specific formats?)
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 did not mean the run ID, but an ID to an entry in the run history table. So we can actually check who executed the run and what was the actual tag without joining on the date which is very error prone.
b65a0eb
to
754086d
Compare
I also did some minor changes: in case of the enum-based filters (severity, review status), I encoded the string value (instead of the enum value) into the URL.
|
754086d
to
ac85840
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.
travis test fails with all databases please check why.
All travis test cases are successfully passed. |
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.
make sure that version tag is unique within a run.
bbd66ff
to
3c04a73
Compare
d45021d
to
b5ed4f2
Compare
api/v6/report_server.thrift
Outdated
@@ -25,6 +25,22 @@ struct RunData { | |||
} | |||
typedef list<RunData> RunDataList | |||
|
|||
struct RunHistoryData { | |||
1: i64 runId, // Unique id of the run. |
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.
Do we need to return the runId
the client calls the api with a runId getRunHistory(1: i64 runId)
?
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, we need it, because we can call the getRunHistory
function without run id. In this case we get back history data for all runs. (See Run history tab under All reports).
api/v6/report_server.thrift
Outdated
struct RunHistoryData { | ||
1: i64 runId, // Unique id of the run. | ||
2: string runName, // Name of the run. | ||
3: string tag, // Tag of the report. |
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.
Shouldn't this be the tag of the run?
Will we support only one tag for each history data entry?
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.
- A version tag is uniquely identifying a store. Actually, the last tag at the run history data is the tag of the run.
- We support only one tag for each history data as I know.
api/v6/report_server.thrift
Outdated
7: list<shared.DetectionStatus> detectionStatus | ||
7: list<shared.DetectionStatus> detectionStatus, | ||
8: list<string> runHistoryTag, | ||
9: optional string detectedDate, |
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 detectionDate
or firstDetectionDate
would be more expressive. A comment would be nice that this value is set only once.
api/v6/report_server.thrift
Outdated
7: list<shared.DetectionStatus> detectionStatus, | ||
8: list<string> runHistoryTag, | ||
9: optional string detectedDate, | ||
10: optional string fixedDate |
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.
How about fixDate
? I think we should comment here that this date can change.
docs/user_guide.md
Outdated
@@ -668,6 +668,8 @@ optional arguments: | |||
reports to the database. If not specified, the '-- | |||
name' parameter given to 'codechecker-analyze' will be | |||
used, if exists. | |||
--tag TAG An identifier for this individual store of results in |
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.
A more descriptive help message would be better to note to the user that an already used tag can not be used again.
@@ -49,6 +50,7 @@ class CountFilter: | |||
SEVERITY = 3 | |||
REVIEW_STATUS = 4 | |||
DETECTION_STATUS = 5 | |||
RUN_HISTORY_TAG = 5 |
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 should be 6
.
ForeignKey('runs.id', deferrable=True, | ||
initially="DEFERRED", ondelete='CASCADE'), | ||
index=True) | ||
tag = Column(String) |
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 the name using the name version tag
would be more obvious.
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.
API call error: massStoreRun RequestFailed(errorCode=2, _message="(sqlite3.IntegrityError) UNIQUE constraint failed: run_histories.run_id, run_histories.tag [SQL: u'INSERT ...
The error if the tag is already used should be better handled. Tag is already used in this run
message would be much nicer.
If I check the Going from the all reports tab and run history if I select one tagged version the run id will be shown as the run name and the run counts will show wrong numbers. |
Products page is not shown correctly, I'm not sure because of the changes here. |
I can reproduce the product listing problem with chrome, firefox works fine for me. |
71eb8fc
to
0e43cb3
Compare
[14:50] - Storing analysis results for run 'tinyxml-resolved'
API call error: massStoreRun
RequestFailed(errorCode=2, _message='Tag v1.0 is already used in this run')
[14:50] - Storage failed: RequestFailed(errorCode=2, _message='Tag v1.0 is already used in this run')
|
d2fb1f1
to
b831eee
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.
time
on the API remains a string
, then?
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.
What is the concept behind showing Run History
on the All reports
pane?
www/style/codecheckerviewer.css
Outdated
font-size: 1.5em; | ||
font-weight: bold; | ||
color: #000; | ||
font-family: Times, serif; |
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 style here intentional? We don't really use serif fonts in the GUI. Looks awkward.
27f91e2
to
30ff3c1
Compare
30ff3c1
to
735538f
Compare
After cleaning all the filter values setting the |
735538f
to
8a3b6e4
Compare
8a3b6e4
to
4c56d8a
Compare
Closes #783