Skip to content
  • Hanna Reitz's avatar
    73895f38
    jobs: Give Job.force_cancel more meaning · 73895f38
    Hanna Reitz authored
    
    
    We largely have two cancel modes for jobs:
    
    First, there is actual cancelling.  The job is terminated as soon as
    possible, without trying to reach a consistent result.
    
    Second, we have mirror in the READY state.  Technically, the job is not
    really cancelled, but it just is a different completion mode.  The job
    can still run for an indefinite amount of time while it tries to reach a
    consistent result.
    
    We want to be able to clearly distinguish which cancel mode a job is in
    (when it has been cancelled).  We can use Job.force_cancel for this, but
    right now it only reflects cancel requests from the user with
    force=true, but clearly, jobs that do not even distinguish between
    force=false and force=true are effectively always force-cancelled.
    
    So this patch has Job.force_cancel signify whether the job will
    terminate as soon as possible (force_cancel=true) or whether it will
    effectively remain running despite being "cancelled"
    (force_cancel=false).
    
    To this end, we let jobs that provide JobDriver.cancel() tell the
    generic job code whether they will terminate as soon as possible or not,
    and for jobs that do not provide that method we assume they will.
    
    Signed-off-by: default avatarHanna Reitz <hreitz@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-Id: <20211006151940.214590-7-hreitz@redhat.com>
    Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    73895f38
    jobs: Give Job.force_cancel more meaning
    Hanna Reitz authored
    
    
    We largely have two cancel modes for jobs:
    
    First, there is actual cancelling.  The job is terminated as soon as
    possible, without trying to reach a consistent result.
    
    Second, we have mirror in the READY state.  Technically, the job is not
    really cancelled, but it just is a different completion mode.  The job
    can still run for an indefinite amount of time while it tries to reach a
    consistent result.
    
    We want to be able to clearly distinguish which cancel mode a job is in
    (when it has been cancelled).  We can use Job.force_cancel for this, but
    right now it only reflects cancel requests from the user with
    force=true, but clearly, jobs that do not even distinguish between
    force=false and force=true are effectively always force-cancelled.
    
    So this patch has Job.force_cancel signify whether the job will
    terminate as soon as possible (force_cancel=true) or whether it will
    effectively remain running despite being "cancelled"
    (force_cancel=false).
    
    To this end, we let jobs that provide JobDriver.cancel() tell the
    generic job code whether they will terminate as soon as possible or not,
    and for jobs that do not provide that method we assume they will.
    
    Signed-off-by: default avatarHanna Reitz <hreitz@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Reviewed-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-Id: <20211006151940.214590-7-hreitz@redhat.com>
    Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Loading