Opened 6 years ago

Last modified 6 years ago

#1895 closed enhancement

Pre/post-processing hooks in wcst_import — at Version 1

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 (last modified by Dimitar Misev)

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:

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 != 0
    • replace_filepath: wcst_import will consider the specified path the actual file to be ingested after running the hook, 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": "${file:path}.projected"
  },
  {
    "description": "remove generated files.",
    "when": "after_ingestion",
    "cmd": "rm -f ${file:path}.projected"
  },
]

Change History (1)

comment:1 by Dimitar Misev, 6 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.