def action_logging(f):
 @functools.wraps(f)
 def wrapper(*args, **kwargs):
  session = settings.Session()
  if (current_user and hasattr(current_user, 'username')):
   user = current_user.username
  else:
   user = 'anonymous'
  log = models.Log(event=f.__name__, task_instance=None, owner=user, extra=str(list(request.args.items())), task_id=request.args.get('task_id'), dag_id=request.args.get('dag_id'))
  if ('execution_date' in request.args):
   log.execution_date = dateparser.parse(request.args.get('execution_date'))
  session.add(log)
  session.commit()
  return f(*args, **kwargs)
 return wrapper

def action_logging ( f ) : @ functools . wraps ( f ) def wrapper ( * args , ** kwargs ) : session = settings . Session ( ) if ( current_user and hasattr ( current_user , 'username' ) ) : user = current_user . username else : user = 'anonymous' log = models . Log ( event = f . __name__ , task_instance = None , owner = user , extra = str ( list ( request . args . items ( ) ) ) , task_id = request . args . get ( 'task_id' ) , dag_id = request . args . get ( 'dag_id' ) ) if ( 'execution_date' in request . args ) : log . execution_date = dateparser . parse ( request . args . get ( 'execution_date' ) ) session . add ( log ) session . commit ( ) return f ( * args , ** kwargs ) return wrapper
decorator to log user actions .