Opened 6 years ago
Last modified 6 years ago
#1895 closed enhancement
Pre/post-processing hooks in wcst_import — at Initial Version
Reported by: | Dimitar Misev | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 9.7 |
Component: | wcst_import | Version: | development |
Keywords: | Cc: | Bang Pham Huu, Vlad Merticariu | |
Complexity: | Medium |
Description
Sometimes it is useful to run a script or program before or after ingesting each file. This would allow for preprocessing, e.g. doing gdalwarp automatically, and cleanup afterwards, helping to more fully automate the ingestion process.
Before executing the hook:
- wcst_import can provide the path to the file being processed. In the hook call this needs to be specified with
${file:path}
- in general any expressions as listed in the docs can be used: http://doc.rasdaman.org/05_geo-services-guide.html#possible-expressions
After executing the hook:
- stdout, stderr, and exit code are captured internally by wcst_import and logged
- Options only valid for pre-hooks:
abort_on_error
: abort the ingestion if exit code != 0replace_filepath
: wcst_import will consider the path printed on stdout as the actual file to be ingested, rather than the original file
Exemplified syntax in ingredients files:
"hooks": [ { "description": "reproject input files.", "when": "before_ingestion", "cmd": "gdalwarp ... ${file:path} ${file:path}.projected", "abort_on_error": true, "replace_filepath": true }, { "description": "remove generated files.", "when": "after_ingestion", "cmd": "rm -f ${file:path}.projected" }, ]
Note:
See TracTickets
for help on using tickets.