def enqueue_events_for_all_sites():
 with frappe.init_site():
  jobs_per_site = get_jobs()
  sites = get_sites()
 for site in sites:
  try:
   enqueue_events_for_site(site=site, queued_jobs=jobs_per_site[site])
  except:
   print frappe.get_traceback()

def enqueue_events_for_all_sites ( ) : with frappe . init_site ( ) : jobs_per_site = get_jobs ( ) sites = get_sites ( ) for site in sites : try : enqueue_events_for_site ( site = site , queued_jobs = jobs_per_site [ site ] ) except : print frappe . get_traceback ( )
loop through sites and enqueue events that are not already queued .