2012-04-21

Job scheduling with PHP - 1


Background

I will try to write some posts of a job planning system I have written in PHP. In this first post I give a background to job planning and job scheduling.
I have partly been working with computer  operations my entire life, so it feels anyway.  Job planning and supervision is an important part of computer operations.  By Job I mean a planned background   task, that do some work in a computer, most often a job is part of an application, like import sales orders from another application or automatically send requirement forecasts to suppliers.

Job scheduling is complex.

If you like to create a process that starts by import Customer Sales Orders and ends with mailing out Purchase Orders of components to your suppliers, there are a hell of a lot of things to do from inbound sales order to outbound Purchase Order. There are many dependent tasks that must be carried out before the Purchase Order is produced. These tasks and dependencies must be defined in a Job Scheduling System.  If we make this extremely simple we create three jobs.

  1. First we create a  job for Sales Order Intake.
  2. Then a job for Material Requirement Planning , (calculate how many components missing).
  3. And at last a job to mail out Purchase Orders for components missing.
With only these three jobs at lot of questions arises. E.g. what shall we do if there is no Sales Order? Is this an error? Shall we notify someone? By mail? SMS? Twitter? Shall we execute the next step(s)? What do we do if there is a problem with a Sales Order? Shall we run this job on Saturdays? If the Sales Order application is delayed shall we wait? If so for how long?
If our database server is down what should our three jobs do? If the mails system is down? Etc.
There are endless possibilities that background jobs go wrong one way or another. In a Job Scheduling System you must be able not only to describe your processes but also alternative actions, notifications, error corrections and relation to other processes or scheduled events.

When I created a Business Intelligence system some years ago I decided to build a job scheduling system of my own based on my experience of computer operations. I never worked with a Job Scheduling System I really liked and I always thought I could do better. As a matter of fact I thought I could do a lot better. Job Scheduling systems I worked with have been to limited, awkward, inflexible, poor plugin capability, bad social skills i.e. do not communicate with other job scheduling systems the list goes on and on. Lately I have seen graphical Job Scheduling Systems, and they are probably the worst. First I do not like point-and-click programming you miss the detailed knowledge of what you are doing, second the graphical interfaces cannot do everything necessary. Too often you end up ‘this cannot be done’ or ‘for this task you must use the TTY interface’.  I do not want to give explicit examples but for those not involved in job planning believe me, there exists a lot of ‘limited’ job planning tools on the market.

In the post Job scheduling with PHP -2  I will describe my Job Scheduling System. Here you find some examples.

No comments:

Post a Comment