-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #295 from Ilhasoft/feature/analyze_char
Added Analyze Char and Updated Migrations
- Loading branch information
Showing
10 changed files
with
74 additions
and
23 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
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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from django.conf import settings | ||
from django.core.management.base import BaseCommand | ||
|
||
from bothub.common.models import RepositoryUpdate | ||
from bothub.utils import send_bot_data_file_aws | ||
|
||
|
||
class Command(BaseCommand): | ||
def handle(self, *args, **kwargs): | ||
if settings.AWS_SEND: | ||
for update in RepositoryUpdate.objects.all().exclude(bot_data__exact=""): | ||
repository_update = RepositoryUpdate.objects.get(pk=update.pk) | ||
bot_data = send_bot_data_file_aws(update.pk, update.bot_data) | ||
repository_update.bot_data = bot_data | ||
repository_update.save(update_fields=["bot_data"]) | ||
print("Updating bot_data repository_update {}".format(str(update.pk))) | ||
else: | ||
print("You need to configure the environment variables for AWS.") |
15 changes: 15 additions & 0 deletions
15
bothub/common/management/commands/update_repository_tests.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,15 @@ | ||
from django.core.management.base import BaseCommand | ||
|
||
from bothub.common.models import Repository | ||
from bothub.common.models import RepositoryUpdate | ||
|
||
|
||
class Command(BaseCommand): | ||
def handle(self, *args, **kwargs): | ||
print("Updating...") | ||
Repository.objects.all().update(total_updates=0) | ||
for update in RepositoryUpdate.objects.all().filter(trained_at__isnull=False): | ||
repository = Repository.objects.get(uuid=update.repository.uuid) | ||
repository.total_updates += 1 | ||
repository.save() | ||
print("Repository UUID {} Updated".format(repository.pk)) |
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
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 @@ | ||
# Generated by Django 2.1.11 on 2019-11-01 19:35 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [("common", "0037_auto_20191011_2021")] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="repository", | ||
name="use_analyze_char", | ||
field=models.BooleanField(default=False, verbose_name="Use analyze char"), | ||
), | ||
migrations.AddField( | ||
model_name="repositoryupdate", | ||
name="use_analyze_char", | ||
field=models.BooleanField(default=False), | ||
), | ||
] |
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