Replace task action with task executor

Registered by Ivan Melnikov on 2013-12-10

Work on worker-based engine showed that TaskAction provides wrong abstraction boundary: it does a lot of things that are critical to engine work correctness making making replacing it with another action (like one running task remotely) harder than it needs to be.

We propose that most of work on state changes and result saving should be done by engine itself, maybe in engine-specific way. Then, when task is ready and arguments are prepared, execution (or reversion) should be delegated to task executor, that will just have to take task, take prepared arguments and do what it should.

Blueprint information

Status:
Complete
Approver:
Joshua Harlow
Priority:
High
Drafter:
Ivan Melnikov
Direction:
Approved
Assignee:
Ivan Melnikov
Definition:
Approved
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
Ivan Melnikov on 2013-12-10
Completed by
Ivan Melnikov on 2014-01-07

Related branches

Sprints

Whiteboard

This essentially means that we'd like to get rid of TaskAction, and split its roles among other entities around:
- storage will handle name->uuid mapping, hiding uuids from engine and thus making everything simpler for them
- engine will handle task state changes and most of error handling
- engine will call to storage to prepare task arguments and save task results
- new entity, TaskExecutor, will be introduced to actually execute or revert the task with given arguments when engine says so.

TaskExecutor will have simple interface:

class TaskExecutor(object):
    def execute(self, task, arguments):
        ...

    def revert(self, task, arguments, result, failures):
        ...

Worker-based engine will be able to replace it with remote version to run tasks on workers. Other interesting stuff becomes possible.

Initially, execute and revert method will return results (or misc.Failure in case of failures). In future we may want to make them return futures so that engine can wait for result while it is executed asynchronously.

Gerrit topic: https://review.openstack.org/#q,topic:bp/task-executor,n,z

Addressed by: https://review.openstack.org/60850
    Storage: use names insteand of uuids for interface

Addressed by: https://review.openstack.org/60851
    Replace TaskAction with TaskExecutor

Addressed by: https://review.openstack.org/60849
    Speed up FlowDetail.find

Addressed by: https://review.openstack.org/61372
    Introduce TaskExecutor

Addressed by: https://review.openstack.org/61681
    Run some engine tests with eventlet if it's available

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.