Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is TaskTooLargeError in GAE?

I am surprised to see this error (and not even documented in the quotas)...

Exceeding 100KB, I get this error:

TaskTooLargeError: Task size must be less than 102400

Any ideas on how to handle this?

The context: the body of emails (HTML) are being passed as arguments to a task queue.

like image 282
bruno.braga Avatar asked Dec 05 '25 17:12

bruno.braga


1 Answers

You should store the body of the html in the datastore and then pass the key of that entity to the task.

The same approach is taken if you have an instance of a Model that you want to pass to a task. You normally pass the key of the entity, and the task can then fetch it.

Normally if I want to defer a method as a task I create a classmethod for an entity that takes the key as an argument, then it fetches the object, and then calls the actual method of the object. The I can either call the method direct on the entity, or deferr things when needed.

e.g.

@classmethod
def defer_cancel_supervisor(cls,contract_key):

    contract = qtrack.models.Contract.get(db.Key(contract_key))
    contract.cancel_supervisor('contract cancelled')
like image 173
Tim Hoffman Avatar answered Dec 08 '25 09:12

Tim Hoffman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!