Dependency managed scheduler

Published by Manfred Karrer on Friday, 9 of March , 2012 at 17:18

The first small nucleo.io project is out!

It is a scheduler framework for easily configuring tasks to be executed in sequence, parallel or based on their data dependencies.

The SequenceScheduler and ParallelScheduler are somehow self explaining. The 3 rd in the row needs maybe a few comments:

The DependencyManagedScheduler is used to automatically detect which tasks can be executed and which one needs to wait, until the data required in this task has been written by any other task. It simply checks if the data needed is available, and if so, it starts the task. Every time a task has completed all remaining tasks will be evaluated again if they are ready to run.

I used a special style of model for storing and exchanging the data between the tasks. There is a Dictionary holding the data objects. As key you can use any type of object, so you can use an Interface or a Class as well as a String as Dictionary key. There is a kind of registration mechanism, and the access is handled over a read and write method. With this style you get the benefits of a type safe access (if you use an Interface or Class as key) to the properties. The alternative solution would have been to use always a string as property name. Then you could use a simple model with public properties.

There are examples included in the project so it is maybe easier to checkout the code and read the comments there.

A typical use case could be a startup process scheduler, where many different synchronous and asynchronous tasks are executed. To find out the optimized and correct order can be tricky and hard to maintain (when new tasks are added). The scheduler helps to give a better overview with the MXML declaration of the tasks and schedulers. The DependencyManagedScheduler is taking care of the correct and optimized execution order based on the required data of the tasks.

Here is a small example how a MXML style scheduler configuration would look like for a Mojito mix recipe:

[code lang="actionscript3"]
    

        
        
            
            
                
                
                
            
        

        
        
            
            
            
            
            
            
        

    
[/code]

Comments Off on Dependency managed scheduler

Category: Flash

No Comments

No comments yet.

Sorry, the comment form is closed at this time.