5
5
import traceback
6
6
import uuid
7
7
8
- from flask import copy_current_request_context , has_request_context
8
+ from flask import request , copy_current_request_context , has_request_context
9
9
10
10
from ..utilities import TimeoutTracker
11
- from ..schema import LogRecordSchema
12
11
from ..deque import Deque
13
12
14
13
_LOG = logging .getLogger (__name__ )
@@ -68,8 +67,13 @@ def __init__(
68
67
if has_request_context ():
69
68
logging .debug (f"Copying request context to { self ._target } " )
70
69
self ._target = copy_current_request_context (self ._target )
70
+ try :
71
+ self .input = request .json
72
+ except BadRequest :
73
+ self .input = None
71
74
else :
72
75
logging .debug ("No request context to copy" )
76
+ self .input = None
73
77
74
78
# Private state properties
75
79
self ._status : str = "pending" # Task status
@@ -79,9 +83,6 @@ def __init__(
79
83
self ._end_time = None # Task end time
80
84
81
85
# Public state properties
82
- self .input : dict = (
83
- {}
84
- ) # Input arguments. TODO: Automate this. Currently manual via Action.dispatch_request
85
86
self .progress : int = None # Percent progress of the task
86
87
self .data = {} # Dictionary of custom data added during the task
87
88
self .log = Deque (
@@ -369,9 +370,8 @@ def emit(self, record):
369
370
:param record:
370
371
371
372
"""
372
- self .dest .append (LogRecordSchema (). dump ( record ) )
373
+ self .dest .append (record )
373
374
# TODO: think about whether any of the keys are security flaws
374
- # (this is why I don't dump the whole logrecord)
375
375
376
376
377
377
# Backwards compatibility
0 commit comments