Hello,
due to a memory leak (bug, I guess) in pyraf(or rather in IRAF) I have to fork an iterative process that goes through hundreds of image frames and does unspeakable things to them. In the child process, this returns a dictionary of image information for each image and is supposed to send it to the parent through pickle.dump. However, the child process hangs at pickle.dump and nothing happens. No error messages. The dictionary that is supposed to be dumped in the pipe is rather large, with possibly thousands of entires (about 2000-4000 is normal).
Is there some size limit on what you can dump in the pipe and in that case how do I increase it? I know nearly nothing about pipes and forks, so I'd be happy if you help.
Here's the code. Though you can't run it without rest of the functions maybe you'll see something horribly wrong with my forking?? The line "Finished dumping" never gets printed, it just hangs at "Dumping". I first thought the child is somehow unaware of the parent's import of pickle, so that's why I import it again, but that doesn't make a difference. Oh, and I do a os.execv("/bin/true",["true"]) at the end of the child because when IRAF closes in the child it apparently kills the child prematurely so then the code crashes cause there's no child. But just ignore IRAF/pyraf, just please tell me if there's some reason dump would hang in the child the way this is written.
thanks in advance. -
imagedict={}
-
-
for im in infodict:
-
Receive,Send =os.pipe()
-
pid = os.fork()
-
if pid !=0:
-
# parent
-
os.close(Send)
-
Receive = os.fdopen(Receive)
-
os.waitpid(pid, 0)
-
imagedict[im]=pickle.load(Receive) else:
-
# child
-
os.close(Receive)
-
Send=os.fdopen(Send,'w')
-
import pickle
-
tmpdict=veryLargeProcedure(im)
-
print "Dumping"
-
pickle.dump(tmpdict,Send)
-
print "finished dumping"
-
Send.close()
-
os.execv("/bin/true",["true"])
0 1787 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Michael Hohn |
last post by:
Hi,
under python 2.2, the pickle/unpickle sequence incorrectly restores
a larger data structure I have.
Under Python 2.3, these structures now give an explicit exception from
Pickle.memoize():
assert id(obj) not in self.memo
I'm shrinking the offending data structure down to find the problem
|
by: Shi Mu |
last post by:
I got a sample code and tested it but really can not understand the
use of pickle and dump:
>>> import pickle
>>> f = open("try.txt", "w")
>>> pickle.dump(3.14, f)
>>> pickle.dump(, f)
>>> f.close()
|
by: John Salerno |
last post by:
Here's what I have:
import pickle
data = open(r'C:\pickle_data.txt', 'w')
image = open(r'C:\peakhell.jpg')
pickle.Pickler(data)
data.dump(image)
data.close()
image.close()
|
by: Boris Borcic |
last post by:
Assuming that the items of my_stream share no content (they are
dumps of db cursor fetches), is there a simple way to do the
equivalent of
def pickles(my_stream) :
from cPickle import load,dumps
while 1 :
yield dumps(load(my_stream))
without the overhead associated with unpickling objects
|
by: Jim Lewis |
last post by:
Pickling an instance of a class, gives "can't pickle instancemethod
objects". What does this mean? How do I find the class method creating
the problem?
| |
by: fizilla |
last post by:
Hello all!
I have the following weird problem and since I am new to Python I somehow cannot figure out an elegant solution. The problem reduces to the following question:
How to pickle a collections.defaultdict object that has set the default_factory property?
For Example (from the IDLE console):
>>> words = collections.defaultdict(lambda: 1)
>>> f = file("temp","w")
|
by: Nagu |
last post by:
I didn't have the problem with dumping as a string. When I tried to
save this object to a file, memory error pops up.
I am sorry for the mention of size for a dictionary. What I meant by
65000X50 is that it has 65000 keys and each key has a list of 50
tuples.
I was able to save a dictionary object with 65000 keys and a list of
15-tuple values to a file. But I could not do the same when I have a
list of 25-tuple values for 65000 keys.
|
by: Gabriel Genellina |
last post by:
En Thu, 17 Jul 2008 09:40:29 -0300, <DWebre@dotd.la.govescribi�:
The example doesn't have any readline(). Make sure you open the file in
binary format ('wb' or 'rb').
If you have a list of objects: just write the list. It takes a single call
to pickle.dump(), and later, a single call to picle.load()
If you have too many objects and don't want to save/load all of them at
once, write them one at a time using pickle.dump(element,...
|
by: IceMan85 |
last post by:
Hi to all, I have spent the whole morning trying, with no success to pickle an object that I have created.
The error that I get is : Can't pickle 'SRE_Match' object: <_sre.SRE_Match object at 0x2a969c0ad0>
the complete stack is the following :
Traceback (most recent call last):
File "manager.py", line 305, in ?
commandLineExec (log, parser)
File "manager.py", line 229, in commandLineExec
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |