queue

Laravel: Running queue:listen continuously on Windows Azure Web App

大兔子大兔子 提交于 2019-12-04 21:52:26
问题 I feel a little bit silly for asking this question but I can't seem to find an answer on the internet for this problem. After searching for several hours I figured out that on a linux server you use Supervisor to run "php artisan queue:listen" (either with or without daemon) continuously on your website to handle jobs pushed to the queue. This is all well and good, but what if I want to do this on a Windows Azure web app? After searching around the solutions I found were: Make a chron job to

Algorithm for sharing jobs by two executors

随声附和 提交于 2019-12-04 21:47:46
I encountered the following problem, while testing some web-site: John and Mary founded J&M publishing house and bought two old printers to equip it. Now they have their first commercial deal - to print a document consisting of N pages. It appears that printers work at different speed. One produces a page in X seconds and other does it in Y seconds. So now company founders are curious about minimum time they can spend on printing the whole document with two printers. (taken from here http://codeabbey.com/index/task_view/two-printers ) I thought it is the problem for greedy algorithm, but it is

Python iterable Queue

穿精又带淫゛_ 提交于 2019-12-04 21:26:18
问题 I need to know when a Queue is closed and wont have more items so I can end the iteration. I did it by putting a sentinel in the queue: from Queue import Queue class IterableQueue(Queue): _sentinel = object() def __iter__(self): return self def close(self): self.put(self._sentinel) def next(self): item = self.get() if item is self._sentinel: raise StopIteration else: return item Given that this is a very common use for a queue, isn't there any builtin implementation? 回答1: A sentinel is a

Consume from Queue with multiple threads/tasks

半城伤御伤魂 提交于 2019-12-04 21:11:29
I have a producer that gets users from a resource and places them into a ConcurrentQueue, then What I want to do is using multiple consumers and process all users and get their information from another resource. public void Populate(IEnumerable<Users> users){ _queue.Enqueue(users); // here single threaded } public void Process(){ // here i want this to be processed by multiple consumers // say multiple threads so that I can finish processing them. } My question is, should i use thread? task? ThreadPool? I have seen this question: C# equivalent for Java ExecutorService.newSingleThreadExecutor()

How to implement thread safe queues

为君一笑 提交于 2019-12-04 20:30:53
问题 I have used multithreading library before in Python, but this is the first time I am trying threading in C. I want to create pool of workers. In turn, these workers supposed to push to or pop from queue.Following code is not quite there yet, but is what I have done so far: #include <stdio.h> #include <stdlib.h> #include <pthread.h> #define NUMTHREADS 20 /* number of threads to create */ typedef struct node node; typedef struct queue queue; struct node { char *name; node *next; }; struct queue

Multiprocessing : NULL result without error in PyObject_Call

我们两清 提交于 2019-12-04 20:15:22
问题 Here is a sample program where I use multiprocessing. The calculations are done with multiprocessing.Process and the results are collected using multiprocessing.Queue . #THIS PROGRAM RUNS WITH ~40Gb RAM. (you can reduce a,b,c for less RAM #but then it works for smaller values) #PROBLEM OCCURS ONLY FOR HUGE DATA. from numpy import * import multiprocessing as mp a = arange(0, 3500, 5) b = arange(0, 3500, 5) c = arange(0, 3500, 5) a0 = 540. #random values b0 = 26. c0 = 826. def rand_function(a,

What solutions exist for a JVM-based queue that is larger than heap?

半城伤御伤魂 提交于 2019-12-04 19:56:55
问题 I am looking at possible technology choices for queues (or perhaps streams are a better description) in a JVM-based system. Some requirements: Must be accessible from the JVM / Java. Queues must support sizes larger than the JVM heap, possibly bigger than all available RAM. Thus, support for utilizing the disk (or network) for storage is implied. Queues do not currently need to be durable past the process lifetime. Most uses of the queue will have a single producer and a single consumer.

Producer/Consumer - producer adds data to collection without blocking, consumer consumes data from collection in batch

限于喜欢 提交于 2019-12-04 19:35:41
I have a Producer/Consumer usecase which is a bit unusual. I have a real world use case with some producers which I want them to be able to add objects into a collection without blocking. The consumer (just one) should block until a certain amount of objects are available in the collection (eg. 500) and then consume them in bulk. While there are less than 500 it should block and wait for the collection to fill. I don't mind if the queue exceeds this value (700, 1000 etc.) for short amount of times. I currently don't seem to find a solution to fix this exact problem. I was thinking about using

Exception java.lang.NoSuchMethodError on java.util.Deque.push

时光毁灭记忆、已成空白 提交于 2019-12-04 19:34:59
It's really strange, Google Developer Console, error reporting page. As it seems, my application crashes on several Android devices. The exception log provided says: java.lang.NoSuchMethodError: java.util.Deque.push at com.larvalabs.svgandroid.SVGParser$SVGHandler.<init>(SVGParser.java:869) at com.larvalabs.svgandroid.SVGBuilder.build(SVGBuilder.java:147) at myapp.graphic.PictureCache.getSvgPicture(PictureCache.java:59) at myapp.graphic.PictureCache.getSvgPictureDrawable(PictureCache.java:65) at myapp.activities.startup.ActivityStartup.setupCustomGraphic(ActivityStartup.java:92) at myapp

What is the proper way to handle (in python) IOError: [Errno 4] Interrupted system call, raised by multiprocessing.Queue.get

血红的双手。 提交于 2019-12-04 18:16:29
问题 When I use multiprocessing.Queue.get I sometimes get an exception due to EINTR. I know definitely that sometimes this happens for no good reason (I open another pane in a tmux buffr), and in such a case I would want to continue working and retry the operation. I can imagine that in some other cases The error would be due to a good reason and I should stop running or fix some error. How can I distinguish the two? Thanks in advance 回答1: The EINTR error can be returned from many system calls