mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-14 16:55:42 +00:00
Update
This commit is contained in:
parent
3bfe50b15c
commit
37d5802b42
@ -15,8 +15,8 @@ before_script:
|
|||||||
|
|
||||||
Build:
|
Build:
|
||||||
script:
|
script:
|
||||||
- docker build --pull -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
|
- docker build --pull -t $CI_REGISTRY_IMAGE:tmp .
|
||||||
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
- docker push $CI_REGISTRY_IMAGE:tmp
|
||||||
stage: build
|
stage: build
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
@ -25,8 +25,8 @@ Push development:
|
|||||||
only:
|
only:
|
||||||
- development
|
- development
|
||||||
script:
|
script:
|
||||||
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
- docker pull $CI_REGISTRY_IMAGE:tmp
|
||||||
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:development
|
- docker tag $CI_REGISTRY_IMAGE:tmp $CI_REGISTRY_IMAGE:development
|
||||||
- docker push $CI_REGISTRY_IMAGE:development
|
- docker push $CI_REGISTRY_IMAGE:development
|
||||||
stage: push
|
stage: push
|
||||||
tags:
|
tags:
|
||||||
@ -36,8 +36,8 @@ Push latest:
|
|||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
script:
|
script:
|
||||||
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
- docker pull $CI_REGISTRY_IMAGE:tmp
|
||||||
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
|
- docker tag $CI_REGISTRY_IMAGE:tmp $CI_REGISTRY_IMAGE:latest
|
||||||
- docker push $CI_REGISTRY_IMAGE:latest
|
- docker push $CI_REGISTRY_IMAGE:latest
|
||||||
stage: push
|
stage: push
|
||||||
tags:
|
tags:
|
||||||
@ -47,8 +47,8 @@ Push tag:
|
|||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
script:
|
script:
|
||||||
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
- docker pull $CI_REGISTRY_IMAGE:tmp
|
||||||
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
- docker tag $CI_REGISTRY_IMAGE:tmp $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
||||||
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
||||||
stage: push
|
stage: push
|
||||||
tags:
|
tags:
|
||||||
|
@ -19,7 +19,7 @@ def add_corpus():
|
|||||||
if add_corpus_form.validate_on_submit():
|
if add_corpus_form.validate_on_submit():
|
||||||
corpus = Corpus(creator=current_user,
|
corpus = Corpus(creator=current_user,
|
||||||
description=add_corpus_form.description.data,
|
description=add_corpus_form.description.data,
|
||||||
title=add_corpus_form.title.data)
|
status='unprepared', title=add_corpus_form.title.data)
|
||||||
db.session.add(corpus)
|
db.session.add(corpus)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
dir = os.path.join(current_app.config['OPAQUE_STORAGE_DIRECTORY'],
|
dir = os.path.join(current_app.config['OPAQUE_STORAGE_DIRECTORY'],
|
||||||
@ -113,6 +113,7 @@ def add_corpus_file(corpus_id):
|
|||||||
corpus=corpus, dir=dir, filename=filename,
|
corpus=corpus, dir=dir, filename=filename,
|
||||||
publishing_year=add_corpus_file_form.publishing_year.data,
|
publishing_year=add_corpus_file_form.publishing_year.data,
|
||||||
title=add_corpus_file_form.title.data)
|
title=add_corpus_file_form.title.data)
|
||||||
|
corpus_file.insert_metadata()
|
||||||
db.session.add(corpus_file)
|
db.session.add(corpus_file)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
flash('Corpus file added!')
|
flash('Corpus file added!')
|
||||||
@ -166,6 +167,7 @@ def edit_corpus_file(corpus_id, corpus_file_id):
|
|||||||
corpus_file.author = edit_corpus_file_form.author.data
|
corpus_file.author = edit_corpus_file_form.author.data
|
||||||
corpus_file.publishing_year = edit_corpus_file_form.publishing_year.data
|
corpus_file.publishing_year = edit_corpus_file_form.publishing_year.data
|
||||||
corpus_file.title = edit_corpus_file_form.title.data
|
corpus_file.title = edit_corpus_file_form.title.data
|
||||||
|
corpus_file.insert_metadata()
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
flash('Corpus file edited!')
|
flash('Corpus file edited!')
|
||||||
return redirect(url_for('corpora.corpus', corpus_id=corpus_id))
|
return redirect(url_for('corpora.corpus', corpus_id=corpus_id))
|
||||||
|
@ -424,6 +424,9 @@ class CorpusFile(db.Model):
|
|||||||
db.session.delete(self)
|
db.session.delete(self)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
def insert_metadata(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Corpus(db.Model):
|
class Corpus(db.Model):
|
||||||
"""
|
"""
|
||||||
@ -436,16 +439,12 @@ class Corpus(db.Model):
|
|||||||
description = db.Column(db.String(255))
|
description = db.Column(db.String(255))
|
||||||
title = db.Column(db.String(32))
|
title = db.Column(db.String(32))
|
||||||
user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
|
user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
|
||||||
status = db.Column(db.String(16))
|
|
||||||
# Relationships
|
# Relationships
|
||||||
files = db.relationship('CorpusFile',
|
files = db.relationship('CorpusFile',
|
||||||
backref='corpus',
|
backref='corpus',
|
||||||
lazy='dynamic',
|
lazy='dynamic',
|
||||||
cascade='save-update, merge, delete')
|
cascade='save-update, merge, delete')
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
|
||||||
super(Corpus, self).__init__(**kwargs)
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
"""
|
"""
|
||||||
String representation of the corpus. For human readability.
|
String representation of the corpus. For human readability.
|
||||||
@ -482,6 +481,9 @@ class Corpus(db.Model):
|
|||||||
db.session.delete(self)
|
db.session.delete(self)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
def prepare(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
' Flask-Login is told to use the application’s custom anonymous user by setting
|
' Flask-Login is told to use the application’s custom anonymous user by setting
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from .models import Job, User, Corpus
|
from .models import Job, User, Corpus, CorpusFile
|
||||||
from . import db
|
from . import db
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
@ -64,3 +64,8 @@ def background_delete_corpus(app, corpus_id):
|
|||||||
logger.warning('Corpus id is: {}.'.format(corpus_id))
|
logger.warning('Corpus id is: {}.'.format(corpus_id))
|
||||||
corpus = Corpus.query.filter_by(id=corpus_id).first()
|
corpus = Corpus.query.filter_by(id=corpus_id).first()
|
||||||
corpus.delete()
|
corpus.delete()
|
||||||
|
|
||||||
|
|
||||||
|
def background_prepare_corpus_file(app, corpus_file_id):
|
||||||
|
with app.app_context():
|
||||||
|
corpus_file = CorpusFile.query.filter_by(id=corpus_file_id).first()
|
||||||
|
Loading…
Reference in New Issue
Block a user