Skip to content

RFE: Cancel running Koji tasks on process restart #79

Closed

Description

@sgallagher

ELNBuildSync saves all of its active tasks in a database table, so if it crashes or is restarted for any reason (including process upgrade), it will start any currently-running batch over from the beginning. It can do this reasonably safely because it performs Koji draft builds and only promotes them to stable immediately prior to submitting them as a Bodhi update.

However, this means that any tasks that were running prior to the restart will keep going in Koji, tying up a builder and wasting resources on a build that will never be promoted.

Therefore, I think it is probably sensible that the startup process of EBS (before it begins processing any pending requests) should cancel any running Koji tasks that were started by the EBS user.

The workflow would look something like:

  • EBS starts up and starts the logger and initiates its mainloop
  • EBS downloads its dynamic configuration
  • EBS gets the current user ID with session.getLoggedInUser()
  • EBS looks up all active tasks for this user:
session.listTasks(
    opts={
        "owner": ebs_user_id,
        "state": [
            koji.TASK_STATES["FREE"],
            koji.TASK_STATES["OPEN"],
            koji.TASK_STATES["ASSIGNED"]
        ]
    }
)
  • EBS cancels all remaining tasks owned by this user. Using the multicall() interface, cancel all at once.
  • ELN finishes setting up and starts handling requests.

If the cancel attempts fail due to network issues, they should be retried, but if we get any other failure, we will just give up.

Activity

  1. moved this from Backlog to Todo in ELN FY26on Sep 16, 2026
  2. yselkowitz commented on Sep 16, 2026

    @yselkowitz
    Member

    Just note that (at least theoretically) only the parent tasks need to be cancelled directly, unless that makes things more complicated.

  3. sgallagher commented on Sep 16, 2026

    @sgallagher
    MemberAuthor

    It actually does (I was just checking). session.listTasks() doesn't have a way to get just the parent tasks and walking the relationship just to avoid individually canceling the children seems like unnecessary effort. Better to just cancel them all (with recurse=False).

  4. moved this from Todo to In Progress in ELN FY26on Sep 22, 2026
  5. closed this as completedby moving to Done in ELN FY26on Sep 30, 2026
  6. added theissue type on Oct 9, 2026
  7. linked a pull request that will close this issueFeature/cancel kiji task on restart#79 #87on Oct 9, 2026
  8. moved this from Review to Done in ELN FY26on Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions