blob: 428d564b7076427c8ff8427d291da3fb1d4106d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
The client program will be made as simple as possible, keeping the duplication
of code to a minimum while allowing full functional control of the client
machine. The RPC calls that the client program will make will need to be
locked with a semaphore because the program will have multiple processes. The
client program can be run in two modes, daemon and normal. In daemon mode, the
client will start the XMLRPC server and keep it active indefinitatly. This
mode will accept poll_now requests from the scire server. In normal mode,
there will be a process of steps that will execute and then the program will
end.
The program will fork off a subprocess to handle polling and downloading of
jobs. This process will register and make an RPC call to the scire server
asking for jobs. If the scire server replies with jobs it will download the
XML file and save it in the queue. When done downloading all jobs, the
polling process will sleep for the interval of the poll_interval variable.
After that time if the main process is not currently making an RPC call, and
the client program is still running, it will poll the scire server again for
jobs. This procedure will continue as long as the program is running.
The main thread will stat the queue directory after forking the polling
subprocess. It will look in sorted order at the queue and if it finds a job it
will take the highest priority, oldest job first. When the job is complete it
will send an RPC call (or wait until it is able to) to the scire server
updating the status of the job, and then stat the queue directory again and
execute the next job (if there is one). In normal mode it will continue in
this process until at least one poll/download has completed and there are no
remaining jobs and then quit. In daemon mode it will continue until stopped.
|