-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add back backfill_figures_metrics, pending deprecation
Calls backfill_daily_metrics and backfill_monthly_metrics, w/options
- Loading branch information
1 parent
459b181
commit 7ae08e3
Showing
5 changed files
with
128 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
""" | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
"""Django management commands for Figures. | ||
""" | ||
Management commands for Figures. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
"""Deprecated: | ||
Please call instead one of: | ||
backfill_figures_daily_metrics, backfill_figures_monthly_metrics, or | ||
backfill_figures_enrollment_data | ||
Backfills Figures historical metrics | ||
""" | ||
|
||
from __future__ import print_function | ||
|
||
from __future__ import absolute_import | ||
from textwrap import dedent | ||
import warnings | ||
|
||
from django.core.management import call_command | ||
from django.core.management.base import BaseCommand | ||
|
||
|
||
class Command(BaseCommand): | ||
"""Pending Deprecation: Populate Figures metrics models | ||
""" | ||
help = dedent(__doc__).strip() | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument('--overwrite', | ||
action='store_true', | ||
default=False, | ||
help='overwrite existing data in SiteMonthlyMetrics') | ||
parser.add_argument('--site', | ||
help='backfill a specific site. provide id or domain name') | ||
|
||
def handle(self, *args, **options): | ||
''' | ||
Pending deprecation. Passes handling off to new commands. | ||
''' | ||
warnings.warn( | ||
"backfill_figures_metrics is pending deprecation and will be removed in " | ||
"Figures 1.0. Please use one of backfill_figures_daily_metrics, " | ||
"backfill_figures_monthly_metrics, or backfill_figures_enrollment_data, " | ||
"instead.", | ||
PendingDeprecationWarning | ||
) | ||
print('BEGIN: Backfill Figures Metrics') | ||
|
||
call_command( | ||
'backfill_figures_monthly_metrics', | ||
overwrite=options['overwrite'], | ||
site=options['site'] | ||
) | ||
call_command( | ||
'backfill_figures_daily_metrics', | ||
overwrite=options['overwrite'], | ||
site=options['site'] | ||
) | ||
|
||
print('DONE: Backfill Figures Metrics') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters