Re: [GRASS-dev] creating temporary mapsets in a parallelized python script

2016-04-21 Thread Glynn Clements
Pietro wrote: > Perhaps we could decorate the function with contextmanager: That's an option, but it complicates matters in the (probably more common) case where you just want to use a single temporary region for the entire script. -- Glynn Clements

Re: [GRASS-dev] creating temporary mapsets in a parallelized python script

2016-04-14 Thread Pietro
> The main issue with use_temp_region() is that the clean-up function > uses the current value of the environment variable to determine which > region to delete. > > This could be fixed by passing a lambda to atexit.register(), e.g. > > def use_temp_region(): > name = "tmp.%s.%d" %

Re: [GRASS-dev] creating temporary mapsets in a parallelized python script

2016-04-14 Thread Glynn Clements
Vaclav Petras wrote: > > Does this function mean that: while concurrent r.basin runs on different > > CPUs in the same mapset, there is no interefering by region settings change > > interefering? > > Setting WIND_OVERRIDE (environmental variable) will happen for the current > process, so it

Re: [GRASS-dev] creating temporary mapsets in a parallelized python script

2016-04-12 Thread Moritz Lennert
On 12/04/16 11:29, Helmut Kudrnovsky wrote: wenzeslaus wrote On Mon, Apr 11, 2016 at 5:19 PM, Helmut Kudrnovsky hellik@ wrote: I see, then it's easier to fix the script and use grass.use_temp_region From the manual: script.core.use_temp_region()[source]¶ Copies the current region

Re: [GRASS-dev] creating temporary mapsets in a parallelized python script

2016-04-12 Thread Helmut Kudrnovsky
wenzeslaus wrote > On Mon, Apr 11, 2016 at 5:19 PM, Helmut Kudrnovsky > hellik@ > wrote: > >> > I see, then it's easier to fix the script and use grass.use_temp_region >> >> From the manual: >> >> script.core.use_temp_region()[source]¶ >> Copies the current region to a temporary region with

Re: [GRASS-dev] creating temporary mapsets in a parallelized python script

2016-04-11 Thread Vaclav Petras
On Mon, Apr 11, 2016 at 5:19 PM, Helmut Kudrnovsky wrote: > > I see, then it's easier to fix the script and use grass.use_temp_region > > From the manual: > > script.core.use_temp_region()[source]¶ > Copies the current region to a temporary region with “g.region save=”, then >

Re: [GRASS-dev] creating temporary mapsets in a parallelized python script

2016-04-11 Thread Helmut Kudrnovsky
Anna Petrášová wrote > On Mon, Apr 11, 2016 at 4:46 PM, Helmut Kudrnovsky > hellik@ > wrote: >> Anna Petrášová wrote >>> On Mon, Apr 11, 2016 at 4:04 PM, Helmut Kudrnovsky >> >>> hellik@ >> >>> wrote: Hi, in a parallelized python script it is needed to do the parallelized

Re: [GRASS-dev] creating temporary mapsets in a parallelized python script

2016-04-11 Thread Anna Petrášová
On Mon, Apr 11, 2016 at 4:46 PM, Helmut Kudrnovsky wrote: > Anna Petrášová wrote >> On Mon, Apr 11, 2016 at 4:04 PM, Helmut Kudrnovsky > >> hellik@ > >> wrote: >>> Hi, >>> >>> in a parallelized python script it is needed to do the parallelized jobs >>> in >>> different mapsets as

Re: [GRASS-dev] creating temporary mapsets in a parallelized python script

2016-04-11 Thread Helmut Kudrnovsky
Anna Petrášová wrote > On Mon, Apr 11, 2016 at 4:04 PM, Helmut Kudrnovsky > hellik@ > wrote: >> Hi, >> >> in a parallelized python script it is needed to do the parallelized jobs >> in >> different mapsets as region settings are changed during calculations. > > are you sure you need separate

Re: [GRASS-dev] creating temporary mapsets in a parallelized python script

2016-04-11 Thread Anna Petrášová
On Mon, Apr 11, 2016 at 4:04 PM, Helmut Kudrnovsky wrote: > Hi, > > in a parallelized python script it is needed to do the parallelized jobs in > different mapsets as region settings are changed during calculations. are you sure you need separate mapsets? You can also just use

[GRASS-dev] creating temporary mapsets in a parallelized python script

2016-04-11 Thread Helmut Kudrnovsky
Hi, in a parallelized python script it is needed to do the parallelized jobs in different mapsets as region settings are changed during calculations. Any hints how to create temporary mapsets? Already existing pygrass / pyscript functions? thanks - best regards Helmut -- View this