====== Code Snippets ====== # Date format import datetime current_process_date = datetime.datetime.strptime('24-07-2010', "%d-%m-%Y").date() current_process_date.strftime('We are the %d, %b %Y') print("/%s/*" % current_process_date.strftime("%Y/%m/%d")) # Check is file exists on HDFS import subprocess def run_cmd(args_list): proc = subprocess.Popen(args_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc.communicate() return proc.returncode def check_is_file_exists_hdfs(filename): cmd = ['hdfs', 'dfs', '-test', '-f', filename] code = run_cmd(cmd) return code == 0