Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from contentcuration.models import Channel
from contentcuration.models import ContentNode

logging.basicConfig()
logger = logging.getLogger('command')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
import time
import uuid

import progressbar
from django.core.management.base import BaseCommand
from django.db.models import Count
from django.db.models import F

from contentcuration.models import ContentNode

logmodule.basicConfig()
logging = logmodule.getLogger(__name__)


Expand All @@ -27,7 +25,6 @@ def handle(self, *args, **options):

logging.info("Fixing {} nodes...".format(total))

bar = progressbar.ProgressBar(max_value=total)
for i, node in enumerate(nodes):
# Go through each node's assessment items
for item in node.assessment_items.all():
Expand All @@ -51,6 +48,6 @@ def handle(self, *args, **options):
new_id = uuid.uuid4().hex
item.assessment_id = new_id
item.save()
bar.update(i)
logging.info("Fixed assessment items for {} node(s)".format(i + 1))

logging.info("Finished in {}".format(time.time() - start))
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from contentcuration.models import ContentNode
from contentcuration.models import License

logmodule.basicConfig(level=logmodule.INFO)
logging = logmodule.getLogger('command')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from contentcuration.utils.garbage_collect import clean_up_tasks


logmodule.basicConfig(level=logmodule.INFO)
logging = logmodule.getLogger('command')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from contentcuration.models import File
from contentcuration.models import License

logmodule.basicConfig(level=logmodule.INFO)
logging = logmodule.getLogger('command')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from contentcuration.models import Change
from contentcuration.models import User

logging.basicConfig()
logger = logging.getLogger('command')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from contentcuration.utils.import_tools import import_channel

logging.basicConfig()
logger = logging.getLogger('command')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import concurrent.futures
import os

import progressbar
from django.core.files.storage import default_storage
from django.core.management.base import BaseCommand

Expand All @@ -26,15 +25,11 @@ def handle(self, *args, **kwargs):
futures = []
with concurrent.futures.ThreadPoolExecutor() as e:
print("Scheduling all metadata update jobs...")
progbar = progressbar.ProgressBar()
for blob in progbar(blobs):
for blob in blobs:
future = e.submit(self._update_metadata, blob)
futures.append(future)

print("Waiting for all jobs to finish...")
progbar = progressbar.ProgressBar(max_value=len(futures))
for _ in progbar(concurrent.futures.as_completed(futures)):
pass

def _determine_cache_control(self, name):
_, ext = os.path.splitext(name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from contentcuration.constants.contentnode import kind_activity_map
from contentcuration.models import ContentNode

logmodule.basicConfig(level=logmodule.INFO)
logging = logmodule.getLogger('command')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from contentcuration.models import File
from contentcuration.models import MEDIA_PRESETS

logmodule.basicConfig(level=logmodule.INFO)
logging = logmodule.getLogger('command')


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from contentcuration.models import ContentNode
from contentcuration.models import File

logmodule.basicConfig(level=logmodule.INFO)
logging = logmodule.getLogger('command')


Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import progressbar
import logging

from django.core.management.base import BaseCommand

from contentcuration.models import User


logger = logging.getLogger(__name__)


class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument("--force", action="store_true", dest="force", default=False)

def handle(self, *args, **options):
users = User.objects.all() if options["force"] else User.objects.filter(disk_space_used=0)
bar = progressbar.ProgressBar(max_value=users.count())
for index, user in enumerate(users):
user.set_space_used()
bar.update(index)
logger.info("Updated storage used for {} user(s)".format(index + 1))
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from contentcuration.utils.publish import publish_channel
from contentcuration.utils.storage_common import is_gcs_backend

logmodule.basicConfig()
logging = logmodule.getLogger(__name__)

DESCRIPTION = """
Expand Down
1 change: 0 additions & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ newrelic>=2.86.3.70
celery==5.2.7
redis
pathlib
progressbar2==3.55.0
python-postmark==0.5.8
Django==3.2.14
django-webpack-loader==0.7.0
Expand Down
6 changes: 0 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ pathlib==1.0.1
# via -r requirements.in
pillow==9.3.0
# via -r requirements.in
progressbar2==3.55.0
# via -r requirements.in
prometheus-client==0.10.1
# via django-prometheus
prompt-toolkit==3.0.23
Expand Down Expand Up @@ -219,8 +217,6 @@ python-dateutil==2.8.1
# botocore
python-postmark==0.5.8
# via -r requirements.in
python-utils==2.5.6
# via progressbar2
pytz==2022.1
# via
# celery
Expand Down Expand Up @@ -254,9 +250,7 @@ six==1.16.0
# grpcio
# html5lib
# oauth2client
# progressbar2
# python-dateutil
# python-utils
sqlparse==0.4.1
# via django
urllib3==1.26.5
Expand Down