[Notes] [Git][BuildGrid/buildgrid][finn/74-operation-cancelation] BotsInterface checks to see if lease is cancelled.



Title: GitLab

finn pushed to branch finn/74-operation-cancelation at BuildGrid / buildgrid

Commits:

3 changed files:

Changes:

  • buildgrid/server/bots/instance.py
    ... ... @@ -98,6 +98,11 @@ class BotsInterface:
    98 98
     
    
    99 99
         def _check_lease_state(self, lease):
    
    100 100
     
    
    101
    +        # Check for cancelled lease
    
    102
    +        if self._scheduler.get_lease_cancelled(lease.id):
    
    103
    +            return None
    
    104
    +
    
    105
    +        # If not cancelled, update the status
    
    101 106
             self._scheduler.update_job_lease(lease)
    
    102 107
     
    
    103 108
             lease_state = LeaseState(lease.state)
    

  • buildgrid/server/job.py
    ... ... @@ -117,6 +117,10 @@ class Job:
    117 117
             else:
    
    118 118
                 return None
    
    119 119
     
    
    120
    +    @property
    
    121
    +    def lease_cancelled(self):
    
    122
    +        return self.__lease_cancelled
    
    123
    +
    
    120 124
         @property
    
    121 125
         def n_tries(self):
    
    122 126
             return self._n_tries
    

  • buildgrid/server/scheduler.py
    ... ... @@ -135,6 +135,10 @@ class Scheduler:
    135 135
             """Returns the lease associated to job, if any have been emitted yet."""
    
    136 136
             return self.jobs[job_name].lease
    
    137 137
     
    
    138
    +    def get_job_lease_cancelled(self, job_name):
    
    139
    +        """Returns true if the lease is cancelled"""
    
    140
    +        return self.jobs[job_name].lease_cancelled
    
    141
    +
    
    138 142
         def get_job_operation(self, job_name):
    
    139 143
             """Returns the operation associated to job."""
    
    140 144
             return self.jobs[job_name].operation
    



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