[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help programming processes (monitoring subordinate processes)



    Date: Wed, 17 Jan 90 11:40:50 EST
    From: rpg@cs.brown.edu


    I have a large natural-language program and a pretty large test set.
    The program has just gotten to a "quasi-stable" state:  by and large
    it doesn't break anymore.  So I want to run it over the entire
    test-set, unsupervised, and come back at the end of some long period
    of time, and see which elements are working properly.

    My initial idea was to write a function which will spawn a process
    that would run my program.  This function would allow the program to
    run for a specified length of time and then give up.  It would also
    watch the subordinate program to see if it was scrrewing up.  At the
    end of the specified length of time, or when the program breaks, my
    function would collect some data and move on to the next element of
    the test set.

    Unfortunately, I haven't been able to figure out how to monitor the
    subordinate process for the following conditions:
    -completion of function

Checking whether the process is runnable, as your program does, is
reasonable.

If you want finer grain (e.g., you're running two functions in the other
process, and you want to know whether the first one has completed) have
the function you're monitoring set a global variable.  If you don't want
to use a global variable (perhaps you want to run multiple instances
simultaneously), then you could cons a structure in the monitoring
process, and pass this structure to the new process, and it could fill
in the structure when it's done.

    -error condition

Set up an error handler that sets a variable, e.g.

	(setq *error* nil)
	(condition-bind ((error (lambda (e) (setq *error* e) nil)))
	  ...)

Again, you can use a passed-in structure rather than a global variable.
Returning NIL from the error handler indicates that the system should
continue searching for another handler.

                                                barmar