This file contains hidden or 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
| ### Local Airflow Parity Tools Specific Guidelines | |
| # Consistent {Component}Controller/Orchestrator | |
| # Proper init/cleanup | |
| # Docker health checks + retries | |
| # Proxy/network standards | |
| # Secret Manager integration | |
| # Use Cement framework | |
This file contains hidden or 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
| #!/bin/bash | |
| ############################################################################ | |
| # Author: Martin Zajac | |
| # Script Name: manage_dag.sh | |
| # Purpose: This script manages Google Cloud Composer DAGs by allowing users | |
| # to perform various actions such as listing DAGs, running tasks, | |
| # pausing/unpausing DAGs, streaming logs, and copying files to | |
| # the Composer environment's DAG folder. | |
| # |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| """Easily put time restrictions on things | |
| Note: Requires Python 3.x | |
| Usage as a context manager: | |
| ``` | |
| with timeout(10): | |
| something_that_should_not_exceed_ten_seconds() | |
| ``` |
This file contains hidden or 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
| import os, sys | |
| airflow_core_sqlalchemy_conn = f"postgresql+psycopg2://{os.environ.get('AIRFLOW_DB_USER')}:{os.environ.get('AIRFLOW_DB_PASS')}@{os.environ.get('AIRFLOW_DB_HOST')}:{os.environ.get('AIRFLOW_DB_PORT')}/airflow" | |
| os.environ['AIRFLOW__CORE__SQL_ALCHEMY_CONN'] = airflow_core_sqlalchemy_conn | |
| print(airflow_core_sqlalchemy_conn) |
This file contains hidden or 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
| """ lists environment variables, and splits elements in path variable """ | |
| import os | |
| for k, v in sorted(os.environ.items()): | |
| print(k+':', v) | |
| print('\n') | |
| # list elements in path environment variable | |
| [print(item) for item in os.environ['PATH'].split(';')] |
This file contains hidden or 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
| """BASELINE | |
| Revision ID: 98d0325960d8 | |
| Revises: | |
| Create Date: 2021-03-18 16:56:53.584644 | |
| """ | |
| import sqlalchemy as sa | |
| from sqlalchemy.exc import SQLAlchemyError | |
| from alembic import op |
This file contains hidden or 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
| find . -type f -maxdepth 1 | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq -c | sort -n |
This file contains hidden or 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
| """ | |
| Assuming feature.py implements class Feature(ArgBaseClass), then the above invocation of load_subclasses will return { 'feature' : <Feature object> }. The same kwargs (foo = bar) will be passed into the Feature class. | |
| #!/usr/bin/env python3 | |
| import os, pkgutil, importlib, inspect | |
| """ | |
| class ArgBaseClass(): | |
| # Assign all keyword arguments as properties on self, and keep the kwargs for later. | |
| def __init__(self, **kwargs): | |
| self._kwargs = kwargs |
This file contains hidden or 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
| """ | |
| Response to | |
| http://stackoverflow.com/a/22904200/1320237 | |
| """ | |
| import json.scanner | |
| import json.decoder | |
| from json.decoder import JSONDecoder | |
| class FileString(object): |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| import os | |
| import json | |
| import random | |
| import zipfile | |
| config = { | |
| "color": "red", | |
| "amount": 42.24, |
NewerOlder