Module reahl.workflowmodel¶
A simple model for implementing workflow concepts.
The basics of workflow is the ability for the system to allocate Tasks to users via Queues that can be monitored by these users. Via this model a program can also be written to schedule a particular task for the system to do some time in the future.
Deferred actions¶
DeferredAction¶
- class reahl.workflowmodel.DeferredAction(**kwargs)¶
A DeferredAction implements something the system should do some time in the future. A DeferredAction will be done once a number of Requirements are fulfilled. The success_action method of a DeferredAction contains the code that needs to be executed when all Requirements are fulfilled. If all Requirements are not fulfilled by the given deadline (a DateTime), the deadline_action is executed instead, before the DeferredAction is deleted.
Parameters: - requirements – A list of Requirement instances to be satisfied before .success_action can be executed.
- deadline – The DateTime by which deadline_action will be executed if all requirements are not fulfulled by that time.
- success_action()¶
Override this method to supply the code that needs to execute upon all instances of Requirement are fulfilled.
- deadline_action()¶
Override this method to supply the code that needs to execute once the DateTime limit has been reached, and not all Requirement have been fulfilled
Requirement¶
- class reahl.workflowmodel.Requirement(**kwargs)¶
Something that needs to be fulfilled before a DeferrredAction can be completed. Programmers are required to create subclasses of Requirement that call self.set_fulfulled() somewhere in a method of the subclass in order to indicate that the Requirement is fulfilled.
Tasks and Queues¶
WorkflowInterface¶
- class reahl.workflowmodel.WorkflowInterface¶
An object that @exposes a number of Events that user interface Widgets can use to access the functionality of this module.
Obtain an instance of WorkflowInterface by merely instantiating it.
@exposed events:
- take_task = Requests that the given task be reserved for the account currently logged in.
- defer_task = Indicates that the current user will tend to the given task later.
- go_to_task = Indicates that the current user is attending to a task previously deferred.
- release_task = Releases the current task back into the que for other users to tend to.
Queue¶
- class reahl.workflowmodel.Queue(**kwargs)¶
A first-in, first-out queue that is monitored by users for Tasks that the system indicated need to be done.