def create_snapshot(): snapshot_repo = frappe.get_hooks("snapshot_repo", app_name="propshikari")[0] snapshot_name = get_datetime().strftime("%Y%m%d_%H%M%S") es = ElasticSearchController() print now() try: response = es.create_snapshot(snapshot_repo, snapshot_name) if not response.get("state") == "SUCCESS": send_email(["*****@*****.**"], "Propshikari Elastic Backup Operation Error", "/templates/elastic_backup_notification.html", {"error_log":response}) return response except Exception,e: print "Elastic Backup Operation Failed" print frappe.get_traceback() print "Error Occured : ",e send_email(["*****@*****.**", "*****@*****.**"], "Propshikari Elastic Backup Operation Error", "/templates/elastic_backup_notification.html", {"error_log":frappe.get_traceback()})