8000 Drop multiprocessing in rendervariations command · codingjoe/django-stdimage@d4bb2f2 · GitHub
[go: up one dir, main page]

Skip to content

Commit d4bb2f2

Browse files
committed
Drop multiprocessing in rendervariations command
It is profered to use asynchronous renders andyways and to do image rendering on optimized works. Therefore, using multiprocessing to simply queue tasks adds more errors than it does good.
1 parent 4c7194a commit d4bb2f2

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

README.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Django Field that implement the following features:
1212
* Access thumbnails on model level, no template tags required
1313
* Preserves original image
1414
* Asynchronous rendering (Celery & Co)
15-
* Multi threading and processing for optimum performance
1615
* Restrict accepted image dimensions
1716
* Rename files to a standardized name (using a callable upload_to)
1817

@@ -195,12 +194,3 @@ The `replace` option will replace all existing files.
195194
The `ignore-missing` option will suspend missing source file errors and keep
196195
rendering variations for other files. Othervise command will stop on first
197196
missing file.
198-
199-
### Multi processing
200-
Since version 2 stdImage supports multiprocessing.
201-
Every image is rendered in separate process.
202-
It not only increased performance but the garbage collection
203-
and therefore the huge memory footprint from previous versions.
204-
205-
**Note:** PyPy seems to have some problems regarding multiprocessing,
206-
for that matter all multiprocessing is disabled in PyPy.

stdimage/management/commands/rendervariations.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
from concurrent.futures import ProcessPoolExecutor
2-
from multiprocessing import cpu_count
3-
41
import progressbar
52
from django.apps import apps
63
from django.core.files.storage import get_storage_class
@@ -75,14 +72,12 @@ def render(field, images, count, replace, ignore_missing, do_render):
7572
)
7673
with progressbar.ProgressBar(max_value=count, widgets=(
7774
progressbar.RotatingMarker(),
78-
' | CPUs: {}'.format(cpu_count()),
7975
' | ', progressbar.AdaptiveETA(),
8076
' | ', progressbar.Percentage(),
8177
' ', progressbar.Bar(),
8278
)) as bar:
83-
with ProcessPoolExecutor() as executor:
84-
for _ in executor.map(render_field_variations, kwargs_list):
85-
bar += 1
79+
for _ in map(render_field_variations, kwargs_list):
80+
bar += 1
8681

8782

8883
def render_field_variations(kwargs):

0 commit comments

Comments
 (0)
0