Skip to content

Instantly share code, notes, and snippets.

@CribberSix
Created October 24, 2021 16:30
Show Gist options
  • Save CribberSix/6e6bf10900e6304fa263c88134e9b22b to your computer and use it in GitHub Desktop.
Save CribberSix/6e6bf10900e6304fa263c88134e9b22b to your computer and use it in GitHub Desktop.
def startup():
# Initialize the following variables according to your setup / needs:
url_nifi_api = "https://our.cluster.address.com:9443/nifi-api/"
processor_id = "" # e.g. hardcoded / pass them via `provide_context`
access_payload = { "username": ""
,"password": ""
} # e.g. retrieve via Airflow's `BaseHook` functionality
token = get_token(url_nifi_api, access_payload)
response = update_processor_status(processor_id, "RUNNING", token, url_nifi_api)
pause(15) # wait for 15 seconds to give NiFi time to create a flow file
response = update_processor_status(processor_id, "STOPPED", token, url_nifi_api)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment