[Notes] [Git][BuildStream/buildstream][danielsilverstone-ct/yaml-sentinel-rework] 4 commits: using_configuring_artifact_server.rst: Fix lines that are too long



Title: GitLab

Daniel Silverstone pushed to branch danielsilverstone-ct/yaml-sentinel-rework at BuildStream / buildstream

Commits:

5 changed files:

Changes:

  • buildstream/_yaml.py
    ... ... @@ -335,16 +335,9 @@ def node_get_provenance(node, key=None, indices=None):
    335 335
         return provenance
    
    336 336
     
    
    337 337
     
    
    338
    -# Helper to use utils.sentinel without unconditional utils import,
    
    339
    -# which causes issues for completion.
    
    340
    -#
    
    341
    -# Local private, but defined here because sphinx appears to break if
    
    342
    -# it's not defined before any functions calling it in default kwarg
    
    343
    -# values.
    
    344
    -#
    
    345
    -def _get_sentinel():
    
    346
    -    from .utils import _sentinel
    
    347
    -    return _sentinel
    
    338
    +# A sentinel to be used as a default argument for functions that need
    
    339
    +# to distinguish between a kwarg set to None and an unset kwarg.
    
    340
    +_sentinel = object()
    
    348 341
     
    
    349 342
     
    
    350 343
     # node_get()
    
    ... ... @@ -368,10 +361,10 @@ def _get_sentinel():
    368 361
     # Note:
    
    369 362
     #    Returned strings are stripped of leading and trailing whitespace
    
    370 363
     #
    
    371
    -def node_get(node, expected_type, key, indices=None, default_value=_get_sentinel()):
    
    364
    +def node_get(node, expected_type, key, indices=None, default_value=_sentinel):
    
    372 365
         value = node.get(key, default_value)
    
    373 366
         provenance = node_get_provenance(node)
    
    374
    -    if value is _get_sentinel():
    
    367
    +    if value is _sentinel:
    
    375 368
             raise LoadError(LoadErrorReason.INVALID_DATA,
    
    376 369
                             "{}: Dictionary did not contain expected key '{}'".format(provenance, key))
    
    377 370
     
    

  • buildstream/element.py
    ... ... @@ -451,7 +451,7 @@ class Element(Plugin):
    451 451
     
    
    452 452
             return None
    
    453 453
     
    
    454
    -    def node_subst_member(self, node, member_name, default=utils._sentinel):
    
    454
    +    def node_subst_member(self, node, member_name, default=_yaml._sentinel):
    
    455 455
             """Fetch the value of a string node member, substituting any variables
    
    456 456
             in the loaded value with the element contextual variables.
    
    457 457
     
    

  • buildstream/plugin.py
    ... ... @@ -321,7 +321,7 @@ class Plugin():
    321 321
             provenance = _yaml.node_get_provenance(node, key=member_name)
    
    322 322
             return str(provenance)
    
    323 323
     
    
    324
    -    def node_get_member(self, node, expected_type, member_name, default=utils._sentinel):
    
    324
    +    def node_get_member(self, node, expected_type, member_name, default=_yaml._sentinel):
    
    325 325
             """Fetch the value of a node member, raising an error if the value is
    
    326 326
             missing or incorrectly typed.
    
    327 327
     
    

  • buildstream/utils.py
    ... ... @@ -654,10 +654,6 @@ def _pretty_size(size, dec_places=0):
    654 654
         return "{size:g}{unit}".format(size=round(psize, dec_places), unit=unit)
    
    655 655
     
    
    656 656
     
    
    657
    -# A sentinel to be used as a default argument for functions that need
    
    658
    -# to distinguish between a kwarg set to None and an unset kwarg.
    
    659
    -_sentinel = object()
    
    660
    -
    
    661 657
     # Main process pid
    
    662 658
     _main_pid = os.getpid()
    
    663 659
     
    

  • doc/source/using_configuring_artifact_server.rst
    ... ... @@ -155,9 +155,15 @@ Instance with push and requiring client authentication:
    155 155
     Managing the cache with systemd
    
    156 156
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    157 157
     
    
    158
    -It is better to run the cache as a systemd service, especially if it is running on a dedicated server, as this will allow systemd to manage the cache, incase the server ever encounters any issues.
    
    158
    +We recommend running the cache as a systemd service, especially if it is running
    
    159
    +on a dedicated server, as this will allow systemd to manage the cache, in case
    
    160
    +the server encounters any issues.
    
    159 161
     
    
    160
    -Below are two examples of how to run the cache server as a systemd service, one is for pull only and the other is configured for push & pull.
    
    162
    +Below are two examples of how to run the cache server as a systemd service. The
    
    163
    +first, is for pull only and the other is configured for push & pull. Notice that
    
    164
    +the two configurations use different ports.
    
    165
    +
    
    166
    +``bst-artifact-serve.service``:
    
    161 167
     
    
    162 168
     .. code:: ini
    
    163 169
     
    
    ... ... @@ -176,6 +182,9 @@ Below are two examples of how to run the cache server as a systemd service, one
    176 182
        [Install]
    
    177 183
        WantedBy=multi-user.target
    
    178 184
     
    
    185
    +
    
    186
    +``bst-artifact-serve-receive.service``:
    
    187
    +
    
    179 188
     .. code:: ini
    
    180 189
     
    
    181 190
        #
    
    ... ... @@ -193,7 +202,37 @@ Below are two examples of how to run the cache server as a systemd service, one
    193 202
        [Install]
    
    194 203
        WantedBy=multi-user.target
    
    195 204
     
    
    196
    -Here we define when systemd should start the service, which is after the networking stack has been started, we then define how to run the cache with the desired configuration, under the artifacts user. The {{ }} are there to denote where you should change these files to point to your desired locations.
    
    205
    +
    
    206
    +Here we define when systemd should start the service, which is after the networking
    
    207
    +stack has been started, we then define how to run the cache with the desired
    
    208
    +configuration, under the artifacts user. The {{ }} are there to denote where you
    
    209
    +should change these files to point to your desired locations.
    
    210
    +
    
    211
    +.. note::
    
    212
    +
    
    213
    +    You may need to run some of the following commands as the superuser.
    
    214
    +
    
    215
    +These files should be copied to ``/etc/systemd/system/``. We can then start these services
    
    216
    +with:
    
    217
    +
    
    218
    +.. code:: bash
    
    219
    +
    
    220
    +    systemctl enable bst-artifact-serve.service
    
    221
    +    systemctl enable bst-artifact-serve-receive.service
    
    222
    +
    
    223
    +Then, to start these services:
    
    224
    +
    
    225
    +.. code:: bash
    
    226
    +
    
    227
    +    systemctl start bst-artifact-serve.service
    
    228
    +    systemctl start bst-artifact-serve-receive.service
    
    229
    +
    
    230
    +We can then check if the services are successfully running with:
    
    231
    +
    
    232
    +.. code:: bash
    
    233
    +
    
    234
    +    journalctl -u bst-artifact-serve.service
    
    235
    +    journalctl -u bst-artifact-serve-receive.service
    
    197 236
     
    
    198 237
     For more information on systemd services see: 
    
    199 238
     `Creating Systemd Service Files <https://www.devdungeon.com/content/creating-systemd-service-files>`_.
    



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