[Notes] [Git][BuildGrid/buildgrid][finn/cli-time-period] 3 commits: Only add status of lease if result not cached.



Title: GitLab

finn pushed to branch finn/cli-time-period at BuildGrid / buildgrid

Commits:

3 changed files:

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:
    

  • buildgrid/server/job.py
    ... ... @@ -122,8 +122,11 @@ class Job:
    122 122
             if self.result is not None:
    
    123 123
                 self._operation.done = True
    
    124 124
                 response = remote_execution_pb2.ExecuteResponse(result=self.result,
    
    125
    -                                                            cached_result=self.result_cached,
    
    126
    -                                                            status=self.lease.status)
    
    125
    +                                                            cached_result=self.result_cached)
    
    126
    +
    
    127
    +            if not self.result_cached:
    
    128
    +                response.status.CopyFrom(self.lease.status)
    
    129
    +
    
    127 130
                 self._operation.response.CopyFrom(self._pack_any(response))
    
    128 131
     
    
    129 132
             return self._operation
    

  • buildgrid/server/scheduler.py
    ... ... @@ -23,8 +23,6 @@ Schedules jobs.
    23 23
     
    
    24 24
     from collections import deque
    
    25 25
     
    
    26
    -from google.protobuf import any_pb2
    
    27
    -
    
    28 26
     from buildgrid._exceptions import NotFoundError
    
    29 27
     from buildgrid._protos.build.bazel.remote.execution.v2 import remote_execution_pb2
    
    30 28
     from buildgrid._protos.google.longrunning import operations_pb2
    
    ... ... @@ -60,9 +58,7 @@ class Scheduler:
    60 58
                     job.update_execute_stage(ExecuteStage.QUEUED)
    
    61 59
     
    
    62 60
                 else:
    
    63
    -                cached_result_any = any_pb2.Any()
    
    64
    -                cached_result_any.Pack(cached_result)
    
    65
    -                job.result = cached_result_any
    
    61
    +                job.result = cached_result
    
    66 62
                     job.result_cached = True
    
    67 63
                     job.update_execute_stage(ExecuteStage.COMPLETED)
    
    68 64
     
    



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