pool

Spring transaction hangs for iptables command

混江龙づ霸主 提交于 2019-12-24 04:48:11
问题 As part of error handling for our processes, we have tried to disable the communication between the process to the database machine listener port using the following iptables command iptables -A INPUT -p tcp --destination-port <database-listener-port> -s <database-host-ip> -j DROP However, this cause the process to get stuck with the following log coming from AbstractPlatformTransactionManager::getTransaction DEBUG: Creating new transaction with name [<Transaction-Name>]: PROPAGATION_REQUIRED

repairing misconfigured mirrored zfs pool

旧街凉风 提交于 2019-12-24 03:26:21
问题 My machine boots from a mirrored zfs pool of two USB devices. The pool used to look like this: sudo zpool status pool: freenas-boot state: ONLINE scan: resilvered 891M in 15h19m with 0 errors on Wed Mar 29 03:29:55 2017 config: NAME STATE READ WRITE CKSUM freenas-boot ONLINE 0 0 0 mirror-0 ONLINE 0 0 0 da0p2 ONLINE 0 0 3 da1p2 ONLINE 0 0 0 errors: No known data errors I tried to replace the media with the checksum error, but through a series of incorrectly used commands I ended up "adding"

How to use python multiprocessing Pool.map within loop

懵懂的女人 提交于 2019-12-24 00:28:08
问题 I am running a simulation using Runge-Kutta. At every time step two FFT of two independent variables are necessary which can be parallelized. I implemented the code like this: from multiprocessing import Pool import numpy as np pool = Pool(processes=2) # I like to calculate only 2 FFTs parallel # in every time step, therefor 2 processes def Splitter(args): '''I have to pass 2 arguments''' return makeSomething(*args): def makeSomething(a,b): '''dummy function instead of the one with the FFT'''

C3P0 Creating too many Threads and Timers

假如想象 提交于 2019-12-23 12:58:13
问题 I have a Java webapp running on Tomcat, with Hibernate and C3P0. All entity classes and JPA Controllers were done with Netbeans wizzard. There is a servlet that when called inserts many objects in the database (using the JPA controllers). The problem is that looking at my webapp with Java VisualVM I found that there are a lot of Timers and com.mchange.v2.async.ThreadPoolAsynchronousRunner classes, and it grows as time pass. For every Timer there are 3 Threads created. All the Threads and

How to loop select() to poll for data ad infinitum

和自甴很熟 提交于 2019-12-23 10:00:02
问题 #include <stdio.h> #include <unistd.h> #include <sys/time.h> #include <sys/types.h> int main () { char name[20]; fd_set input_set; struct timeval timeout; int ready_for_reading = 0; int read_bytes = 0; /* Empty the FD Set */ FD_ZERO(&input_set ); /* Listen to the input descriptor */ FD_SET(0, &input_set); /* Waiting for some seconds */ timeout.tv_sec = 10; // 10 seconds timeout.tv_usec = 0; // 0 milliseconds /* Invitation for the user to write something */ printf("Enter Username: (in 15

Python HTTPConnectionPool Failed to establish a new connection: [Errno 11004] getaddrinfo failed

亡梦爱人 提交于 2019-12-23 02:17:12
问题 I was wondering if my requests is stopped by the website and I need to set a proxy.I first try to close the http's connection ,bu I failed.I also try to test my code but now it seems no outputs.Mybe I use a proxy everything will be OK? Here is the code. import requests from urllib.parse import urlencode import json from bs4 import BeautifulSoup import re from html.parser import HTMLParser from multiprocessing import Pool from requests.exceptions import RequestException import time def get

Is there a generic “Object Pool” implementation for Delphi?

空扰寡人 提交于 2019-12-22 09:53:57
问题 I came across this while looking for a database connection pool implementation for Delphi. An object pool needs two methods: get - to acquire an object from the pool (this will create a new instance if the pool is empty or its size has not reached its maximum size), this methods must be thread safe so that one object can not be acquired by two threads at the same time. If all objects are iin use, the get method must block (maybe with an optional time out) put - to release (return) an object

python no output when using pool.map_async

让人想犯罪 __ 提交于 2019-12-22 00:29:56
问题 I am experiencing very strange issues while working with the data inside my function that gets called by pool.map. For example, the following code works as expected... import csv import multiprocessing import itertools from collections import deque cur_best = 0 d_sol = deque(maxlen=9) d_names = deque(maxlen=9) **import CSV Data1** def calculate(vals): #global cur_best sol = sum(int(x[2]) for x in vals) names = [x[0] for x in vals] print(", ".join(names) + " = " + str(sol)) def process(): pool

Mulitprocess Pools with different functions

风流意气都作罢 提交于 2019-12-21 06:58:31
问题 Most examples of the Multiprocess Worker Pools execute a single function in different processes, f.e. def foo(args): pass if __name__ == '__main__': pool = multiprocessing.Pool(processes=30) res=pool.map_async(foo,args) Is there a way to handle two different and independent functions within the pool? So that you could assign f.e. 15 processes for foo() and 15 processes for bar() or is a pool bounded to a single function? Or du you have to create different processes for different functions

Alternative use patterns for python multiprocessing avoiding proliferation of global state?

百般思念 提交于 2019-12-20 23:59:13
问题 This (enormously simplified example) works fine (Python 2.6.6, Debian Squeeze): from multiprocessing import Pool import numpy as np src=None def process(row): return np.sum(src[row]) def main(): global src src=np.ones((100,100)) pool=Pool(processes=16) rows=pool.map(process,range(100)) print rows if __name__ == "__main__": main() however, after years of being taught global state bad!!! , all my instincts are telling me I really really would rather be writing something closer to: from