This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"componentState": { | |
"componentId": "...", | |
"stateDescription": "...", | |
"clusterState": {}, | |
"localState": { | |
"scope": "LOCAL", | |
"totalEntryCount": 1, | |
"state": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def prepare(): | |
"""Where something happens before the NiFi pipeline is triggered.""" | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def wait_for_update(): | |
"""DAG task.""" | |
# Initialize the following variables according to your setup / needs: | |
url_nifi_api = "https://our.cluster.address.com:9443/nifi-api/" | |
processor_id = "" # e.g. pass them via the DAG's `provide_context` functionality | |
access_payload = "" # e.g. retrieve the via Airflow's `BaseHook` functionality | |
timestamp_property= "last_tms" # the processor's attribute name | |
token = get_token(url_nifi_api, access_payload) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def finalize(): | |
"""Some code to execute after the NiFi pipeline has finished.""" | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with DAG( | |
dag_id='my_dag_name', | |
schedule_interval=None, | |
start_date=days_ago(2), | |
catchup=False, | |
) as dag: | |
preparation = PythonOperator( | |
task_id='preparation', | |
python_callable=prepare, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TABLE OF CONTENTS: | |
1. [My Header](#My-Header) | |
# My Header | |
Introduction text. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TABLE OF CONTENTS: | |
1. [My Header](#firstheader) | |
# My Header<a name="firstheader"></a> | |
Introduction text. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open(file_name, "r", encoding="utf-8") as f: | |
content = f.read().split("\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def remove_code_blocks(content: List[str]) -> List[str]: | |
content_cleaned = [] | |
code_block = False | |
for x in content: | |
# detect code blocks, act accordingly | |
if x[:3] == '```': | |
code_block = not code_block | |
elif not code_block: | |
content_cleaned.append(x) |
OlderNewer