task-queue

Why does my Google App Engine Mail API calls still result in a DeadlineExceededError despite putting them in a task queue?

混江龙づ霸主 提交于 2021-02-19 04:04:31
问题 I have a Python function that adds a task queue for each email address in my mailing list (thousands each time I mail them). The problem is that, even though each mail was to be sent via execution in a task queue, I still get this dreaded error: DeadlineExceededError: The API call mail.Send() took too long to respond and was cancelled. Any solutions? 回答1: The deadline happens during communication between your GAE instance and the RPC server that handles the mail.Send call. This, in turn,

How to execute code in Django after response has been sent to the client (on PythonAnywhere)?

寵の児 提交于 2021-01-29 18:28:37
问题 I'm looking for a way to execute code in Django after the response has been sent to the client. I know the usual way is to implement a task queue (e.g., Celery). However, the PaaS service I'm using (PythonAnywhere) doesn't support task queues as of May 2019. It also seems overly complex for a few simple use cases. I found the following solution on SO: Execute code in Django after response has been sent to the client. The accepted answer works great when run locally. However, in production on

Flask-Socketio not emitting from external RQ process

房东的猫 提交于 2020-12-13 18:51:03
问题 I'm running a flask server that connects to an iOS client with Flask-Socketio. The server has to process some complicated data, and since that takes a while to solve, I do it in a background job using Redis Queue. Communication works fine normally, but I need to emit to the client, and write to database once the job finishes, and I am trying to do that from the job function (if there is a way to let the app know when the job is finished, the app could handle all communication in one place).

Flask-Socketio not emitting from external RQ process

时间秒杀一切 提交于 2020-12-13 18:50:46
问题 I'm running a flask server that connects to an iOS client with Flask-Socketio. The server has to process some complicated data, and since that takes a while to solve, I do it in a background job using Redis Queue. Communication works fine normally, but I need to emit to the client, and write to database once the job finishes, and I am trying to do that from the job function (if there is a way to let the app know when the job is finished, the app could handle all communication in one place).

Flask-Socketio not emitting from external RQ process

给你一囗甜甜゛ 提交于 2020-12-13 18:50:29
问题 I'm running a flask server that connects to an iOS client with Flask-Socketio. The server has to process some complicated data, and since that takes a while to solve, I do it in a background job using Redis Queue. Communication works fine normally, but I need to emit to the client, and write to database once the job finishes, and I am trying to do that from the job function (if there is a way to let the app know when the job is finished, the app could handle all communication in one place).

How do I return flask render_template after the Redis background job is done?

放肆的年华 提交于 2020-04-11 12:08:28
问题 I have this web app in a flask where I want to execute some ML and AI algorithms after a form is submitted. I am running the ML and AI algorithms in a background job with the help of Redis and rq ( because I have my app hosted by Heroku and they have this timeout thing where you have to return a response within 30 seconds). After the job is done I would like to get the images made by the algorithms ( some graphs ) and output them in a web page, but I have no idea how to render a template in a

taskqueue and non-idempotent tasks

百般思念 提交于 2020-01-25 00:59:06
问题 I'm working on a voting app, where the user can upload a list of email addresses for all of the voters. After doing some error checking, I create a Voter entity for each voter. Since there can be a large number of voters, I create the Voter entities in a taskqueue to avoid the 30 second limit and the task looks like this: put_list = [] for email, id in itertools.izip(voter_emails, uuids): put_list.append(Voter(election = election, email = email, uuid = id)) election.txt_voters = "" put_list

How to create a ``depends_on`` relationship between scheduled and queued jobs in python-rq

笑着哭i 提交于 2020-01-24 04:09:21
问题 I have a web service (Python 3.7, Flask 1.0.2) with a workflow consisting of 3 steps: Step 1: Submitting a remote compute job to a commercial queuing system (IBM's LSF) Step 2: Polling every 61 seconds for the remote compute job status (61 seconds because of cached job status results) Step 3: Data post-processing if step 2 returns remote compute job status == "DONE" The remote compute job is of arbitrary length (between seconds and days) and each step is dependent on the completion of the

How to create a ``depends_on`` relationship between scheduled and queued jobs in python-rq

感情迁移 提交于 2020-01-24 04:09:05
问题 I have a web service (Python 3.7, Flask 1.0.2) with a workflow consisting of 3 steps: Step 1: Submitting a remote compute job to a commercial queuing system (IBM's LSF) Step 2: Polling every 61 seconds for the remote compute job status (61 seconds because of cached job status results) Step 3: Data post-processing if step 2 returns remote compute job status == "DONE" The remote compute job is of arbitrary length (between seconds and days) and each step is dependent on the completion of the

Google App Engine Payload Object

余生颓废 提交于 2020-01-15 08:01:12
问题 How to send a class object in the payload of a task in python? I want to send an object in the parameters of a task. When I use simplejson , I get the error: Object is not serializable . When I use pickle, I get KeyValue Error . How to do this ? This is the class which I want to serialize class Matrix2D_icfg: name = "" indices = [] value = {} def __init__(self,s): self.name = s self.indices = [] def __getitem__(self,i): self.indices.append(i) if len(self.indices)==2: (m,n) = self.indices self