CLI for Managing Airflow Syncers

In addition to being able to control your Airflow Syncers via UI, you can create a new Airflow Syncer in the databand using the command line.

Make sure, prior to running, that you have DATABAND_URL and DATABAND_ACCESS_TOKEN set to the correct values. You can read more about how to do that on the Connecting DBND to Databand page.

Add

To create a new Airflow syncer you need to run the dbnd airflow-sync add command with the following arguments:

FieldDescriptionRequired / Optional
--urlAirflow server urlRequired
--external-urlExternal url for instanceOptional. Default: None
--nameName for the syncerOptional. Default: None
--fetcher [web|db]Set always to db, unless you are not using databand_airflow_monitor dagOptional Default: db
--envThe environment name for the syncerOptional. Default: None
--include-sources (flag)Monitor source code for tasksOptional. Default: False
--dag-idsList of specific dag ids (separated with comma) that monitor will fetch only from themOptional. Default: None
--last-seen-dag-run-idId of the last dag run seen in the Airflow databaseOptional
--last-seen-log-idId of the last log seen in the Airflow databaseOptional
--generate-tokenGenerate access token for the syncer, value is token lifespanOptional. Default: None
--config-file-outputStore syncer config json to fileOptional. Default: -
--with-auto-alerts (flag)Create syncer with auto alerts configOptional. Default: False
--include-logs-bytes-from-head [0-8096]Include the number of bytes from the head of the log fileOptional. Default: 0
--include-logs-bytes-from-end [0-8096]Include the number of bytes from the end of the log fileOptional. Default: 0
--dag-run-bulk-sizeDAG run bulk size for the syncerOptional. Default: None
--start-time-windowStart time window for the syncer (X days backwards)Optional. Default: None

Add example:

dbnd airflow-sync add --url http://airflow:8082 --fetcher db --name my_airflow

Edit:

You can use all params from add, excluding --generate-token and --config-file-output

FieldDescriptionRequired / Optional
--tracking-source-uidTracking source uid of the edited airflow syncer. (you can get this with the "list" command)Required

Edit example

 dbnd airflow-sync edit --tracking-source-uid c9cc2928-6966-11ac-ba39-adde48001122 \
          --url http://airflow:8082 --fetcher db --name my_airflow

Did this page help you?