A job management system implemented for unix systems. A coordinator handles the jobs submitted from user, using job pools. Each pool can handle up to a number of jobs, defined as a command line parameter.
Each job redirects his standard output and standard error to two different files, which are stored under a directory named after the string that includes the Job ID, Process pid, Date and Time. Also, a custom signal handler implemented to ensure a smooth shutdown of the application. More details included below.
The below image describes the structure of the application.
The console is the user interface and handles the communication him and the coordinator using a pair of two named pipes. Also prints the results of operation submitted from user, to inform about the status of pools and jobs.
The coordinator creates and handles the operation of pools and jobs. The communication with pools, are been established using a pair of named pipes for each pool process. Pools are created dynamically, so it can handle any number of submitted jobs.
A custom signal handler implemented using sigaction, to catch and manage the SIGTERM signal. It is highly recommended to use a custom signal handler, so there are no zombie processes remaining after the shutdown of the application. If a pool receives a SIGTERM signal, then redirects it to any active or suspended processes, waits for all of them to exit and then terminates his operation. All other signals are ignored and the default operation takes place.
A user can perform the following operations:
Submit a new job (e.g "ls -l", "pwd", "sleep 100", "cat" etc.).
Print the status of job with requested ID.
Print the status (active, suspended, finished) of every job.
Print the active job's IDs.
Print the active pool linux pids, followed by the number of active jobs by pool.
Print the finished job's IDs.
Suspend the execution of job with requested ID.
Resume the execution of job with requested ID.
Terminate the service and free the memory.
./makefile
./jms_coord -l [directory name] -n [jobs per pool] -w [fifo name (out)] -r [fifo name (in)]
./jms_console -w [fifo name (in)] -r [fifo name (out)]