concurrent programming

Chris cs26 at tecco.at
Fri Sep 13 04:52:49 EDT 2002


Hi!

I have a problem in my project I startet a few weeks ago. The
requirement is to program a Task Scheduler who gets a Python script
with the tasks spezified. So I have to write some extensions in C++
which provide the functionality. So far so good, now comes the
problem. It should be possible to write something like:
<code>
PARBEGIN
    if ....
        exeute some shell scripts on distributed computers
        some method calls from the extension module, e.g. write in a
database
    do something else
    while ...
    ...
PAREND
</code>

This means that the code bracketed in PARBEGIN PAREND should be
executed parallel. The contrary would be SEQBEGIN SEQEND for
sequential execution.

The Task Scheduler is for testing some programs, so the scripts should
be easy to write and not too complicated. My idea would be to handle
this with a call of a function from the extension module which gets a
function pointer to a method with the code inside PARBEGIN PAREND as a
parameter, so that I can do a callback from the C++ module e.g.:
<code>
def f():
    if ....
        exeute some shell scripts on distributed computers
        some method calls from the extension module, e.g. write in a
database
    do something else
    while ...
    ...

exec_par(f())
</code>

But how can this be executed concurrent? Is there another possibility
in Python?

thx



More information about the Python-list mailing list