long-running-processes

How to run long-lasting process asynchronously under asp.net?

守給你的承諾、 提交于 2019-11-30 20:08:46
.net 4.5, asp.net mvc: What is the best way to run long-lasting process (1-2 minutes) from ASP.NET application giving it should be run in a single-threaded environment, I mean the process is initiated for one user at a time only, executions for all other users have to wait till the current execution is done? The scenario is the following: user clicks button that run some sort of long-lasting calculations, http response returned to the user immediately, then user has to request status of the calculations with separate request manually. Asp.net http session abortion should not lead to the

Pattern for long-running operation with cancellation ability

岁酱吖の 提交于 2019-11-30 19:32:50
问题 In order to perform long-running (let it be search in this context) operation, I put the loading logic inside a TPL task, so the general method Search() is called on background thread. Search() operation can be long enough, so I need the ability to cancel it properly, using the CancellationToken . But the Search() operation did not return until it finished, so I have to do some logic in order to implement convenient and (!) fast cancellation. Using WaitHandle's I can implement something like

How to start a long-running process from a Django view?

时光毁灭记忆、已成空白 提交于 2019-11-28 18:52:07
I need to run a process that might take hours to complete from a Django view. I don't need to know the state or communicate with it but I need that view to redirect away right after starting the process. I've tried using subprocess.Popen , using it within a new threading.Thread , multiprocessing.Process . However, the parent process keeps hanging until child terminates. The only way that almost gets it done is using a fork. Obviously that isn't good as it leaves a zombie process behind until parent terminates. That's what I'm trying to do when using fork: if os.fork() == 0: subprocess.Popen(["

Calling a long running process asynchronously on a button click in JSF

白昼怎懂夜的黑 提交于 2019-11-28 12:57:26
I want to execute a stored proc by clicking on a button developed in JSF and Java. The proc takes roughly around 30 minutes in execution. When the user clicks on this button, s/he should get a default message like - Data is being processed. Kindly login after 60 minutes to check the data. Now when we click on the button, the UI Page hangs for the time when the proc is getting executed. Is there a workaround to show this default message and run the proc in the backend? Just trigger an @Asynchronous EJB method. It'll fire and forget a separate thread and the bean action method will immediately

Run arbitrary subprocesses on Windows and still terminate cleanly?

旧时模样 提交于 2019-11-28 07:37:17
I have an application A that I would like to be able to invoke arbitrary other processes as specified by a user in a configuration file. Batch script B is one such process a user would like to be invoked by A. B sets up some environment variables, shows some messages and invokes a compiler C to do some work. Does Windows provide a standard way for arbitrary processes to be terminated cleanly? Suppose A is run in a console and receives a CTRL+C. Can it pass this on to B and C? Suppose A runs in a window and the user tries to close the window, can it cancel B and C? TerminateProcess is an option

Long running REST API with queues

半城伤御伤魂 提交于 2019-11-27 16:53:45
We are implementing a REST API, which will kick off multiple long running backend tasks. I have been reading the RESTful Web Services Cookbook and the recommendation is to return HTTP 202 / Accepted with a Content-Location header pointing to the task being processed. (e.g. http://www.example.org/orders/tasks/1234 ), and have the client poll this URI for an update on the long running task. The idea is to have the REST API immediately post a message to a queue, with a background worker role picking up the message from the queue and spinning up multiple backend tasks, also using queues. The

Flask long routines

倖福魔咒の 提交于 2019-11-27 16:45:56
问题 I have to do some long work in my Flask app. And I want to do it async. Just start working, and then check status from javascript. I'm trying to do something like: @app.route('/sync') def sync(): p = Process(target=routine, args=('abc',)) p.start() return "Working..." But this it creates defunct gunicorn workers. How can it be solved? Should I use something like Celery? 回答1: There are many options. You can develop your own solution, use Celery or Twisted (I'm sure there are more already-made

How to start a long-running process from a Django view?

一个人想着一个人 提交于 2019-11-27 11:42:45
问题 I need to run a process that might take hours to complete from a Django view. I don't need to know the state or communicate with it but I need that view to redirect away right after starting the process. I've tried using subprocess.Popen , using it within a new threading.Thread , multiprocessing.Process . However, the parent process keeps hanging until child terminates. The only way that almost gets it done is using a fork. Obviously that isn't good as it leaves a zombie process behind until

Cherrypy : which solutions for pages with large processing time

冷暖自知 提交于 2019-11-27 06:23:18
问题 I have a website powered by cherrypy. For some pages, I need quite a long processing time (a multi-join SQL request on a several-million-row DB). The processing needs sometimes 20 seconds or more, and the browser get crashed because it is too long. I'm wondering what would be a nice solution here. 回答1: Everything here depends on a volume of the website. CherryPy is a threaded server and once every thread is waiting for database, new requests won't be processed. There's also aspect of request

Run arbitrary subprocesses on Windows and still terminate cleanly?

人走茶凉 提交于 2019-11-27 01:53:30
问题 I have an application A that I would like to be able to invoke arbitrary other processes as specified by a user in a configuration file. Batch script B is one such process a user would like to be invoked by A. B sets up some environment variables, shows some messages and invokes a compiler C to do some work. Does Windows provide a standard way for arbitrary processes to be terminated cleanly? Suppose A is run in a console and receives a CTRL+C. Can it pass this on to B and C? Suppose A runs