[Notes] [Git][BuildGrid/buildgrid][finn/87-multi-channel] Adding doc strings.



Title: GitLab

finn pushed to branch finn/87-multi-channel at BuildGrid / buildgrid

Commits:

1 changed file:

Changes:

  • buildgrid/server/instance.py
    ... ... @@ -13,13 +13,6 @@
    13 13
     # limitations under the License.
    
    14 14
     
    
    15 15
     
    
    16
    -"""
    
    17
    -BuildGridServer
    
    18
    -==============
    
    19
    -
    
    20
    -Creates a BuildGrid server, binding all the requisite service instances together.
    
    21
    -"""
    
    22
    -
    
    23 16
     import logging
    
    24 17
     import os
    
    25 18
     from concurrent import futures
    
    ... ... @@ -35,8 +28,18 @@ from .referencestorage.service import ReferenceStorageService
    35 28
     
    
    36 29
     
    
    37 30
     class BuildGridServer:
    
    31
    +    """Creates a BuildGrid server.
    
    32
    +
    
    33
    +    The :class:`BuildGridServer` class binds together all the
    
    34
    +    requisite services.
    
    35
    +    """
    
    38 36
     
    
    39 37
         def __init__(self, max_workers=None):
    
    38
    +        """Initializes a new :class:`BuildGridServer` instance.
    
    39
    +
    
    40
    +        Args:
    
    41
    +            max_workers (int, optional): A pool of max worker threads.
    
    42
    +        """
    
    40 43
     
    
    41 44
             self.logger = logging.getLogger(__name__)
    
    42 45
     
    
    ... ... @@ -57,12 +60,25 @@ class BuildGridServer:
    57 60
             self._bytestream_service = None
    
    58 61
     
    
    59 62
         def start(self):
    
    63
    +        """Starts the server.
    
    64
    +        """
    
    60 65
             self._server.start()
    
    61 66
     
    
    62 67
         def stop(self, grace=0):
    
    68
    +        """Stops the server.
    
    69
    +        """
    
    63 70
             self._server.stop(grace)
    
    64 71
     
    
    65 72
         def add_port(self, address, credentials):
    
    73
    +        """Adds a port to the server.
    
    74
    +
    
    75
    +        Must be called before the server starts. If a credentials object exists,
    
    76
    +        it will make a secure port.
    
    77
    +
    
    78
    +        Args:
    
    79
    +            address (str): The address with port number.
    
    80
    +            credentials (:obj:`grpc.ChannelCredentials`): Credentials object.
    
    81
    +        """
    
    66 82
             if credentials is not None:
    
    67 83
                 self.logger.info("Adding secure connection on: [{}]".format(address))
    
    68 84
                 self._server.add_secure_port(address, credentials)
    
    ... ... @@ -72,42 +88,98 @@ class BuildGridServer:
    72 88
                 self._server.add_insecure_port(address)
    
    73 89
     
    
    74 90
         def add_execution_instance(self, instance, instance_name):
    
    91
    +        """Adds an :obj:`ExecutionInstance` to the service.
    
    92
    +
    
    93
    +        If no service exists, it creates one.
    
    94
    +
    
    95
    +        Args:
    
    96
    +            instance (:obj:`ExecutionInstance`): Instance to add.
    
    97
    +            instance_name (str): Instance name.
    
    98
    +        """
    
    75 99
             if self._execution_service is None:
    
    76 100
                 self._execution_service = ExecutionService(self._server)
    
    77 101
     
    
    78 102
             self._execution_service.add_instance(instance_name, instance)
    
    79 103
     
    
    80 104
         def add_bots_interface(self, instance, instance_name):
    
    105
    +        """Adds a :obj:`BotsInterface` to the service.
    
    106
    +
    
    107
    +        If no service exists, it creates one.
    
    108
    +
    
    109
    +        Args:
    
    110
    +            instance (:obj:`BotsInterface`): Instance to add.
    
    111
    +            instance_name (str): Instance name.
    
    112
    +        """
    
    81 113
             if self._bots_service is None:
    
    82 114
                 self._bots_service = BotsService(self._server)
    
    83 115
     
    
    84 116
             self._bots_service.add_instance(instance_name, instance)
    
    85 117
     
    
    86 118
         def add_operations_instance(self, instance, instance_name):
    
    119
    +        """Adds an :obj:`OperationsInstance` to the service.
    
    120
    +
    
    121
    +        If no service exists, it creates one.
    
    122
    +
    
    123
    +        Args:
    
    124
    +            instance (:obj:`OperationsInstance`): Instance to add.
    
    125
    +            instance_name (str): Instance name.
    
    126
    +        """
    
    87 127
             if self._operations_service is None:
    
    88 128
                 self._operations_service = OperationsService(self._server)
    
    89 129
     
    
    90 130
             self._operations_service.add_instance(instance_name, instance)
    
    91 131
     
    
    92 132
         def add_reference_storage_instance(self, instance, instance_name):
    
    133
    +        """Adds a :obj:`ReferenceCache` to the service.
    
    134
    +
    
    135
    +        If no service exists, it creates one.
    
    136
    +
    
    137
    +        Args:
    
    138
    +            instance (:obj:`ReferenceCache`): Instance to add.
    
    139
    +            instance_name (str): Instance name.
    
    140
    +        """
    
    93 141
             if self._reference_storage_service is None:
    
    94 142
                 self._reference_storage_service = ReferenceStorageService(self._server)
    
    95 143
     
    
    96 144
             self._reference_storage_service.add_instance(instance_name, instance)
    
    97 145
     
    
    98 146
         def add_action_cache_instance(self, instance, instance_name):
    
    147
    +        """Adds a :obj:`ReferenceCache` to the service.
    
    148
    +
    
    149
    +        If no service exists, it creates one.
    
    150
    +
    
    151
    +        Args:
    
    152
    +            instance (:obj:`ReferenceCache`): Instance to add.
    
    153
    +            instance_name (str): Instance name.
    
    154
    +        """
    
    99 155
             if self._action_cache_service is None:
    
    100 156
                 self._action_cache_service = ActionCacheService(self._server)
    
    101 157
     
    
    102 158
             self._action_cache_service.add_instance(instance_name, instance)
    
    103 159
     
    
    104 160
         def add_cas_instance(self, instance, instance_name):
    
    161
    +        """Stores a :obj:`ContentAddressableStorageInstance` to the service.
    
    162
    +
    
    163
    +        If no service exists, it creates one.
    
    164
    +
    
    165
    +        Args:
    
    166
    +            instance (:obj:`ReferenceCache`): Instance to add.
    
    167
    +            instance_name (str): Instance name.
    
    168
    +        """
    
    105 169
             if self._cas_service is None:
    
    106 170
                 self._cas_service = ContentAddressableStorageService(self._server)
    
    107 171
     
    
    108 172
             self._cas_service.add_instance(instance_name, instance)
    
    109 173
     
    
    110 174
         def add_bytestream_instance(self, instance, instance_name):
    
    175
    +        """Stores a :obj:`ByteStreamInstance` to the service.
    
    176
    +
    
    177
    +        If no service exists, it creates one.
    
    178
    +
    
    179
    +        Args:
    
    180
    +            instance (:obj:`ByteStreamInstance`): Instance to add.
    
    181
    +            instance_name (str): Instance name.
    
    182
    +        """
    
    111 183
             if self._bytestream_service is None:
    
    112 184
                 self._bytestream_service = ByteStreamService(self._server)
    
    113 185
     
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]