[Notes] [Git][BuildGrid/buildgrid][master] Allow user to change time period of bot updates through the cli.



Title: GitLab

finn pushed to branch master at BuildGrid / buildgrid

Commits:

1 changed file:

Changes:

  • buildgrid/_app/commands/cmd_bot.py
    ... ... @@ -52,16 +52,19 @@ from ..cli import pass_context
    52 52
                   help="Public CAS client certificate for TLS (PEM-encoded)")
    
    53 53
     @click.option('--cas-server-cert', type=click.Path(exists=True, dir_okay=False), default=None,
    
    54 54
                   help="Public CAS server certificate for TLS (PEM-encoded)")
    
    55
    +@click.option('--update-period', type=click.FLOAT, default=0.5, show_default=True,
    
    56
    +              help="Time period for bot updates to the server in seconds.")
    
    55 57
     @click.option('--parent', type=click.STRING, default='main', show_default=True,
    
    56 58
                   help="Targeted farm resource.")
    
    57 59
     @pass_context
    
    58
    -def cli(context, parent, remote, client_key, client_cert, server_cert,
    
    60
    +def cli(context, parent, update_period, remote, client_key, client_cert, server_cert,
    
    59 61
             remote_cas, cas_client_key, cas_client_cert, cas_server_cert):
    
    60 62
         # Setup the remote execution server channel:
    
    61 63
         url = urlparse(remote)
    
    62 64
     
    
    63 65
         context.remote = '{}:{}'.format(url.hostname, url.port or 50051)
    
    64 66
         context.remote_url = remote
    
    67
    +    context.update_period = update_period
    
    65 68
         context.parent = parent
    
    66 69
     
    
    67 70
         if url.scheme == 'http':
    
    ... ... @@ -138,7 +141,7 @@ def run_dummy(context):
    138 141
         Creates a session, accepts leases, does fake work and updates the server.
    
    139 142
         """
    
    140 143
         try:
    
    141
    -        b = bot.Bot(context.bot_session)
    
    144
    +        b = bot.Bot(context.bot_session, context.update_period)
    
    142 145
             b.session(dummy.work_dummy,
    
    143 146
                       context)
    
    144 147
         except KeyboardInterrupt:
    
    ... ... @@ -153,7 +156,7 @@ def run_host_tools(context):
    153 156
         result back to CAS.
    
    154 157
         """
    
    155 158
         try:
    
    156
    -        b = bot.Bot(context.bot_session)
    
    159
    +        b = bot.Bot(context.bot_session, context.update_period)
    
    157 160
             b.session(host.work_host_tools,
    
    158 161
                       context)
    
    159 162
         except KeyboardInterrupt:
    
    ... ... @@ -174,7 +177,7 @@ def run_buildbox(context, local_cas, fuse_dir):
    174 177
         context.fuse_dir = fuse_dir
    
    175 178
     
    
    176 179
         try:
    
    177
    -        b = bot.Bot(context.bot_session)
    
    180
    +        b = bot.Bot(context.bot_session, context.update_period)
    
    178 181
             b.session(buildbox.work_buildbox,
    
    179 182
                       context)
    
    180 183
         except KeyboardInterrupt:
    



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