Skip to content

Instantly share code, notes, and snippets.

@nickefy
Created June 6, 2021 18:08
Show Gist options
  • Save nickefy/401e84cb3a37ccd0711f136fb0bff6c3 to your computer and use it in GitHub Desktop.
Save nickefy/401e84cb3a37ccd0711f136fb0bff6c3 to your computer and use it in GitHub Desktop.
Airflow Operator without Framework
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
from os import environ
class PrintText(BaseOperator):
@apply_defaults
def __init__(
self,
text_to_print,
*args, **kwargs):
super(PrintText, self).__init__(*args, **kwargs)
self.text_to_print = text_to_print
def __print_text(self):
print(text_to_print)
def execute(self, context):
self.__print_text()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment