@@ -33,15 +33,11 @@ def _process_picture(
33
33
old = old or []
34
34
storage = utils .reconstruct (* storage )
35
35
if new :
36
- try :
37
- with storage .open (file_name ) as fs :
38
- with Image .open (fs ) as img :
39
- for picture in new :
40
- picture = utils .reconstruct (* picture )
41
- picture .save (img )
42
- except FileNotFoundError :
43
- # The file no longer exists (for example, because it was deleted or replaced).
44
- return
36
+ with storage .open (file_name ) as fs :
37
+ with Image .open (fs ) as img :
38
+ for picture in new :
39
+ picture = utils .reconstruct (* picture )
40
+ picture .save (img )
45
41
46
42
for picture in old :
47
43
picture = utils .reconstruct (* picture )
@@ -57,7 +53,9 @@ def _process_picture(
57
53
pass
58
54
else :
59
55
60
- @dramatiq .actor (queue_name = conf .get_settings ().QUEUE_NAME )
56
+ @dramatiq .actor (
57
+ queue_name = conf .get_settings ().QUEUE_NAME , throws = (FileNotFoundError ,)
58
+ )
61
59
def process_picture_with_dramatiq (
62
60
storage : tuple [str , list , dict ],
63
61
file_name : str ,
@@ -91,6 +89,7 @@ def process_picture( # noqa: F811
91
89
@shared_task (
92
90
ignore_results = True ,
93
91
retry_backoff = True ,
92
+ dont_autoretry_for = (FileNotFoundError ,),
94
93
)
95
94
def process_picture_with_celery (
96
95
storage : tuple [str , list , dict ],
0 commit comments