aa-alumni 0.1.6a0__py3-none-any.whl → 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of aa-alumni might be problematic. Click here for more details.
- {aa_alumni-0.1.6a0.dist-info → aa_alumni-0.3.0.dist-info}/LICENSE +1 -1
- {aa_alumni-0.1.6a0.dist-info → aa_alumni-0.3.0.dist-info}/METADATA +20 -16
- aa_alumni-0.3.0.dist-info/RECORD +23 -0
- {aa_alumni-0.1.6a0.dist-info → aa_alumni-0.3.0.dist-info}/WHEEL +1 -1
- alumni/__init__.py +1 -1
- alumni/admin.py +1 -3
- alumni/app_settings.py +5 -1
- alumni/apps.py +1 -1
- alumni/locale/de/LC_MESSAGES/django.mo +0 -0
- alumni/locale/de/LC_MESSAGES/django.po +53 -0
- alumni/locale/en/LC_MESSAGES/django.mo +0 -0
- alumni/locale/en/LC_MESSAGES/django.po +43 -0
- alumni/migrations/0003_alter_alumnisetup_options_and_more.py +27 -0
- alumni/models.py +17 -21
- alumni/providers.py +5 -6
- alumni/tasks.py +39 -16
- aa_alumni-0.1.6a0.dist-info/RECORD +0 -18
|
@@ -1,31 +1,29 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
2
|
-
Name:
|
|
3
|
-
Version: 0.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: aa-alumni
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Integration with Alliance Auths State System, creates and maintains an Alumni State for past members of an Alliance and/or Corporation
|
|
5
5
|
Keywords: allianceauth,eveonline
|
|
6
6
|
Author-email: Joel Falknau <joel.falknau@gmail.com>
|
|
7
|
-
Requires-Python: >=3.
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
9
|
Classifier: Environment :: Web Environment
|
|
10
10
|
Classifier: Framework :: Celery
|
|
11
11
|
Classifier: Framework :: Django
|
|
12
|
-
Classifier: Framework :: Django :: 4.
|
|
12
|
+
Classifier: Framework :: Django :: 4.2
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
14
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Programming Language :: Python
|
|
17
|
-
Classifier: Programming Language :: Python :: 3
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
22
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
23
23
|
Classifier: Topic :: Internet :: WWW/HTTP
|
|
24
24
|
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
25
|
-
Requires-Dist: allianceauth>=
|
|
26
|
-
Requires-Dist: django-
|
|
27
|
-
Requires-Dist: django-solo>=2.0.0,<3.0.0
|
|
28
|
-
Requires-Dist: py-cord>=2.0.0,<3.0.0
|
|
25
|
+
Requires-Dist: allianceauth>=4,<5
|
|
26
|
+
Requires-Dist: django-solo>=2,<3
|
|
29
27
|
Project-URL: Homepage, https://gitlab.com/tactical-supremacy/aa-alumni
|
|
30
28
|
Project-URL: Source, https://gitlab.com/tactical-supremacy/aa-alumni
|
|
31
29
|
Project-URL: Tracker, https://gitlab.com/tactical-supremacy/aa-alumni/-/issues
|
|
@@ -44,7 +42,7 @@ Remove/Promote any state with a priority of `1`, Alumni is considered slightly b
|
|
|
44
42
|
|
|
45
43
|
### Step 2 - Install from pip
|
|
46
44
|
|
|
47
|
-
```
|
|
45
|
+
```shell
|
|
48
46
|
pip install aa-alumni
|
|
49
47
|
```
|
|
50
48
|
|
|
@@ -60,17 +58,17 @@ Configure your Auth settings (`local.py`) as follows:
|
|
|
60
58
|
# Tasks
|
|
61
59
|
CELERYBEAT_SCHEDULE['alumni_run_alumni_check_all'] = {
|
|
62
60
|
'task': 'alumni.tasks.run_alumni_check_all',
|
|
63
|
-
'schedule': crontab(minute=
|
|
61
|
+
'schedule': crontab(minute=37, hour=3, day_of_week=4),
|
|
64
62
|
}
|
|
65
63
|
CELERYBEAT_SCHEDULE['alumni_run_update_all_models'] = {
|
|
66
64
|
'task': 'alumni.tasks.update_all_models',
|
|
67
|
-
'schedule': crontab(minute=
|
|
65
|
+
'schedule': crontab(minute=37, hour=3, day_of_week=3),
|
|
68
66
|
}
|
|
69
67
|
```
|
|
70
68
|
|
|
71
69
|
### Step 4 - Update AA's State system
|
|
72
70
|
|
|
73
|
-
```
|
|
71
|
+
```shell
|
|
74
72
|
python myauth/manage.py alumni_state
|
|
75
73
|
```
|
|
76
74
|
|
|
@@ -85,6 +83,12 @@ python myauth/manage.py alumni_state
|
|
|
85
83
|
In the Admin interface, visit `alumni > config > add` or `<AUTH-URL>/admin/alumni/config/add/`
|
|
86
84
|
Select the Alliances and/or Corporations for which characters with historical membership are Alumni
|
|
87
85
|
|
|
86
|
+
## Settings
|
|
87
|
+
|
|
88
|
+
| Name | Description | Default |
|
|
89
|
+
| --- | --- | --- |
|
|
90
|
+
|`ALUMNI_CHARACTERCORPORATION_RATELIMIT`| Celery Rate Limit _per worker_, 10 tasks * 10 Workers = 100 tasks/min | '10/m' |
|
|
91
|
+
|
|
88
92
|
## Contributing
|
|
89
93
|
|
|
90
94
|
Make sure you have signed the [License Agreement](https://developers.eveonline.com/resource/license-agreement) by logging in at <https://developers.eveonline.com> before submitting any pull requests. All bug fixes or features must not include extra superfluous formatting changes.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
alumni/__init__.py,sha256=KNnvjsgFVxaz4i7ivnq5wNZqvk-LTTj3n6Xl44iOgGk,186
|
|
2
|
+
alumni/admin.py,sha256=VUDXqxBX-Dw_3T4QGXDTtz-Ulgc_WkoCW54OXbd3a5o,737
|
|
3
|
+
alumni/app_settings.py,sha256=soF5EtRwxvWG2ARqzm7e7Qe5dpp-NCPZ-um781fENvs,383
|
|
4
|
+
alumni/apps.py,sha256=JNO5V_uldj3Y2OEJL0h4u86LoPZr5UOhzkcTFZ6VeNI,239
|
|
5
|
+
alumni/models.py,sha256=tgcy4FtHFZNyfCl_Rma3igPgxfaY433YG2CObBrsMe8,2206
|
|
6
|
+
alumni/providers.py,sha256=hKzig2S28NGcCpf078hMzlAL7xarNekFRgGlDS1IWhI,1027
|
|
7
|
+
alumni/signals.py,sha256=ZiWER0gs-0KCS6nWhCwE1_-iDXr9yrS7NSPBfLBDjak,789
|
|
8
|
+
alumni/tasks.py,sha256=q2HkZMfDI1eFyoeTs5BqSYYko9mv46jynuLZMtw9FXw,9203
|
|
9
|
+
alumni/locale/de/LC_MESSAGES/django.mo,sha256=hTZUh1Insgy-eZmz0-Owvgy9Mh6tNw3p2X9J6tD4TwE,1250
|
|
10
|
+
alumni/locale/de/LC_MESSAGES/django.po,sha256=aEAiaM_iPQFp3BCjD0-WEKRMrtLSIn2gp7INLJ5KbJY,1744
|
|
11
|
+
alumni/locale/en/LC_MESSAGES/django.mo,sha256=N1pb17IfLd0ASiKO8d68-B4ygSpDkhKOCs8YTzMXQo0,380
|
|
12
|
+
alumni/locale/en/LC_MESSAGES/django.po,sha256=dW_HNYdzscfIrGUoGA1-0PwV0LNn7-WdgXmdMU7pGm8,1250
|
|
13
|
+
alumni/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
+
alumni/management/commands/alumni_state.py,sha256=OyJKnkzk9eksk-vULSVBdGvMEhxZX_xa7eH5RXFjeJ8,759
|
|
15
|
+
alumni/migrations/0001_initial.py,sha256=C8R2k4y5KvpTLU_etBQ0J3jkGYd3HAgevAekUZvzxDw,3283
|
|
16
|
+
alumni/migrations/0002_auto_20211230_0147.py,sha256=p3sK1Ohdf6O20tDbMmuPJwC2vVFH-AR0kkXFy9H34_Y,626
|
|
17
|
+
alumni/migrations/0003_alter_alumnisetup_options_and_more.py,sha256=JyXQqo9vR-hRx7CHsNpXLxZEjEijSBLW3zX7Zmw3Y50,1012
|
|
18
|
+
alumni/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
+
alumni/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
|
+
aa_alumni-0.3.0.dist-info/LICENSE,sha256=6TxpZBZY7OLGLrJXe6vREu--u7CjCfW19u4oXW_uZKs,1069
|
|
21
|
+
aa_alumni-0.3.0.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
|
|
22
|
+
aa_alumni-0.3.0.dist-info/METADATA,sha256=8JK5mOVUky9sNuPCYL4lvET4LhqzWT81zpL7Q0uciOo,3359
|
|
23
|
+
aa_alumni-0.3.0.dist-info/RECORD,,
|
alumni/__init__.py
CHANGED
alumni/admin.py
CHANGED
|
@@ -8,9 +8,7 @@ from .models import (
|
|
|
8
8
|
@admin.register(AlumniSetup)
|
|
9
9
|
class AlumniSetupAdmin(admin.ModelAdmin):
|
|
10
10
|
search_fields = ['alumni_corporations', ]
|
|
11
|
-
filter_horizontal = [
|
|
12
|
-
"alumni_corporations",
|
|
13
|
-
"alumni_alliances"]
|
|
11
|
+
filter_horizontal = ["alumni_corporations", "alumni_alliances"]
|
|
14
12
|
|
|
15
13
|
|
|
16
14
|
@admin.register(CorporationAllianceHistory)
|
alumni/app_settings.py
CHANGED
|
@@ -2,4 +2,8 @@ from django.conf import settings
|
|
|
2
2
|
|
|
3
3
|
ALUMNI_STATE_NAME = getattr(settings, 'ALUMNI_STATE_NAME', "Alumni")
|
|
4
4
|
|
|
5
|
-
ALUMNI_TASK_PRIORITY = getattr(settings, 'ALUMNI_TASK_PRIORITY',
|
|
5
|
+
ALUMNI_TASK_PRIORITY = getattr(settings, 'ALUMNI_TASK_PRIORITY', 7)
|
|
6
|
+
|
|
7
|
+
ALUMNI_CHARACTERCORPORATION_RATELIMIT = getattr(settings, 'ALUMNI_CHARACTERCORPORATION_RATELIMIT', '10/m') # 10*10workers = 100/300 per min
|
|
8
|
+
|
|
9
|
+
ALUMNI_TASK_JITTER = getattr(settings, 'ALUMNI_TASK_PRIORITY', 600)
|
alumni/apps.py
CHANGED
|
Binary file
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# SOME DESCRIPTIVE TITLE.
|
|
2
|
+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
|
3
|
+
# This file is distributed under the same license as the PACKAGE package.
|
|
4
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
5
|
+
#
|
|
6
|
+
# Translators:
|
|
7
|
+
# Peter Pfeufer, 2024
|
|
8
|
+
#
|
|
9
|
+
#, fuzzy
|
|
10
|
+
msgid ""
|
|
11
|
+
msgstr ""
|
|
12
|
+
"Project-Id-Version: PACKAGE VERSION\n"
|
|
13
|
+
"Report-Msgid-Bugs-To: \n"
|
|
14
|
+
"POT-Creation-Date: 2024-05-11 18:13+1000\n"
|
|
15
|
+
"PO-Revision-Date: 2024-05-11 10:42+0000\n"
|
|
16
|
+
"Last-Translator: Peter Pfeufer, 2024\n"
|
|
17
|
+
"Language-Team: German (https://app.transifex.com/alliance-auth/teams/107430/de/)\n"
|
|
18
|
+
"MIME-Version: 1.0\n"
|
|
19
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
20
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
21
|
+
"Language: de\n"
|
|
22
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
23
|
+
|
|
24
|
+
#: alumni/models.py:14
|
|
25
|
+
msgid ""
|
|
26
|
+
"Characters with these Corps in their History will be given Alumni Status"
|
|
27
|
+
msgstr ""
|
|
28
|
+
"Charaktere mit diesen Corps in ihrer Vergangenheit erhalten den Alumni-"
|
|
29
|
+
"Status"
|
|
30
|
+
|
|
31
|
+
#: alumni/models.py:18
|
|
32
|
+
msgid ""
|
|
33
|
+
"Characters with these Alliances in their History will be given Alumni Status"
|
|
34
|
+
msgstr ""
|
|
35
|
+
"Charaktere mit diesen Allianzen in ihrer Vergangenheit erhalten den Alumni-"
|
|
36
|
+
"Status"
|
|
37
|
+
|
|
38
|
+
#: alumni/models.py:21 alumni/models.py:24 alumni/models.py:25
|
|
39
|
+
msgid "Alumni Config"
|
|
40
|
+
msgstr "Alumni-Konfiguration"
|
|
41
|
+
|
|
42
|
+
#: alumni/models.py:37 alumni/models.py:52
|
|
43
|
+
msgid "True if the corporation has been deleted"
|
|
44
|
+
msgstr "Wahr, wenn die Corporation gelöscht wurde"
|
|
45
|
+
|
|
46
|
+
#: alumni/models.py:39 alumni/models.py:54
|
|
47
|
+
msgid ""
|
|
48
|
+
"An incrementing ID that can be used to canonically establish order of "
|
|
49
|
+
"records in cases where dates may be ambiguous"
|
|
50
|
+
msgstr ""
|
|
51
|
+
"Eine aufsteigende ID, die zur kanonischen Festlegung der Reihenfolge von "
|
|
52
|
+
"Datensätzen in Fällen verwendet werden kann, in denen Daten möglicherweise "
|
|
53
|
+
"nicht eindeutig sind"
|
|
Binary file
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# SOME DESCRIPTIVE TITLE.
|
|
2
|
+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
|
3
|
+
# This file is distributed under the same license as the PACKAGE package.
|
|
4
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
5
|
+
#
|
|
6
|
+
#, fuzzy
|
|
7
|
+
msgid ""
|
|
8
|
+
msgstr ""
|
|
9
|
+
"Project-Id-Version: PACKAGE VERSION\n"
|
|
10
|
+
"Report-Msgid-Bugs-To: \n"
|
|
11
|
+
"POT-Creation-Date: 2024-08-29 14:59+1000\n"
|
|
12
|
+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
13
|
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
14
|
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
15
|
+
"Language: \n"
|
|
16
|
+
"MIME-Version: 1.0\n"
|
|
17
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
18
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
19
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
20
|
+
|
|
21
|
+
#: alumni/models.py:15
|
|
22
|
+
msgid ""
|
|
23
|
+
"Characters with these Corps in their History will be given Alumni Status"
|
|
24
|
+
msgstr ""
|
|
25
|
+
|
|
26
|
+
#: alumni/models.py:19
|
|
27
|
+
msgid ""
|
|
28
|
+
"Characters with these Alliances in their History will be given Alumni Status"
|
|
29
|
+
msgstr ""
|
|
30
|
+
|
|
31
|
+
#: alumni/models.py:22 alumni/models.py:25 alumni/models.py:26
|
|
32
|
+
msgid "Alumni Config"
|
|
33
|
+
msgstr ""
|
|
34
|
+
|
|
35
|
+
#: alumni/models.py:38 alumni/models.py:53
|
|
36
|
+
msgid "True if the corporation has been deleted"
|
|
37
|
+
msgstr ""
|
|
38
|
+
|
|
39
|
+
#: alumni/models.py:40 alumni/models.py:55
|
|
40
|
+
msgid ""
|
|
41
|
+
"An incrementing ID that can be used to canonically establish order of "
|
|
42
|
+
"records in cases where dates may be ambiguous"
|
|
43
|
+
msgstr ""
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Generated by Django 4.2.10 on 2024-05-11 08:13
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
('alumni', '0002_auto_20211230_0147'),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AlterModelOptions(
|
|
14
|
+
name='alumnisetup',
|
|
15
|
+
options={'verbose_name': 'Alumni Config', 'verbose_name_plural': 'Alumni Config'},
|
|
16
|
+
),
|
|
17
|
+
migrations.AlterField(
|
|
18
|
+
model_name='charactercorporationhistory',
|
|
19
|
+
name='record_id',
|
|
20
|
+
field=models.PositiveIntegerField(help_text='An incrementing ID that can be used to canonically establish order of records in cases where dates may be ambiguous'),
|
|
21
|
+
),
|
|
22
|
+
migrations.AlterField(
|
|
23
|
+
model_name='corporationalliancehistory',
|
|
24
|
+
name='record_id',
|
|
25
|
+
field=models.PositiveIntegerField(help_text='An incrementing ID that can be used to canonically establish order of records in cases where dates may be ambiguous'),
|
|
26
|
+
),
|
|
27
|
+
]
|
alumni/models.py
CHANGED
|
@@ -1,31 +1,29 @@
|
|
|
1
|
-
from
|
|
1
|
+
from solo.models import SingletonModel
|
|
2
|
+
|
|
2
3
|
from django.db import models
|
|
4
|
+
from django.utils.translation import gettext as _
|
|
3
5
|
|
|
4
6
|
from allianceauth.eveonline.models import (
|
|
5
7
|
EveAllianceInfo, EveCharacter, EveCorporationInfo,
|
|
6
8
|
)
|
|
7
9
|
|
|
8
10
|
|
|
9
|
-
class AlumniSetup(
|
|
11
|
+
class AlumniSetup(SingletonModel):
|
|
10
12
|
alumni_corporations = models.ManyToManyField(
|
|
11
13
|
EveCorporationInfo,
|
|
12
14
|
blank=True,
|
|
13
|
-
help_text="Characters with these Corps in their History will be given Alumni Status")
|
|
15
|
+
help_text=_("Characters with these Corps in their History will be given Alumni Status"))
|
|
14
16
|
alumni_alliances = models.ManyToManyField(
|
|
15
17
|
EveAllianceInfo,
|
|
16
18
|
blank=True,
|
|
17
|
-
help_text="Characters with these Alliances in their History will be given Alumni Status")
|
|
19
|
+
help_text=_("Characters with these Alliances in their History will be given Alumni Status"))
|
|
18
20
|
|
|
19
|
-
def
|
|
20
|
-
|
|
21
|
-
# Force a single object
|
|
22
|
-
raise ValidationError('There is can be only one \
|
|
23
|
-
AlumniCorp instance')
|
|
24
|
-
self.pk = self.id = 1 # If this happens to be deleted and recreated, force it to be 1
|
|
25
|
-
return super().save(*args, **kwargs)
|
|
21
|
+
def __str__(self):
|
|
22
|
+
return _("Alumni Config")
|
|
26
23
|
|
|
27
24
|
class Meta:
|
|
28
|
-
|
|
25
|
+
verbose_name = _("Alumni Config")
|
|
26
|
+
verbose_name_plural = _("Alumni Config")
|
|
29
27
|
|
|
30
28
|
|
|
31
29
|
class CorporationAllianceHistory(models.Model):
|
|
@@ -37,9 +35,9 @@ class CorporationAllianceHistory(models.Model):
|
|
|
37
35
|
alliance_id = models.PositiveIntegerField(blank=True, null=True, db_index=True)
|
|
38
36
|
is_deleted = models.BooleanField(
|
|
39
37
|
default=False,
|
|
40
|
-
help_text=
|
|
41
|
-
record_id = models.
|
|
42
|
-
help_text=
|
|
38
|
+
help_text=_("True if the corporation has been deleted"))
|
|
39
|
+
record_id = models.PositiveIntegerField(
|
|
40
|
+
help_text=_("An incrementing ID that can be used to canonically establish order of records in cases where dates may be ambiguous"))
|
|
43
41
|
start_date = models.DateTimeField()
|
|
44
42
|
|
|
45
43
|
|
|
@@ -48,13 +46,11 @@ class CharacterCorporationHistory(models.Model):
|
|
|
48
46
|
constraints = [
|
|
49
47
|
models.UniqueConstraint(fields=['character', 'record_id'], name="CharacterCorporationRecord"),
|
|
50
48
|
]
|
|
51
|
-
character = models.ForeignKey(
|
|
52
|
-
EveCharacter,
|
|
53
|
-
on_delete=models.CASCADE)
|
|
49
|
+
character = models.ForeignKey(EveCharacter, on_delete=models.CASCADE)
|
|
54
50
|
corporation_id = models.PositiveIntegerField()
|
|
55
51
|
is_deleted = models.BooleanField(
|
|
56
52
|
default=False,
|
|
57
|
-
help_text=
|
|
58
|
-
record_id = models.
|
|
59
|
-
help_text=
|
|
53
|
+
help_text=_("True if the corporation has been deleted"))
|
|
54
|
+
record_id = models.PositiveIntegerField(
|
|
55
|
+
help_text=_("An incrementing ID that can be used to canonically establish order of records in cases where dates may be ambiguous"))
|
|
60
56
|
start_date = models.DateTimeField()
|
alumni/providers.py
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
from typing import Dict
|
|
2
|
-
|
|
3
1
|
from allianceauth import __version__ as aa__version__
|
|
4
2
|
from allianceauth.services.hooks import get_extension_logger
|
|
3
|
+
from esi import __version__ as esi__version__
|
|
5
4
|
from esi.clients import EsiClientProvider
|
|
6
5
|
|
|
7
|
-
from . import __version__
|
|
6
|
+
from . import __version__
|
|
8
7
|
|
|
9
8
|
logger = get_extension_logger(__name__)
|
|
10
9
|
|
|
11
|
-
APP_INFO_TEXT = f"allianceauth
|
|
10
|
+
APP_INFO_TEXT = f"aa-alumni/{__version__} allianceauth/{aa__version__} django-esi/{esi__version__}"
|
|
12
11
|
|
|
13
12
|
"""
|
|
14
13
|
Swagger spec operations:
|
|
@@ -19,14 +18,14 @@ get_characters_character_id_corporationhistory
|
|
|
19
18
|
esi = EsiClientProvider(app_info_text=APP_INFO_TEXT)
|
|
20
19
|
|
|
21
20
|
|
|
22
|
-
def get_corporations_corporation_id_alliancehistory(corporation_id: int) ->
|
|
21
|
+
def get_corporations_corporation_id_alliancehistory(corporation_id: int) -> dict:
|
|
23
22
|
result = esi.client.Corporation.get_corporations_corporation_id_alliancehistory(
|
|
24
23
|
corporation_id=corporation_id
|
|
25
24
|
).results()
|
|
26
25
|
return result
|
|
27
26
|
|
|
28
27
|
|
|
29
|
-
def get_characters_character_id_corporationhistory(character_id: int) ->
|
|
28
|
+
def get_characters_character_id_corporationhistory(character_id: int) -> dict:
|
|
30
29
|
result = esi.client.Character.get_characters_character_id_corporationhistory(
|
|
31
30
|
character_id=character_id
|
|
32
31
|
).results()
|
alumni/tasks.py
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import datetime
|
|
2
|
+
from random import randint
|
|
2
3
|
|
|
4
|
+
from bravado.exception import HTTPClientError, HTTPInternalServerError
|
|
3
5
|
from celery import shared_task
|
|
4
6
|
|
|
7
|
+
from django.db import IntegrityError
|
|
8
|
+
|
|
5
9
|
from allianceauth.authentication.models import State
|
|
6
10
|
from allianceauth.eveonline.models import EveCharacter
|
|
7
11
|
from allianceauth.services.hooks import get_extension_logger
|
|
8
12
|
|
|
9
|
-
from .app_settings import
|
|
13
|
+
from .app_settings import (
|
|
14
|
+
ALUMNI_CHARACTERCORPORATION_RATELIMIT, ALUMNI_STATE_NAME,
|
|
15
|
+
ALUMNI_TASK_JITTER, ALUMNI_TASK_PRIORITY,
|
|
16
|
+
)
|
|
10
17
|
from .models import (
|
|
11
18
|
AlumniSetup, CharacterCorporationHistory, CorporationAllianceHistory,
|
|
12
19
|
)
|
|
@@ -22,7 +29,8 @@ logger = get_extension_logger(__name__)
|
|
|
22
29
|
def run_alumni_check_all():
|
|
23
30
|
for character in EveCharacter.objects.all().values('character_id'):
|
|
24
31
|
alumni_check_character.apply_async(
|
|
25
|
-
args=[character['character_id']],
|
|
32
|
+
args=[character['character_id']],
|
|
33
|
+
priority=ALUMNI_TASK_PRIORITY
|
|
26
34
|
)
|
|
27
35
|
|
|
28
36
|
|
|
@@ -134,7 +142,7 @@ def char_alliance_datecompare(alliance_id: int, character_id: int) -> bool:
|
|
|
134
142
|
pass
|
|
135
143
|
except Exception as e:
|
|
136
144
|
# Need to actually add some IndexError handling to above tasks, but lets log this gracefully so as not to cactus up the whole thing.
|
|
137
|
-
logger.
|
|
145
|
+
logger.exception(e)
|
|
138
146
|
return False
|
|
139
147
|
|
|
140
148
|
|
|
@@ -144,7 +152,9 @@ def update_all_models():
|
|
|
144
152
|
|
|
145
153
|
for character in EveCharacter.objects.all().values('character_id'):
|
|
146
154
|
update_charactercorporationhistory.apply_async(
|
|
147
|
-
args=[character['character_id']],
|
|
155
|
+
args=[character['character_id']],
|
|
156
|
+
priority=ALUMNI_TASK_PRIORITY,
|
|
157
|
+
countdown=randint(1, ALUMNI_TASK_JITTER)
|
|
148
158
|
)
|
|
149
159
|
|
|
150
160
|
# Once all charactercorporations are updated/exist.
|
|
@@ -159,12 +169,13 @@ def update_all_models_followup():
|
|
|
159
169
|
for char_corp_record in CharacterCorporationHistory.objects.values('corporation_id').distinct():
|
|
160
170
|
update_corporationalliancehistory.apply_async(
|
|
161
171
|
args=[char_corp_record['corporation_id']],
|
|
162
|
-
priority=ALUMNI_TASK_PRIORITY
|
|
172
|
+
priority=ALUMNI_TASK_PRIORITY,
|
|
173
|
+
countdown=randint(1, ALUMNI_TASK_JITTER)
|
|
163
174
|
)
|
|
164
175
|
|
|
165
176
|
|
|
166
|
-
@shared_task
|
|
167
|
-
def update_corporationalliancehistory(corporation_id: int):
|
|
177
|
+
@shared_task(bind=True, rate_limit=ALUMNI_CHARACTERCORPORATION_RATELIMIT)
|
|
178
|
+
def update_corporationalliancehistory(self, corporation_id: int):
|
|
168
179
|
"""Update CorporationAllianceHistory models from ESI
|
|
169
180
|
|
|
170
181
|
Parameters
|
|
@@ -177,19 +188,26 @@ def update_corporationalliancehistory(corporation_id: int):
|
|
|
177
188
|
deleted = True
|
|
178
189
|
else:
|
|
179
190
|
deleted = False
|
|
180
|
-
CorporationAllianceHistory.objects.
|
|
191
|
+
CorporationAllianceHistory.objects.create(
|
|
181
192
|
corporation_id=corporation_id,
|
|
182
193
|
alliance_id=dat['alliance_id'],
|
|
183
194
|
is_deleted=deleted,
|
|
184
195
|
record_id=dat['record_id'],
|
|
185
196
|
start_date=dat['start_date'],
|
|
186
197
|
)
|
|
198
|
+
except IntegrityError:
|
|
199
|
+
# This already exists, move on
|
|
200
|
+
pass
|
|
201
|
+
except HTTPClientError as e: # 429?
|
|
202
|
+
raise self.retry(exc=e, countdown=61)
|
|
203
|
+
except HTTPInternalServerError as e: # Custom timeouts are defined as a 500 on this endpoint
|
|
204
|
+
raise self.retry(exc=e, countdown=61)
|
|
187
205
|
except Exception as e:
|
|
188
|
-
logger.
|
|
206
|
+
logger.exception(e)
|
|
189
207
|
|
|
190
208
|
|
|
191
|
-
@shared_task
|
|
192
|
-
def update_charactercorporationhistory(character_id: int):
|
|
209
|
+
@shared_task(bind=True, rate_limit=ALUMNI_CHARACTERCORPORATION_RATELIMIT)
|
|
210
|
+
def update_charactercorporationhistory(self, character_id: int) -> None:
|
|
193
211
|
"""Update CharacterCorporationHistory models from ESI
|
|
194
212
|
|
|
195
213
|
Parameters
|
|
@@ -200,7 +218,7 @@ def update_charactercorporationhistory(character_id: int):
|
|
|
200
218
|
try:
|
|
201
219
|
character = EveCharacter.objects.get(character_id=character_id)
|
|
202
220
|
except Exception as e:
|
|
203
|
-
logger.
|
|
221
|
+
logger.exception(e)
|
|
204
222
|
return
|
|
205
223
|
|
|
206
224
|
for dat in get_characters_character_id_corporationhistory(character_id):
|
|
@@ -209,14 +227,19 @@ def update_charactercorporationhistory(character_id: int):
|
|
|
209
227
|
deleted = True
|
|
210
228
|
else:
|
|
211
229
|
deleted = False
|
|
212
|
-
|
|
213
|
-
model = CharacterCorporationHistory(
|
|
230
|
+
CharacterCorporationHistory.objects.create(
|
|
214
231
|
character=character,
|
|
215
232
|
corporation_id=dat['corporation_id'],
|
|
216
233
|
is_deleted=deleted,
|
|
217
234
|
record_id=dat['record_id'],
|
|
218
235
|
start_date=dat['start_date'],
|
|
219
236
|
)
|
|
220
|
-
|
|
237
|
+
except IntegrityError:
|
|
238
|
+
# This already exists, move on
|
|
239
|
+
pass
|
|
240
|
+
except HTTPClientError as e: # 429?
|
|
241
|
+
raise self.retry(exc=e, countdown=61)
|
|
242
|
+
except HTTPInternalServerError as e: # Custom timeouts are defined as a 500 on this endpoint
|
|
243
|
+
raise self.retry(exc=e, countdown=61)
|
|
221
244
|
except Exception as e:
|
|
222
|
-
logger.
|
|
245
|
+
logger.exception(e)
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
alumni/__init__.py,sha256=gynnMEjTF3hnWOInUY2HE8WzTMEdanzvhCmrPzzhxHA,187
|
|
2
|
-
alumni/admin.py,sha256=C1-AHencOf4764-iVTLtENN33QjBRNFvlloy4sx7dzQ,754
|
|
3
|
-
alumni/app_settings.py,sha256=fmhFSNdpH7ky2TTVI7JjHp_IUFUiD_fz0JmLqriwk5o,174
|
|
4
|
-
alumni/apps.py,sha256=e58h_dmh1S6Swj6Zb4V5fQx42jMXA_7Tpwq6cKFr4TU,236
|
|
5
|
-
alumni/models.py,sha256=gFvdrMxJ5JIm7cYm8FCrFqKQ9AMIfH-guu3JixW0yns,2432
|
|
6
|
-
alumni/providers.py,sha256=g0i7nqSdnfScx-ZjByFZGoHw-ptNkiey5g_yycobSCQ,999
|
|
7
|
-
alumni/signals.py,sha256=ZiWER0gs-0KCS6nWhCwE1_-iDXr9yrS7NSPBfLBDjak,789
|
|
8
|
-
alumni/tasks.py,sha256=hXd340JHb3HM-ZVdMI4GHJDQ7C6mMrQcwVMYVU9MsR8,8058
|
|
9
|
-
alumni/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
alumni/management/commands/alumni_state.py,sha256=OyJKnkzk9eksk-vULSVBdGvMEhxZX_xa7eH5RXFjeJ8,759
|
|
11
|
-
alumni/migrations/0001_initial.py,sha256=C8R2k4y5KvpTLU_etBQ0J3jkGYd3HAgevAekUZvzxDw,3283
|
|
12
|
-
alumni/migrations/0002_auto_20211230_0147.py,sha256=p3sK1Ohdf6O20tDbMmuPJwC2vVFH-AR0kkXFy9H34_Y,626
|
|
13
|
-
alumni/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
alumni/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
-
aa_alumni-0.1.6a0.dist-info/LICENSE,sha256=M983x9Ht7Kd7YrhBXITYDg1viQWT-3-_e-9MRix08_c,1069
|
|
16
|
-
aa_alumni-0.1.6a0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
17
|
-
aa_alumni-0.1.6a0.dist-info/METADATA,sha256=yav14HivBr6DtDb3-ruj1X2kRBAgydnUJ063_QiqPKM,3243
|
|
18
|
-
aa_alumni-0.1.6a0.dist-info/RECORD,,
|