Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mentors.debian.net
debexpo
Commits
02226345
Verified
Commit
02226345
authored
Oct 14, 2021
by
Baptiste Beauplat
Browse files
Replace celery @task by @shared_task (removed in celery 5.2)
parent
d8e88621
Changes
2
Hide whitespace changes
Inline
Side-by-side
debexpo/importer/tasks.py
View file @
02226345
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# OTHER DEALINGS IN THE SOFTWARE.
from
celery
.decorators
import
task
from
celery
import
shared_
task
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -34,7 +34,7 @@ from debexpo.importer.models import Importer
...
@@ -34,7 +34,7 @@ from debexpo.importer.models import Importer
from
debexpo.tools.cache
import
enforce_unique_instance
from
debexpo.tools.cache
import
enforce_unique_instance
@
task
@
shared_
task
def
importer
():
def
importer
():
with
enforce_unique_instance
(
'importer'
):
with
enforce_unique_instance
(
'importer'
):
importctl
=
Importer
(
settings
.
UPLOAD_SPOOL
)
importctl
=
Importer
(
settings
.
UPLOAD_SPOOL
)
...
...
debexpo/packages/tasks.py
View file @
02226345
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
# OTHER DEALINGS IN THE SOFTWARE.
from
celery
.decorators
import
task
from
celery
import
shared_
task
from
datetime
import
timedelta
,
datetime
,
timezone
from
datetime
import
timedelta
,
datetime
,
timezone
from
logging
import
getLogger
from
logging
import
getLogger
from
debian.deb822
import
Changes
from
debian.deb822
import
Changes
...
@@ -97,7 +97,7 @@ def remove_uploads(uploads):
...
@@ -97,7 +97,7 @@ def remove_uploads(uploads):
return
removals
return
removals
@
task
@
shared_
task
def
remove_old_uploads
():
def
remove_old_uploads
():
expiration_date
=
datetime
.
now
(
timezone
.
utc
)
-
\
expiration_date
=
datetime
.
now
(
timezone
.
utc
)
-
\
timedelta
(
weeks
=
settings
.
MAX_AGE_UPLOAD_WEEKS
)
timedelta
(
weeks
=
settings
.
MAX_AGE_UPLOAD_WEEKS
)
...
@@ -128,7 +128,7 @@ def notify_uploaders(removals, reason):
...
@@ -128,7 +128,7 @@ def notify_uploaders(removals, reason):
reason
=
reason
)
reason
=
reason
)
@
task
@
shared_
task
def
remove_uploaded_packages
(
client
=
None
):
def
remove_uploaded_packages
(
client
=
None
):
uploads_to_archive
=
set
()
uploads_to_archive
=
set
()
uploads_to_new
=
set
()
uploads_to_new
=
set
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment