From ac25a5883d058bfcb7f24dcc0ad4f832f2106098 Mon Sep 17 00:00:00 2001 From: Taylor Date: Fri, 16 Mar 2018 11:17:14 -0700 Subject: [PATCH] Story/vgnwb 233 (#132) * [VGNWB-219] moved type id to settings. Allowed them to be configurable through export statements and added default values. * [VGNWB-219] updated ready * [VGNWB-219] removed import settings * [VGNWB-219] removed import and changed lifecycle to concept * [VGNWB-219] updated concept type * [VGNWB-210] added code to allow filters to stay applied when going between pages. Also added code to cleanup url * [VGNWB-210] fixed filter resets when switching pages and added a bottom previous button * [VGNWB-210] fixed previous button and set debug back to False * [VGNWB-210] updated annotations view and template in in order to fix loss of filter state. * [VGNWB-210] removed unnecessary js file and script tag, plus unused imports * [VGNWB-207] added filter to filter out duplicate identities * [VGNWB-223]Fixed concept filter from resetting. * [VGNWB-223] removed unused files. * [VGNWB-223] removed unused files. * [VGNWB-223] removed unused files. * [VGNWB-223] removed unused div. * [VGNWB-223] fixed indentation. * [VGNWB-223] removed trailing comma. * [VGNWB-223] fixed id * [VGNWB-223] removed print statements and combined else if into elif. * [VGNWB-226] fixed scroll issue * [VGNWB-226] removed print statement and trailing slash. * [VGNWB-226] Update css. * [VGNWB-233] added embargo time to submit relationship to quadriga. * [VGNWB-233] reverted back celery beat schedule time to 600. * [VGNWB-233] added six version * [VGNWB-233] updated psycopg2 version * [VGNWB-223] updated celery wait to use timedelta. * [VGNWB-233] Changed days from 24 to 3 and re-added requirements. * [VGNWB-233] fixed build error. * [VGNWB-233] removed unneeded requirements. * [VGNWB-233] removed unneeded requirements. --- annotations/tasks.py | 23 +++++++++++++---------- celerybeat-schedule.db | Bin 16384 -> 16384 bytes requirements.txt | 9 +++++---- vogon/settings.py | 8 +++++++- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/annotations/tasks.py b/annotations/tasks.py index 05c5cc19..fdb76421 100644 --- a/annotations/tasks.py +++ b/annotations/tasks.py @@ -9,6 +9,8 @@ from django.contrib.contenttypes.models import ContentType import requests, uuid, re +from datetime import datetime, timedelta +from django.utils import timezone from itertools import groupby, chain from collections import defaultdict @@ -235,16 +237,17 @@ def accession_ready_relationsets(): relationsets = defaultdict(lambda: defaultdict(list)) for relationset in qs: - relationsets[relationset.occursIn.id][relationset.createdBy.id].append(relationset) - for text_id, text_rsets in relationsets.iteritems(): - for user_id, user_rsets in text_rsets.iteritems(): - - # Update state. - def _state(obj): - obj.pending = True - obj.save() - map(_state, user_rsets) - submit_relationsets_to_quadriga.delay(map(lambda o: o.id, user_rsets), text_id, user_id, **kwargs) + timeCreated = relationset.created + if timeCreated + timedelta(days=settings.SUBMIT_WAIT_TIME['days'], hours=settings.SUBMIT_WAIT_TIME['hours'], minutes=settings.SUBMIT_WAIT_TIME['minutes']) < datetime.now(timezone.utc): + relationsets[relationset.occursIn.id][relationset.createdBy.id].append(relationset) + for text_id, text_rsets in relationsets.iteritems(): + for user_id, user_rsets in text_rsets.iteritems(): + # Update state. + def _state(obj): + obj.pending = True + obj.save() + map(_state, user_rsets) + submit_relationsets_to_quadriga.delay(map(lambda o: o.id, user_rsets), text_id, user_id, **kwargs) # TODO: this should be retired. diff --git a/celerybeat-schedule.db b/celerybeat-schedule.db index 07ca479829b966f50d679890de31f6ba18f39894..980ea9b307f48c0f4f3ce6d42b1c74f69dbc082e 100644 GIT binary patch delta 75 zcmZo@U~Fh$+#n#pHkGfQZz|u$i#2?cr^zi+H;Sn+FpepTsW1ewEP%8nh}HuV2I^cT YK?P=9o<@ddlcVKr7|k}%kk3#60H0zPNdN!< delta 75 zcmZo@U~Fh$+#n#pHj}TJZzkWyi?w{r8X75+C&?{RHjJq-FpjA(Oa@|Oa}WU(FbVfj a=PC&*FyrzxG%=YREpNkUym^Lvh5`VAgBH#J diff --git a/requirements.txt b/requirements.txt index f3cd6e7d..a2659932 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,10 @@ anyjson==0.3.3 black-goat-client==0.2.6 bleach==1.4.2 celery==3.1.25 +certifi==2018.1.18 +chardet==3.0.4 conceptpower-api==1.9 +dicttoxml==1.6.6 dj-database-url==0.3.0 dj-static==0.0.6 Django==1.10.6 @@ -34,10 +37,8 @@ pytz==2016.10 redis==2.10.3 requests==2.13.0 requests-oauthlib==0.5.0 -restable>=0.1.3 +restable==0.1.3 +six==1.10.0 Unidecode==0.4.20 urllib3==1.19.1 xmltodict==0.10.2 -dicttoxml==1.6.6 -six==1.10.0 - diff --git a/vogon/settings.py b/vogon/settings.py index b2f00be7..6c633484 100644 --- a/vogon/settings.py +++ b/vogon/settings.py @@ -215,7 +215,7 @@ CELERYBEAT_SCHEDULE = { 'accession_ready_relationsets': { 'task': 'annotations.tasks.accession_ready_relationsets', - 'schedule': timedelta(seconds=600), + 'schedule': timedelta(minutes=10,seconds=0), }, } @@ -257,3 +257,9 @@ 'viaf:corporate': CORPORATE_CONCEPT_TYPE, # E40 Legal Body 'viaf:geographic': GEOGRAPHIC_CONCEPT_TYPE, # E53 Place } + +SUBMIT_WAIT_TIME = { + 'days': 3, + 'hours': 0, + 'minutes': 0 + } \ No newline at end of file