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



Title: GitLab

finn pushed to branch finn/cli-time-period 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':
    
    ... ... @@ -139,7 +142,7 @@ def run_dummy(context):
    139 142
         updates the server.
    
    140 143
         """
    
    141 144
         try:
    
    142
    -        b = bot.Bot(context.bot_session)
    
    145
    +        b = bot.Bot(context.bot_session, context.update_period)
    
    143 146
             b.session(dummy.work_dummy,
    
    144 147
                       context)
    
    145 148
         except KeyboardInterrupt:
    
    ... ... @@ -153,7 +156,7 @@ def run_temp_directory(context):
    153 156
         in a temp directory, uploading 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(temp_directory.work_temp_directory,
    
    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]