landam / grass-gis-git-migration-test

0 stars 0 forks source link

Add ignore lock flag to grass command #170

Open landam opened 5 years ago

landam commented 5 years ago

Reported by wenzeslaus on 1 Jun 2015 14:20 UTC In grass.py we have -f flag to force removal of lock but to read only commands (list maps in Lacation or Mapset or get region from another Mapset) there is no need for removal, more precisely, it would be wrong. The right thing to do is to just ignore that the lock is there. It's up to the caller that only read only modules are called. Surely this can be used for parallel processing as well when same rules are applied as would be applied to parallel processing within GRASS session.

Current grass71 --help:

  -f    force removal of .gislock if exists (use with care!). Only with -text flag

Proposed grass71 --help:

  -f    force removal of .gislock if exists (use with care!)
          Only with -text and --exec flags
  -i    ignore presence of .gislock if exists (use with care!)
          Only with -text and --exec flags. Suitable for read only modules.

GRASS GIS version and provenance

svn-trunk

Migrated-From: https://trac.osgeo.org/grass/ticket/2685

landam commented 5 years ago

Comment by mlennert on 2 Jun 2015 08:12 UTC Wouldn't this mean that every module has to check whether there is a .gislock ?

You can always create another mapset and read whatever you need from there, so I don't understand the need for a read-only access to a particular mapset.

Sounds like a dangerous path to me.

Moritz

landam commented 5 years ago

Comment by wenzeslaus on 2 Jun 2015 14:22 UTC Replying to [comment:1 mlennert]:

Wouldn't this mean that every module has to check whether there is a .gislock ?

No. There would be no check. It is up to the caller. Perhaps the note about read-only shouldn't be in the parameter explanation, just in a detailed documentation. Read-only is suggestion or use case here, not something enforced.

You can always create another mapset and read whatever you need from there, so I don't understand the need for a read-only access to a particular mapset.

There is several ways around it. g.list can just read from other Mapsets and g.mapsets can give you an (actual) read-only access to other Mapset.

However, the use case here is emulate what you get when you set up GRASS environment/session manually ("http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly without starting explicitly"). You have no checks at all and you can still access and do anything. Purpose of suggested (-i) flag is to skip the lock check but still benefit from other things grass.py is doing like taking care of "gisrc" file.

Sounds like a dangerous path to me.

-f is also dangerous, and on MS Windows or when you set up GRASS environment/session manually ("http://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly without starting explicitly") there are no checks at all, so I don't think it is more dangerous than anything we have now. On the contrary, with -i you would explicitly ask for this dangerous behavior which is safer then getting it unexpectedly (in an implicit way) with manual setup of the environment or on MS Windows in general.

These things are what I considered but I might have missed something.

landam commented 5 years ago

Comment by neteler on 5 May 2016 14:08 UTC Milestone renamed

landam commented 5 years ago

Comment by neteler on 28 Dec 2016 15:04 UTC Ticket retargeted after milestone closed

landam commented 5 years ago

Modified by @landam on 5 May 2017 20:40 UTC

landam commented 5 years ago

Comment by @landam on 1 Sep 2017 20:28 UTC All enhancement tickets should be assigned to 7.4 milestone.

landam commented 5 years ago

Comment by neteler on 26 Jan 2018 11:40 UTC Ticket retargeted after milestone closed

landam commented 5 years ago

Modified by neteler on 12 Jun 2018 20:48 UTC

landam commented 5 years ago

Comment by @landam on 25 Sep 2018 16:52 UTC All enhancement tickets should be assigned to 7.6 milestone.

landam commented 5 years ago

Comment by @landam on 25 Jan 2019 21:07 UTC Ticket retargeted after milestone closed