Expiration Policy for executions failed to delete executions

Bug #1484138 reported by Guy Paz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
High
Guy Paz

Bug Description

From the code below (the '//' lines are the proposal fix) there are 2 calls for the DB (one for list, secound for delete - that call for get), but there is a little different between them.
The second call is with ‘_secure_query’ so when it comes to delete the execution we are getting an exception that this ‘execution.id’ is not valid/available in the DB.

This happened since every exaction has its own project.id while the task (ExecutionExpirationPolicy) running without any special project.id.
And since we may have few different projects we need to set for each execution his project ID for each deletion (like you are doing in periodic.py when the MistralPeriodicTasks going over the triggers – lines 36-40) .

From expiration_policy.py:
==========================

    with db_api.transaction():
        # TODO(gpaz): In the future should use generic method with
        # filters params and not specific method that filter by time.
        for execution in db_api.get_expired_executions(exp_time):
            try:
                // Here we need to set the ctx with project ID so delete execution will not fail in ‘_secure_query’

                LOG.debug('DELETE execution id : %s from date : %s '
                          'according to expiration policy',
                          execution.id,
                          execution.updated_at)
                db_api.delete_workflow_execution(execution.id)
            except Exception as e:
                msg = "Failed to delete [execution_id=%s]\n %s" \
                      % (execution.id, traceback.format_exc(e))
                LOG.warning(msg)
            finally:
                //Here we need to return the ctx to the origin values

Guy Paz (guy-paz)
Changed in mistral:
assignee: nobody → Guy Paz (guy-paz)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to mistral (master)

Fix proposed to branch: master
Review: https://review.openstack.org/212080

Changed in mistral:
status: New → In Progress
Changed in mistral:
importance: Undecided → High
milestone: none → liberty-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to mistral (master)

Reviewed: https://review.openstack.org/212080
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=eba00888d028fd717d07073fbbcaa9109ca9af20
Submitter: Jenkins
Branch: master

commit eba00888d028fd717d07073fbbcaa9109ca9af20
Author: Guy Paz <email address hidden>
Date: Wed Aug 12 15:45:44 2015 +0000

    Adding project_id to expiration-policy for executions ctx

    Change-Id: I4977f3b012e6414fe7479d61ec54fd7d06123875
    Closes-Bug: #1484138

Changed in mistral:
status: In Progress → Fix Committed
Changed in mistral:
status: Fix Committed → Fix Released
Changed in mistral:
milestone: liberty-3 → liberty
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.