[Notes] [Git][BuildGrid/buildgrid][mablanch/117-job-scheduler-refactoring] scheduler.py: Implement operation cancellation



Title: GitLab

Martin Blanchard pushed to branch mablanch/117-job-scheduler-refactoring at BuildGrid / buildgrid

Commits:

1 changed file:

Changes:

  • buildgrid/server/scheduler.py
    ... ... @@ -83,6 +83,7 @@ class Scheduler:
    83 83
     
    
    84 84
         def update_job_lease_state(self, job_name, lease_state, lease_status=None, lease_result=None):
    
    85 85
             job = self.jobs[job_name]
    
    86
    +
    
    86 87
             if lease_state != LeaseState.COMPLETED:
    
    87 88
                 job.update_lease_state(lease_state)
    
    88 89
             else:
    
    ... ... @@ -100,6 +101,16 @@ class Scheduler:
    100 101
         def get_job_lease(self, name):
    
    101 102
             return self.jobs[name].lease
    
    102 103
     
    
    104
    +    def cancel_job_operation(self, job_name):
    
    105
    +        """"Cancels the underlying operation of a given job.
    
    106
    +
    
    107
    +        This will also cancel any job's lease that may have been issued.
    
    108
    +
    
    109
    +        Args:
    
    110
    +            job_name (str): name of the job holding the operation to cancel.
    
    111
    +        """
    
    112
    +        self.jobs[job_name].cancel_operation()
    
    113
    +
    
    103 114
         def create_lease(self):
    
    104 115
             if self.queue:
    
    105 116
                 job = self.queue.popleft()
    



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