Skip to content
Snippets Groups Projects
Commit 53fdbf82 authored by Jörn Künsemöller's avatar Jörn Künsemöller
Browse files

Task LSMR-23: Process review

parent 4220edff
No related branches found
No related tags found
1 merge request!87Lsmr epic
......@@ -4245,7 +4245,7 @@ SAS/LSMR/src/lsmr/lsmrapp/__init__.py -text
SAS/LSMR/src/lsmr/lsmrapp/admin.py -text
SAS/LSMR/src/lsmr/lsmrapp/apps.py -text
SAS/LSMR/src/lsmr/lsmrapp/migrations/0001_initial.py -text
SAS/LSMR/src/lsmr/lsmrapp/migrations/0002_auto_20180802_1653.py -text
SAS/LSMR/src/lsmr/lsmrapp/migrations/0002_auto_20180905_1530.py -text
SAS/LSMR/src/lsmr/lsmrapp/migrations/0003_populate.py -text
SAS/LSMR/src/lsmr/lsmrapp/migrations/CMakeLists.txt -text
SAS/LSMR/src/lsmr/lsmrapp/migrations/__init__.py -text
......
# Generated by Django 2.0.6 on 2018-08-02 16:53
# Generated by Django 2.0.6 on 2018-09-05 15:30
import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
......
......@@ -6,7 +6,7 @@ from ..populate import *
class Migration(migrations.Migration):
dependencies = [
('lsmrapp', '0002_auto_20180802_1653'),
('lsmrapp', '0002_auto_20180905_1530'),
]
operations = [ migrations.RunPython(populate_choices) ]
......@@ -2,9 +2,10 @@
This file contains the database models
"""
from django.db.models import Model, CharField, DateTimeField, BooleanField, ForeignKey, CASCADE, IntegerField, SET_NULL, PROTECT, ManyToManyField
from django.db.models import ForeignKey, CharField, DateTimeField, BooleanField, IntegerField, ManyToManyField, \
CASCADE, SET_NULL, PROTECT
from django.contrib.postgres.fields import ArrayField, JSONField
from .specification import AbstractChoice, BasicCommon, Template, NamedCommon, WorkRequestBlueprint
from .specification import AbstractChoice, BasicCommon, Template, NamedCommon # , WorkRequestBlueprint
from enum import Enum
......@@ -49,7 +50,7 @@ class TaskTypeChoice(AbstractChoice):
class Choices(Enum):
OBSERVATION = "observation"
PIPELINE = "pipeline"
COYP = "copy"
COPY = "copy"
INSPECTION = "inspection"
DELETION = "deletion"
......@@ -72,13 +73,16 @@ class TaskTemplate(Template):
queue = BooleanField(default=False)
realtime = BooleanField(default=False)
class DefaultTaskTemplate(BasicCommon):
name = CharField(max_length=30, unique=True)
template = ForeignKey('TaskTemplate', on_delete=PROTECT)
class DataproductSpecificationTemplate(Template):
pass
class DefaultDataproductSpecificationTemplate(BasicCommon):
name = CharField(max_length=30, unique=True)
template = ForeignKey('DataproductSpecificationTemplate', on_delete=PROTECT)
......@@ -97,7 +101,7 @@ class Task(BasicCommon):
specification = JSONField()
work_request_blueprint = ForeignKey('WorkRequestBlueprint', null=True, on_delete=SET_NULL)
template = ForeignKey('TaskTemplate', null=False, on_delete=CASCADE)
#resource_claim = ForeignKey("ResourceClaim", null=False, on_delete=CASCADE) # todo <-- how is this external reference supposed to work?
# resource_claim = ForeignKey("ResourceClaim", null=False, on_delete=CASCADE) # todo <-- how is this external reference supposed to work?
class DataproductRelation(BasicCommon):
......
......@@ -35,7 +35,7 @@ urlpatterns = [
# REST Router
#
router = routers.SimpleRouter()
router = routers.DefaultRouter()
router.register(r'tags', viewsets.TagsViewSet)
# SPECIFICATION
......
......@@ -25,13 +25,13 @@ class Migration(migrations.Migration):
def execute_and_log(cmd):
logger.info('Executing: %s' % cmd)
logger.info('COMMAND: %s' % cmd)
p = sp.Popen(cmd, shell=True, stdout=sp.PIPE, stderr=sp.PIPE)
out, err = p.communicate()
if out is not None:
logger.info("STDOUT: %s" % out)
logger.info("STDOUT: %s" % out.decode('utf-8').strip())
if err is not None:
logger.info("STDERR: %s" % err)
logger.info("STDERR: %s" % err.decode('utf-8').strip())
def delete_old_migrations():
......@@ -39,7 +39,7 @@ def delete_old_migrations():
files = glob_migrations()
for f in [path for path in files if ("auto" in path or "populate" in path)]:
logger.info('...deleting %s' % f)
logger.info('Deleting: %s' % f)
os.remove(f)
execute_and_log('svn rm %s' % f)
......@@ -56,7 +56,7 @@ def make_populate_migration():
migration = template % last_migration
path = here + relapath + '%s_populate.py' % str(int(last_migration.split('_')[0])+1).zfill(4)
logger.info('...writing to %s' % path)
logger.info('Writing to: %s' % path)
with open(path,'w') as f:
f.write(migration)
......@@ -72,7 +72,7 @@ def determine_last_migration():
files = [os.path.basename(path) for path in files]
f = max(files)
last_migration = f.split('.py')[0]
logger.info('...determined last migration: %s' % last_migration)
logger.info('Determined last migration: %s' % last_migration)
return last_migration
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment