Skip to content

Commit 42734e8

Browse files
authored
Merge pull request #4662 from bruntib/async_store_3
Async store 3
2 parents af88fa3 + 6654d36 commit 42734e8

19 files changed

Lines changed: 1534 additions & 1017 deletions

File tree

codechecker_common/compatibility/multiprocessing.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@
1414
# pylint: disable=unused-import
1515
if sys.platform in ["darwin", "win32"]:
1616
from multiprocess import \
17-
Pool, Process, \
17+
Pipe, Pool, Process, \
1818
Queue, \
1919
Value, \
2020
cpu_count
21+
from multiprocess.managers import SyncManager
2122
else:
2223
from concurrent.futures import ProcessPoolExecutor as Pool
2324
from multiprocessing import \
25+
Pipe, \
2426
Process, \
2527
Queue, \
2628
Value, \
2729
cpu_count
30+
from multiprocessing.managers import SyncManager

codechecker_common/util.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import os
1919
import pathlib
2020
import random
21-
from typing import List, TextIO
21+
from typing import List, TextIO, Union
2222

2323
import portalocker
2424

@@ -59,7 +59,10 @@ def chunks(iterator, n):
5959
yield itertools.chain([first], rest_of_chunk)
6060

6161

62-
def load_json(path: str, default=None, lock=False, display_warning=True):
62+
def load_json(path: Union[str, pathlib.Path],
63+
default=None,
64+
lock=False,
65+
display_warning=True):
6366
"""
6467
Load the contents of the given file as a JSON and return it's value,
6568
or default if the file can't be loaded.
@@ -218,3 +221,16 @@ def generate_random_token(num_bytes: int = 32) -> str:
218221
for _ in range(0, -(num_bytes // -64))])
219222
idx = random.randrange(0, len(hash_value) - num_bytes + 1)
220223
return hash_value[idx:(idx + num_bytes)]
224+
225+
226+
def format_size(num: float, suffix: str = 'B') -> str:
227+
"""
228+
Pretty print storage units.
229+
Source: http://stackoverflow.com/questions/1094841/
230+
reusable-library-to-get-human-readable-version-of-file-size
231+
"""
232+
for unit in ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi', 'Ri']:
233+
if abs(num) < 1024.0:
234+
return f"{num:3.1f} {unit}{suffix}"
235+
num /= 1024.0
236+
return f"{num:.1f} Qi{suffix}"

docs/web/user_guide.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,19 @@ optional arguments:
473473
is given, the longest match will be removed. You may
474474
also use Unix shell-like wildcards (e.g.
475475
'/*/jsmith/').
476+
--detach Runs `store` in fire-and-forget mode: exit immediately
477+
once the server accepted the analysis reports for
478+
storing, without waiting for the server-side data
479+
processing to conclude. Doing this is generally not
480+
recommended, as the client will never be notified of
481+
potential processing failures, and there is no easy way
482+
to wait for the successfully stored results to become
483+
available server-side for potential further processing
484+
(e.g., `CodeChecker cmd diff`). However, using
485+
'--detach' can significantly speed up large-scale
486+
monitoring analyses where access to the results by a
487+
tool is not a goal, such as in the case of non-gating
488+
CI systems.
476489
--config CONFIG_FILE Allow the configuration from an explicit configuration
477490
file. The values configured in the config file will
478491
overwrite the values set in the command line.

web/api/codechecker_api_shared.thrift

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,35 @@ enum Ternary {
1414
}
1515

1616
enum ErrorCode {
17-
DATABASE,
18-
IOERROR,
19-
GENERAL,
20-
AUTH_DENIED, // Authentication denied. We do not allow access to the service.
21-
UNAUTHORIZED, // Authorization denied. User does not have right to perform an action.
22-
API_MISMATCH, // The client attempted to query an API version that is not supported by the server.
23-
SOURCE_FILE, // The client sent a source code which contains errors (e.g., source code comment errors).
24-
REPORT_FORMAT, // The client sent a report with wrong format (e.g., report annotation has bad type in a .plist).
17+
// Any other sort of error encountered during RPC execution.
18+
GENERAL = 2,
19+
20+
// Executing the request triggered a database-level fault, constraint violation.
21+
DATABASE = 0,
22+
23+
// The request is malformed or an internal I/O operation failed.
24+
IOERROR = 1,
25+
26+
// Authentication denied. We do not allow access to the service.
27+
AUTH_DENIED = 3,
28+
29+
// User does not have the necessary rights to perform an action.
30+
UNAUTHORIZED = 4,
31+
32+
// The client attempted to query an API version that is not supported by the
33+
// server.
34+
API_MISMATCH = 5,
35+
36+
// REMOVED IN API v6.59 (CodeChecker v6.25.0)!
37+
// Previously sent by report_server.thrift/codeCheckerDBAccess::massStoreRun()
38+
// when the client uploaded a source file which contained errors, such as
39+
// review status source-code-comment errors.
40+
/* SOURCE_FILE = 6, */ // Never reuse the value of the enum constant!
41+
42+
// REMOVED IN API v6.59 (CodeChecker v6.25.0)!
43+
// Previously sent by report_server.thrift/codeCheckerDBAccess::massStoreRun()
44+
// when the client uploaded a report with annotations that had invalid types.
45+
/* REPORT_FORMAT = 7, */ // Never reuse the value of the enum constant!
2546
}
2647

2748
exception RequestFailed {
-26 Bytes
Binary file not shown.
3 Bytes
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)