-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
736 additions
and
71 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 |
---|---|---|
|
@@ -5,4 +5,5 @@ omit = | |
*admin.py | ||
*strings.py | ||
*constants.py | ||
*models.py | ||
|
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 |
---|---|---|
|
@@ -13,3 +13,4 @@ django-rq==1.0.0 | |
pyyaml | ||
django-ipware==1.1.6 | ||
django-import-export==0.5.1 | ||
python-crontab==2.2.8 |
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
28 changes: 7 additions & 21 deletions
28
series_tiempo_ar_api/apps/management/management/commands/read_datajson.py
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,28 +1,14 @@ | ||
#! coding: utf-8 | ||
import logging | ||
|
||
from django.core.management import BaseCommand | ||
from pydatajson import DataJson | ||
|
||
from series_tiempo_ar_api.apps.api.indexing import catalog_reader | ||
from series_tiempo_ar_api.apps.management.models import Node | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
READ_ERROR = u"Error en la lectura del catálogo %s: %s" | ||
from series_tiempo_ar_api.apps.management.models import ReadDataJsonTask | ||
from series_tiempo_ar_api.apps.management.tasks import read_datajson | ||
|
||
|
||
class Command(BaseCommand): | ||
"""Comando para ejecutar la indexación manualmente de manera sincrónica, | ||
útil para debugging""" | ||
def handle(self, *args, **options): | ||
nodes = Node.objects.filter(indexable=True) | ||
for node in nodes: | ||
catalog_id = node.catalog_id | ||
catalog_url = node.catalog_url | ||
try: | ||
catalog = DataJson(catalog_url) | ||
except (IOError, ValueError, AssertionError) as e: | ||
self.stderr.write(READ_ERROR % (catalog_id, e)) | ||
logging.warn(READ_ERROR, catalog_id, e) | ||
continue | ||
|
||
catalog_reader.index_catalog(catalog, catalog_id) | ||
task = ReadDataJsonTask() | ||
task.save() | ||
read_datajson(task, async=False) |
24 changes: 24 additions & 0 deletions
24
series_tiempo_ar_api/apps/management/migrations/0003_indexingtask.py
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,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.6 on 2018-01-10 15:05 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('management', '0002_auto_20180110_1022'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='IndexingTask', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('day_of_week', models.CharField(choices=[(('MON',), 'Lunes'), (('TUE',), 'Martes'), (('WED',), 'Mi\xe9rcoles'), (('THU',), 'Jueves'), (('FRI',), 'Viernes'), (('SAT',), 'S\xe1bado'), ('SUN', 'Domingo')], max_length=20)), | ||
('time', models.TimeField()), | ||
('enabled', models.BooleanField(default=True)), | ||
], | ||
), | ||
] |
20 changes: 20 additions & 0 deletions
20
series_tiempo_ar_api/apps/management/migrations/0004_auto_20180110_1206.py
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,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.6 on 2018-01-10 15:06 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('management', '0003_indexingtask'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='indexingtask', | ||
name='day_of_week', | ||
field=models.CharField(choices=[(('MON',), 'Lunes'), (('TUE',), 'Martes'), (('WED',), 'Mi\xe9rcoles'), (('THU',), 'Jueves'), (('FRI',), 'Viernes'), (('SAT',), 'S\xe1bado'), ('SUN', 'Domingo')], max_length=20, null=True), | ||
), | ||
] |
20 changes: 20 additions & 0 deletions
20
series_tiempo_ar_api/apps/management/migrations/0005_auto_20180110_1208.py
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,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.6 on 2018-01-10 15:08 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('management', '0004_auto_20180110_1206'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='indexingtask', | ||
name='day_of_week', | ||
field=models.CharField(blank=True, choices=[(('MON',), 'Lunes'), (('TUE',), 'Martes'), (('WED',), 'Mi\xe9rcoles'), (('THU',), 'Jueves'), (('FRI',), 'Viernes'), (('SAT',), 'S\xe1bado'), ('SUN', 'Domingo')], max_length=20, null=True), | ||
), | ||
] |
20 changes: 20 additions & 0 deletions
20
series_tiempo_ar_api/apps/management/migrations/0006_indexingtask_weekdays_only.py
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,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.6 on 2018-01-10 15:12 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('management', '0005_auto_20180110_1208'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='indexingtask', | ||
name='weekdays_only', | ||
field=models.BooleanField(default=False), | ||
), | ||
] |
34 changes: 34 additions & 0 deletions
34
series_tiempo_ar_api/apps/management/migrations/0007_auto_20180110_1455.py
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,34 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.6 on 2018-01-10 17:55 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('management', '0006_indexingtask_weekdays_only'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='ReadDataJsonTask', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('status', models.CharField(choices=[('RUNNING', 'Procesando cat\xe1logos'), ('INDEXING', 'Indexando series'), ('FINISHED', 'Finalizada'), ('ERROR', 'Error')], max_length=20)), | ||
('created', models.DateTimeField()), | ||
('finished', models.DateTimeField(null=True)), | ||
('logs', models.TextField(default='-')), | ||
], | ||
), | ||
migrations.RemoveField( | ||
model_name='indexingtask', | ||
name='day_of_week', | ||
), | ||
migrations.AlterField( | ||
model_name='indexingtask', | ||
name='time', | ||
field=models.TimeField(help_text='Los segundos ser\xe1n ignorados'), | ||
), | ||
] |
21 changes: 21 additions & 0 deletions
21
series_tiempo_ar_api/apps/management/migrations/0008_readdatajsontask_catalogs.py
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,21 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.6 on 2018-01-11 16:30 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0023_dataset_present'), | ||
('management', '0007_auto_20180110_1455'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='readdatajsontask', | ||
name='catalogs', | ||
field=models.ManyToManyField(to='api.Catalog'), | ||
), | ||
] |
20 changes: 20 additions & 0 deletions
20
series_tiempo_ar_api/apps/management/migrations/0009_auto_20180111_1331.py
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,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.6 on 2018-01-11 16:31 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('management', '0008_readdatajsontask_catalogs'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='readdatajsontask', | ||
name='catalogs', | ||
field=models.ManyToManyField(to='management.Node'), | ||
), | ||
] |
20 changes: 20 additions & 0 deletions
20
series_tiempo_ar_api/apps/management/migrations/0010_auto_20180111_1412.py
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,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.6 on 2018-01-11 17:12 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('management', '0009_auto_20180111_1331'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='readdatajsontask', | ||
name='catalogs', | ||
field=models.ManyToManyField(blank=True, to='management.Node'), | ||
), | ||
] |
19 changes: 19 additions & 0 deletions
19
series_tiempo_ar_api/apps/management/migrations/0011_auto_20180111_1505.py
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,19 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.6 on 2018-01-11 18:05 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('management', '0010_auto_20180111_1412'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameModel( | ||
old_name='IndexingTask', | ||
new_name='IndexingTaskCron', | ||
), | ||
] |
Oops, something went wrong.