Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# Copyright (C) 2018 Bloomberg LP 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"); 

4# you may not use this file except in compliance with the License. 

5# You may obtain a copy of the License at 

6# 

7# <http://www.apache.org/licenses/LICENSE-2.0> 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, 

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

12# See the License for the specific language governing permissions and 

13# limitations under the License. 

14 

15 

16import hashlib 

17from buildgrid._version import __version__ 

18 

19 

20# Latest REAPI version supported: 

21HIGH_REAPI_VERSION = '2.0.0' 

22 

23# Earliest non-deprecated REAPI version supported: 

24LOW_REAPI_VERSION = '2.0.0' 

25 

26# Hash function used for computing digests: 

27HASH = hashlib.sha256 

28 

29# Length in bytes of a hash string returned by HASH: 

30HASH_LENGTH = HASH().digest_size * 2 

31 

32# Minimum required size for the gRPC handlers thread pool, ie. 

33# min. value for the 'thread-pool-size' configuration key. 

34MIN_THREAD_POOL_SIZE = 5 

35 

36# Maximum number of client auth. credentials to cache: 

37AUTH_CACHE_SIZE = 200 

38 

39# Period, in seconds, for the monitoring cycle: 

40MONITORING_PERIOD = 5.0 

41 

42# Maximum size for a single gRPC request, minus a small delta: 

43MAX_REQUEST_SIZE = 4 * 1024 * 1024 - 1024 

44 

45# Maximum number of elements per gRPC request: 

46MAX_REQUEST_COUNT = 500 

47 

48# Value that establishes an upper bound on the size of a file that can 

49# be queued into a batch request. Expressed as a percentage of the 

50# batch size limit: 

51BATCH_REQUEST_SIZE_THRESHOLD = 0.25 

52 

53# String format for log records: 

54LOG_RECORD_FORMAT = '%(asctime)s:[%(name)36.36s][%(levelname)5.5s][%(threadName)s]: %(message)s' 

55# The different log record attributes are documented here: 

56# https://docs.python.org/3/library/logging.html#logrecord-attributes 

57 

58# URL scheme for the CAS content browser: 

59BROWSER_URL_FORMAT = '%(type)s/%(instance)s/%(hash)s/%(sizebytes)s/' 

60# The string markers that are substituted are: 

61# instance - CAS instance's name. 

62# type - Type of CAS object, eg. 'action_result', 'command'... 

63# hash - Object's digest hash. 

64# sizebytes - Object's digest size in bytes. 

65 

66 

67# Name of the header key to attach optional `RequestMetadata`values. 

68# (This is defined in the REAPI specification.) 

69REQUEST_METADATA_HEADER_NAME = 'requestmetadata-bin' 

70 

71# 'RequestMetadata' header values. These values will be used when 

72# attaching optional metadata to a gRPC request's header: 

73REQUEST_METADATA_TOOL_NAME = 'buildgrid' 

74REQUEST_METADATA_TOOL_VERSION = __version__ 

75 

76# Time in seconds to pad timeouts 

77NETWORK_TIMEOUT = 1 

78 

79# Hard limit for waiting on jobs, avoids grpc timeouts not being set defaulting 

80# the interval to the max int64 value 

81MAX_JOB_BLOCK_TIME = 300 

82 

83# Default Maximum execution timeout; lazily checked upon request of job status, 

84# directly or when doing de-duplication checks. 

85# If the job has been executing for longer than this amount of time (in seconds) 

86# it will be marked as cancelled (existing operations will be cancelled, and the job 

87# will not be de-duplicated) 

88DEFAULT_MAX_EXECUTION_TIMEOUT = 7200 

89 

90# Default platform property keys 

91DEFAULT_PLATFORM_PROPERTY_KEYS = {'OSFamily', 'ISA'}