[issue30782] Allow limiting the number of concurrent tasks in asyncio.as_completed

2019-02-08 Thread glin


glin  added the comment:

@Andrew Svetlov: I was surprised when you wrote "as_completed() is low-level 
API.", so I wondered what is high level API and I googled it and first that 
came was official doc:

https://docs.python.org/3/library/asyncio-api-index.html

Where it's written that it's high level API indeed.

IMHO without limit, all of these functions are quite impractical (as_completed, 
wait, gather, ...). I have simple to moderately complex scripts and I'm running 
into problems with it (API servers limiting number of requests per minute, 
/tmp/ (4GB ramdisk) out of space, memory issues...

Please reconsider adding limit to these functions as it's suppose to be high 
level API, not low level.

Thanks

--
nosy: +glin

___
Python tracker 
<https://bugs.python.org/issue30782>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5641] Local variables not freed when Exception raises in function called from cycle

2009-04-02 Thread Glin

Glin g...@seznam.cz added the comment:

I'm not talking about exception variable, but about the variables in
local scope of function job() (in my example it is the variable 'a' of
class A).

Sorry, if I did not make myself clear.

--
status: closed - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5641
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5641] Local variables not freed when Exception raises in function called from cycle

2009-04-01 Thread Glin

New submission from Glin g...@seznam.cz:

Situation:
You have a while cycle. inside of it a try-except block and in this
try-except block calling a function. Inside of this function raises an
exception, with is caught in the try-except block.

What happens:
Local variables of the function are not freed. (OK, they are freed when
the program leaves a function inside of which is the while cycle, or
when another exception raises and is caught, but it's not helpful when
you have some server program based on infinite while loop or working
with a large amount of data).

Example:
Example program is attached.

Output of the example program:

While start
job() start
Creating 1
Catched AttributeError
While end
While start
job() start
Creating 2
job() end
Deleting 2
While end
While start
job() start
Creating 3
job() end
Deleting 3
While end
...

As you can see, a variable 'a' created in the first call (which throws
an exception) of the 'job' function will never get freed. 

Imagine that in 'job' function you create a large amount of data, or
worse you create a database connection, which will be opened forever.

Tested on Python 2.5.2 and 2.7(svn). On the contrary, Python 3.0 does
not have this issue (it frees variables of the 'job' function at the end
of except: block.)

As Python 2.X will be another long time with us, I think it should be
fixed to behave correctly (that is as in Python 3.)

--
components: Interpreter Core
files: notfreed.py
messages: 84989
nosy: Glin
severity: normal
status: open
title: Local variables not freed when Exception raises in function called from 
cycle
type: resource usage
versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7
Added file: http://bugs.python.org/file13535/notfreed.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5641
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com