Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

airflow schedule interval timezone

from airflow.models import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime

import pytz
tz = pytz.timezone('Asia/Dubai')


def localize_utc_tz(d):
    return tz.fromutc(d)

default_args = {
    'start_date': datetime(2017, 11, 8),
}
dag = DAG(
    'plus_4_utc',
    default_args=default_args,
    schedule_interval='0 20 * * *',
    user_defined_filters={
        'localtz': localize_utc_tz,
    },
)
task = BashOperator(
        task_id='task_for_testing_file_log_handler',
        dag=dag,
        bash_command='echo UTC {{ ts }}, Local {{ execution_date | localtz }} next {{ next_execution_date | localtz }}',
)
Comment

PREVIOUS NEXT
Code Example
Python :: python while variable is not 
Python :: Sum of all substrings of a number 
Python :: how to repeat a row in pandas 
Python :: python using end keyword 
Python :: date to timestamp python 
Python :: python dictionary with dot notation 
Python :: multiprocessing while applying a function in pandas 
Python :: how to define number in python 
Python :: pandas show all dataframe method 
Python :: Set path for another directory 
Python :: pip in python 
Python :: tkinter video 
Python :: ** in python 
Python :: how to create an app under a folder in django 
Python :: gfg placement course 
Python :: python catch int conversion error 
Python :: maximum subarray sum 
Python :: How to make a function repeat itself a specifc amount of times python 
Python :: Convert Int to String Using format() method 
Python :: windows python absolute path 
Python :: how to add hyperlink in jupyter notebook 
Python :: python linter online 
Python :: download video to from pytube with a special name 
Python :: Python enumerate Using enumerate() 
Python :: queue peek python 
Python :: find location of max value in python list 
Python :: create array with shape 0,2 
Python :: free wifi connection disconnects frequently windows 10 
Python :: parallel iteration python 
Python :: python hash timestamp 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =