def active(display_progress=False):
 ret = {}
 client = salt.client.get_local_client(__opts__['conf_file'])
 try:
  active_ = client.cmd('*', 'saltutil.running', timeout=__opts__['timeout'])
 except SaltClientError as client_error:
  print(client_error)
  return ret
 if display_progress:
  __jid_event__.fire_event({'message': 'Attempting to contact minions: {0}'.format(list(active_.keys()))}, 'progress')
 for (minion, data) in six.iteritems(active_):
  if display_progress:
   __jid_event__.fire_event({'message': 'Received reply from minion {0}'.format(minion)}, 'progress')
  if (not isinstance(data, list)):
   continue
  for job in data:
   if (not (job['jid'] in ret)):
    ret[job['jid']] = _format_jid_instance(job['jid'], job)
    ret[job['jid']].update({'Running': [{minion: job.get('pid', None)}], 'Returned': []})
   else:
    ret[job['jid']]['Running'].append({minion: job['pid']})
 mminion = salt.minion.MasterMinion(__opts__)
 for jid in ret:
  returner = _get_returner((__opts__['ext_job_cache'], __opts__['master_job_cache']))
  data = mminion.returners['{0}.get_jid'.format(returner)](jid)
  for minion in data:
   if (minion not in ret[jid]['Returned']):
    ret[jid]['Returned'].append(minion)
 return ret

def active ( display_progress = False ) : ret = { } client = salt . client . get_local_client ( __opts__ [ 'conf_file' ] ) try : active_ = client . cmd ( '*' , 'saltutil.running' , timeout = __opts__ [ 'timeout' ] ) except SaltClientError as client_error : print ( client_error ) return ret if display_progress : __jid_event__ . fire_event ( { 'message' : 'Attempting to contact minions: {0}' . format ( list ( active_ . keys ( ) ) ) } , 'progress' ) for ( minion , data ) in six . iteritems ( active_ ) : if display_progress : __jid_event__ . fire_event ( { 'message' : 'Received reply from minion {0}' . format ( minion ) } , 'progress' ) if ( not isinstance ( data , list ) ) : continue for job in data : if ( not ( job [ 'jid' ] in ret ) ) : ret [ job [ 'jid' ] ] = _format_jid_instance ( job [ 'jid' ] , job ) ret [ job [ 'jid' ] ] . update ( { 'Running' : [ { minion : job . get ( 'pid' , None ) } ] , 'Returned' : [ ] } ) else : ret [ job [ 'jid' ] ] [ 'Running' ] . append ( { minion : job [ 'pid' ] } ) mminion = salt . minion . MasterMinion ( __opts__ ) for jid in ret : returner = _get_returner ( ( __opts__ [ 'ext_job_cache' ] , __opts__ [ 'master_job_cache' ] ) ) data = mminion . returners [ '{0}.get_jid' . format ( returner ) ] ( jid ) for minion in data : if ( minion not in ret [ jid ] [ 'Returned' ] ) : ret [ jid ] [ 'Returned' ] . append ( minion ) return ret
list of tasks currently being executed .