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

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

# Copyright (C) 2018 Bloomberg LP 

# 

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

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

# You may obtain a copy of the License at 

# 

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

# 

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

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

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

# See the License for the specific language governing permissions and 

# limitations under the License. 

 

 

import hashlib 

from buildgrid._version import __version__ 

 

 

# Latest REAPI version supported: 

HIGH_REAPI_VERSION = '2.0.0' 

 

# Earliest non-deprecated REAPI version supported: 

LOW_REAPI_VERSION = '2.0.0' 

 

# Hash function used for computing digests: 

HASH = hashlib.sha256 

 

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

HASH_LENGTH = HASH().digest_size * 2 

 

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

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

MIN_THREAD_POOL_SIZE = 5 

 

# Maximum number of client auth. credentials to cache: 

AUTH_CACHE_SIZE = 200 

 

# Period, in seconds, for the monitoring cycle: 

MONITORING_PERIOD = 5.0 

 

# Maximum size for a single gRPC request: 

MAX_REQUEST_SIZE = 2 * 1024 * 1024 

 

# Maximum number of elements per gRPC request: 

MAX_REQUEST_COUNT = 500 

 

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

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

# batch size limit: 

BATCH_REQUEST_SIZE_THRESHOLD = 0.25 

 

# String format for log records: 

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

# The different log record attributes are documented here: 

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

 

# URL scheme for the CAS content browser: 

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

# The string markers that are substituted are: 

# instance - CAS instance's name. 

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

# hash - Object's digest hash. 

# sizebytes - Object's digest size in bytes. 

 

 

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

# (This is defined in the REAPI specification.) 

REQUEST_METADATA_HEADER_NAME = 'requestmetadata-bin' 

 

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

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

REQUEST_METADATA_TOOL_NAME = 'buildgrid' 

REQUEST_METADATA_TOOL_VERSION = __version__ 

 

# Time in seconds to pad timeouts 

NETWORK_TIMEOUT = 1 

 

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

# the interval to the max int64 value 

MAX_JOB_BLOCK_TIME = 300