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:
|
||||
script:
|
||||
- docker build --pull -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
|
||||
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||
- docker build --pull -t $CI_REGISTRY_IMAGE:tmp .
|
||||
- docker push $CI_REGISTRY_IMAGE:tmp
|
||||
stage: build
|
||||
tags:
|
||||
- docker
|
||||
@ -25,8 +25,8 @@ Push development:
|
||||
only:
|
||||
- development
|
||||
script:
|
||||
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:development
|
||||
- docker pull $CI_REGISTRY_IMAGE:tmp
|
||||
- docker tag $CI_REGISTRY_IMAGE:tmp $CI_REGISTRY_IMAGE:development
|
||||
- docker push $CI_REGISTRY_IMAGE:development
|
||||
stage: push
|
||||
tags:
|
||||
@ -36,8 +36,8 @@ Push latest:
|
||||
only:
|
||||
- master
|
||||
script:
|
||||
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
|
||||
- docker pull $CI_REGISTRY_IMAGE:tmp
|
||||
- docker tag $CI_REGISTRY_IMAGE:tmp $CI_REGISTRY_IMAGE:latest
|
||||
- docker push $CI_REGISTRY_IMAGE:latest
|
||||
stage: push
|
||||
tags:
|
||||
@ -47,8 +47,8 @@ Push tag:
|
||||
only:
|
||||
- tags
|
||||
script:
|
||||
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
||||
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
||||
- docker pull $CI_REGISTRY_IMAGE:tmp
|
||||
- docker tag $CI_REGISTRY_IMAGE:tmp $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
||||
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
||||
stage: push
|
||||
tags:
|
||||
|
@ -19,7 +19,7 @@ def add_corpus():
|
||||
if add_corpus_form.validate_on_submit():
|
||||
corpus = Corpus(creator=current_user,
|
||||
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.commit()
|
||||
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,
|
||||
publishing_year=add_corpus_file_form.publishing_year.data,
|
||||
title=add_corpus_file_form.title.data)
|
||||
corpus_file.insert_metadata()
|
||||
db.session.add(corpus_file)
|
||||
db.session.commit()
|
||||
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.publishing_year = edit_corpus_file_form.publishing_year.data
|
||||
corpus_file.title = edit_corpus_file_form.title.data
|
||||
corpus_file.insert_metadata()
|
||||
db.session.commit()
|
||||
flash('Corpus file edited!')
|
||||
return redirect(url_for('corpora.corpus', corpus_id=corpus_id))
|
||||
|
@ -424,6 +424,9 @@ class CorpusFile(db.Model):
|
||||
db.session.delete(self)
|
||||
db.session.commit()
|
||||
|
||||
def insert_metadata(self):
|
||||
pass
|
||||
|
||||
|
||||
class Corpus(db.Model):
|
||||
"""
|
||||
@ -436,16 +439,12 @@ class Corpus(db.Model):
|
||||
description = db.Column(db.String(255))
|
||||
title = db.Column(db.String(32))
|
||||
user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
|
||||
status = db.Column(db.String(16))
|
||||
# Relationships
|
||||
files = db.relationship('CorpusFile',
|
||||
backref='corpus',
|
||||
lazy='dynamic',
|
||||
cascade='save-update, merge, delete')
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(Corpus, self).__init__(**kwargs)
|
||||
|
||||
def __repr__(self):
|
||||
"""
|
||||
String representation of the corpus. For human readability.
|
||||
@ -482,6 +481,9 @@ class Corpus(db.Model):
|
||||
db.session.delete(self)
|
||||
db.session.commit()
|
||||
|
||||
def prepare(self):
|
||||
pass
|
||||
|
||||
|
||||
'''
|
||||
' 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
|
||||
import logging
|
||||
|
||||
@ -64,3 +64,8 @@ def background_delete_corpus(app, corpus_id):
|
||||
logger.warning('Corpus id is: {}.'.format(corpus_id))
|
||||
corpus = Corpus.query.filter_by(id=corpus_id).first()
|
||||
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