Opened 3 years ago

Closed 3 years ago

#2538 closed enhancement (fixed)

wcst_import - support python_cmd to run python command in hooks

Reported by: Bang Pham Huu Owned by: Bang Pham Huu
Priority: major Milestone: 10.0
Component: wcst_import Version: 9.8
Keywords: Cc: Dimitar Misev, Vlad Merticariu
Complexity: Medium

Description

For example, one can specify the python_cmd besides the cmd in the hook, like below:

Here, "cmd" will be executed before "python_cmd".

"hooks": [
    {
      "description": "remove files with invalid bbox",
      "when": "before_import",
      "cmd": "rc=$(echo \"${gdal:minX} >= -180.0 && ${gdal:maxX} <= 180.0 && ${gdal:minY} >= -90.0 && ${gdal:maxY} <= 90.0\" | bc -l); [ \"$rc\" = 0 ] && echo \"${file:path}\" || echo valid",
      "python_cmd": "print 'Done'",
      "abort_on_error": false
    }
]

Change History (3)

comment:1 by Bang Pham Huu, 3 years ago

The cmd and python_cmd are exclusively. Only one of them can be used by a hook.

comment:2 by Dimitar Misev, 3 years ago

  • cmd and python_cmd should be exclusive, throw an error if both are specified
  • document that the python_cmd is executed in the wcst_import python instance
  • document that the disadvantage of bash cmd is that for each file a bash shell will be forked, which can be expensive for many files

comment:3 by Bang Pham Huu, 3 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.