Opened 6 years ago

Closed 6 years ago

#1895 closed enhancement (fixed)

Pre/post-processing hooks in wcst_import

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_path: wcst_import will consider the specified path(s) as the actual file(s) to be ingested after running the hook, rather than the original file. This is an array of paths where globbing is allowed (same as the "input":"paths" option).

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_path": ["${file:path}.projected"]
  },
  {
    "description": "remove generated files.",
    "when": "after_ingestion",
    "cmd": "rm -f ${file:path}.projected"
  },
]

Note: this ticket depends on #1897, the current model would not allow for general pre/post-processing of each file

Change History (4)

comment:1 by Dimitar Misev, 6 years ago

Description: modified (diff)

comment:2 by Dimitar Misev, 6 years ago

Description: modified (diff)

comment:3 by Dimitar Misev, 6 years ago

Description: modified (diff)

comment:4 by Bang Pham Huu, 6 years ago

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