[GRASS-dev] Question about *.mapcalc_start in Python scripting library

Michael Barton Michael.Barton at asu.edu
Fri Mar 15 06:15:16 PDT 2019


I've been using *.mapcalc_start to do some simple parallel processing in the i.pansharpen module and in r.landscape.evol. My understanding previously has been that *.mapcalc_start returns a Popen object that can be directed to wait to finish (like *.start_command), allowing multiple mapcalc operations to be initiated on multiple cores.

But when running r.landscape.evol on another computer, it is acting like mapcalc is not waiting to finish in spite of the *.wait() commands.

The description in the programmer's manual is not clear to me on this (see below). In one place, it says it does not wait to finish and in the example it says it does wait.

Can anyone clarify this?

Thanks
Michael

==== from programmer's manual ====

script.raster.mapcalc_start(exp, quiet=False, verbose=False, overwrite=False, seed=None, env=None, **kwargs)[source]
Interface to r.mapcalc, doesn’t wait for it to finish, returns Popen object.

>>> output = 'newele'
>>> input = 'elevation'
>>> expr1 = '"%s" = "%s" * 10' % (output, input)
>>> expr2 = '...'   # etc.
>>> # launch the jobs:
>>> p1 = mapcalc_start(expr1)
>>> p2 = mapcalc_start(expr2)
...
>>> # wait for them to finish:
>>> p1.wait()
0
>>> p2.wait()
1
____________________
C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Head, Graduate Faculty in Complex Adaptive Systems Science
Arizona State University

voice:  480-965-6262 (SHESC), 480-965-8130/727-9746 (CSDC)
fax: 480-965-7671 (SHESC),  480-727-0709 (CSDC)
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu















-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20190315/83965f71/attachment-0001.html>


More information about the grass-dev mailing list