Command Line Interface
Instructions
The Command Line Interface (CLI) has been created with the click Python package. It provides an easy way to build and handle command line arguments.
Note
As of v1.2.1, the STAC TEMPLATE has a default value embedded in the package, so does not need to be provided unless you are applying additional constraints to the records.
The standard command to run the flight pipeline is flight-pipeline flight-upload. The following arguments can be supplied via the CLI, or using other methods as shown:
new_flights_dir: Directory holding the flights to be pushed. This can also be set in theFLIGHT_CONFIGline 2. See below for details of how to use the config file.archive_path: Directory to cache flights that have been pushed to Elasticsearch/STAC. This can also be set in theFLIGHT_CONFIG, line 4.update: Add to update the ES index using content from the archive directory. For example if an attribute has changed, this can be used to reupload the existing record.reindex: Used to migrate the current index.config_file: Specify the location of the config file. To avoid a long command string, this can be set using the$FLIGHT_CONFIGenvironment variable instead.settings_file: Elasticsearch connection settings file path. To avoid a long command string, this can be set using the$FLIGHT_CONNECTIONenvironment variable instead.stac_template: STAC template to apply to all new records. To avoid a long command string, this can be set using the$STAC_TEMPLATEenvironment variable instead.verbose: Level of logging (-vgives info messages,-vvgives debug messages)keep_files: Default behaviour is to move files from thenew_flightsdirectory into thearchiveafter pushing. For testing it may be optimal to turn this off, by adding this flag.
Using environment variables
Set
FLIGHT_CONFIG,FLIGHT_CONNECTIONandSTAC_TEMPLATE.Run with command
flight-pipeline flight-updateif all above values are configured using environment variables etc.
Using flags with the config file
CLI flags will override any environment variables that are set.
Run with command
flight-pipeline flight-update --config_file /path/to/config --settings_file /path/to/json --stac_template /path/to/template.
Without using config file
The flights paths can be set directly, but settings_file and stac_template need to be provided still (flag or environment variable.)
Run with command
flight-pipeline flight-update --new_flights_dir /add --archive_path /archive --settings_file /path/to/json --stac_template /path/to/template
When running the help command flight-pipeline --help
Usage: flight-pipeline [OPTIONS] COMMAND [ARGS]…
Command Line Interface for flight update
- Options:
- --help
Show this message and exit.
- Commands:
flight-update Main function running the flight_update.py script based…
When running the help command flight-pipeline flight-update --help
Usage: flight-pipeline flight-update [OPTIONS]
Main function running the flight_update.py script based on the given command line parameters
Options:
- --logging BOOLEAN
Enable logging (True/False)
- --enable_console_logging BOOLEAN
Log to console (True/False)
- --archive_path TEXT
Set archive path [required]
- --flights_dir TEXT
Set path where flights will be pushed [required]
- --add_mode TEXT
Set mode to just add flights
- --update_mode TEXT
Set mode to update flights
- --update_id TEXT
Update based on specific id
- --help
Show this message and exit.