55import traceback
66import uuid
77
8- from flask import copy_current_request_context , has_request_context
8+ from flask import request , copy_current_request_context , has_request_context
99
1010from ..utilities import TimeoutTracker
11- from ..schema import LogRecordSchema
1211from ..deque import Deque
1312
1413_LOG = logging .getLogger (__name__ )
@@ -68,8 +67,13 @@ def __init__(
6867 if has_request_context ():
6968 logging .debug (f"Copying request context to { self ._target } " )
7069 self ._target = copy_current_request_context (self ._target )
70+ try :
71+ self .input = request .json
72+ except BadRequest :
73+ self .input = None
7174 else :
7275 logging .debug ("No request context to copy" )
76+ self .input = None
7377
7478 # Private state properties
7579 self ._status : str = "pending" # Task status
@@ -79,9 +83,6 @@ def __init__(
7983 self ._end_time = None # Task end time
8084
8185 # Public state properties
82- self .input : dict = (
83- {}
84- ) # Input arguments. TODO: Automate this. Currently manual via Action.dispatch_request
8586 self .progress : int = None # Percent progress of the task
8687 self .data = {} # Dictionary of custom data added during the task
8788 self .log = Deque (
@@ -369,9 +370,8 @@ def emit(self, record):
369370 :param record:
370371
371372 """
372- self .dest .append (LogRecordSchema (). dump ( record ) )
373+ self .dest .append (record )
373374 # TODO: think about whether any of the keys are security flaws
374- # (this is why I don't dump the whole logrecord)
375375
376376
377377# Backwards compatibility
0 commit comments