|
17 | 17 | ''' |
18 | 18 |
|
19 | 19 | import json |
| 20 | +import logging |
20 | 21 |
|
21 | 22 | from django.conf import settings |
22 | 23 | from django.core.management.base import BaseCommand |
|
46 | 47 | from retail.views import get_contributor_landing_page_context, get_specific_activities |
47 | 48 | from townsquare.views import tags |
48 | 49 |
|
| 50 | +logger = logging.getLogger(__name__) |
49 | 51 |
|
50 | 52 | def create_email_inventory_cache(): |
51 | 53 | print('create_email_inventory_cache') |
@@ -384,24 +386,31 @@ class Command(BaseCommand): |
384 | 386 | help = 'generates some /results data' |
385 | 387 |
|
386 | 388 | def handle(self, *args, **options): |
387 | | - create_grant_type_cache() |
388 | | - create_grant_clr_cache() |
389 | | - create_grant_category_size_cache() |
390 | | - create_grant_active_clr_mapping() |
| 389 | + operations = [] |
| 390 | + operations.append(create_grant_type_cache) |
| 391 | + operations.append(create_grant_clr_cache) |
| 392 | + operations.append(create_grant_category_size_cache) |
| 393 | + operations.append(create_grant_active_clr_mapping) |
391 | 394 | if not settings.DEBUG: |
392 | | - create_results_cache() |
393 | | - create_hidden_profiles_cache() |
394 | | - create_tribes_cache() |
395 | | - create_activity_cache() |
396 | | - create_post_cache() |
397 | | - create_top_grant_spenders_cache() |
398 | | - create_avatar_cache() |
399 | | - create_quests_cache() |
400 | | - create_grants_cache() |
401 | | - create_contributor_landing_page_context() |
402 | | - create_hackathon_cache() |
403 | | - create_hackathon_list_page_cache() |
| 395 | + operations.append(create_results_cache) |
| 396 | + operations.append(create_hidden_profiles_cache) |
| 397 | + operations.append(create_tribes_cache) |
| 398 | + operations.append(create_activity_cache) |
| 399 | + operations.append(create_post_cache) |
| 400 | + operations.append(create_top_grant_spenders_cache) |
| 401 | + operations.append(create_avatar_cache) |
| 402 | + operations.append(create_quests_cache) |
| 403 | + operations.append(create_grants_cache) |
| 404 | + operations.append(create_contributor_landing_page_context) |
| 405 | + operations.append(create_hackathon_cache) |
| 406 | + operations.append(create_hackathon_list_page_cache) |
404 | 407 | hour = int(timezone.now().strftime('%H')) |
405 | 408 | if hour < 4: |
406 | 409 | # do dailyi updates |
407 | | - create_email_inventory_cache() |
| 410 | + operations.append(create_email_inventory_cache) |
| 411 | + for func in operations: |
| 412 | + try: |
| 413 | + print(f'running {func}') |
| 414 | + func() |
| 415 | + except Exception as e: |
| 416 | + logger.exception(e) |
0 commit comments