Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envs/.local/.django
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
USE_DOCKER=yes
IPYTHONDIR=/app/.ipython
DJANGO_JWT_SECRET=ILIKEASCREThowlongdoesitNeedtTOBeHey
DJANGO_FILE_STORAGE_PATH=/tmp/django-file-storage
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ scipy = "*"
python-jose = "*"
tabulate = "*"
django-environ = "*"
boto3 = "*"

[dev-packages]
pylint = "*"
Expand Down
48 changes: 47 additions & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/psql
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
COMPOSE_ENV=${COMPOSE_ENV:-local.yml}
CMD='PGPASSWORD=$POSTGRES_PASSWORD psql -h $POSTGRES_HOST -U $POSTGRES_USER -p $POSTGRES_PORT $POSTGRES_DB'

docker-compose -f $COMPOSE_ENV run --rm postgres \
docker-compose -f $COMPOSE_ENV exec postgres \
bash -c "$CMD"
2 changes: 2 additions & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,3 +279,5 @@ def immutable_file_test(path, url):


WHITENOISE_IMMUTABLE_FILE_TEST = immutable_file_test

FILE_STORAGE_PATH = env.str('DJANGO_FILE_STORAGE_PATH')
1 change: 1 addition & 0 deletions config/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@

# Your stuff...
# ------------------------------------------------------------------------------
FILE_STORAGE_PATH = 's3://bucketname/django-file-storage/'
1 change: 1 addition & 0 deletions local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ services:
ports:
- "8000:8000"
command: /start
restart: always

frontend:
build:
Expand Down
5 changes: 5 additions & 0 deletions missioncontrol/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ def validation_error(exception):
return connexion.FlaskApi.get_response(problem)


def not_implemented_error(exception):
problem = connexion.problem(501, "Not Implemented", str(exception))
return connexion.FlaskApi.get_response(problem)


class CustomJSONEncoder(JSONEncoder):

Expand All @@ -45,6 +49,7 @@ def create_app():
app.add_api('openapi.yaml', strict_validation=True)
app.add_error_handler(ObjectDoesNotExist, object_does_not_exist)
app.add_error_handler(ValidationError, validation_error)
app.add_error_handler(NotImplementedError, not_implemented_error)
return app


Expand Down
9 changes: 9 additions & 0 deletions missioncontrol/home/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,12 @@ class TaskStackAdmin(admin.ModelAdmin):
'tasks'
)
list_filter = ('environment',)

@admin.register(models.TaskRun)
class TaskRunAdmin(admin.ModelAdmin):
list_display = (
'uuid',
'task',
'task_stack',
'task_pass',
)
50 changes: 50 additions & 0 deletions missioncontrol/home/migrations/0021_auto_20190304_0300.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Generated by Django 2.1.4 on 2019-03-04 03:00

from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import home.models
import uuid


class Migration(migrations.Migration):

dependencies = [
('home', '0020_merge_20190124_0028'),
]

operations = [
migrations.CreateModel(
name='S3File',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('cid', models.CharField(max_length=128, unique=True)),
('what', models.TextField()),
('where', models.TextField()),
('path', models.TextField(blank=True, null=True)),
('start', home.models.ISODateTimeField(default=django.utils.timezone.now, help_text='The time of the first event in the file. If instantaneous, set this and leave end as null')),
('end', home.models.ISODateTimeField(blank=True, help_text='The time of the last event in the file. Can be blank if instantaneous file.', null=True)),
('created', home.models.ISODateTimeField(auto_now_add=True)),
],
bases=(models.Model, home.models.Serializable),
),
migrations.CreateModel(
name='TaskRun',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('uuid', models.UUIDField(default=uuid.uuid4, unique=True)),
('task', models.TextField()),
('start_time', home.models.ISODateTimeField()),
('end_time', home.models.ISODateTimeField()),
('exit_code', models.IntegerField()),
('task_pass', models.ForeignKey(db_column='pass', on_delete=django.db.models.deletion.PROTECT, to='home.Pass', to_field='uuid')),
('task_stack', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='home.TaskStack', to_field='uuid')),
],
bases=(models.Model, home.models.Serializable),
),
migrations.AddField(
model_name='s3file',
name='task_run',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='files', to='home.TaskRun', to_field='uuid'),
),
]
33 changes: 33 additions & 0 deletions missioncontrol/home/migrations/0022_auto_20190306_0017.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 2.1.4 on 2019-03-06 00:17

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('home', '0021_auto_20190304_0300'),
]

operations = [
migrations.AddField(
model_name='s3file',
name='version',
field=models.IntegerField(default=1),
preserve_default=False,
),
migrations.AddField(
model_name='s3file',
name='work_id',
field=models.TextField(default=1),
preserve_default=False,
),
migrations.RemoveField(
model_name='s3file',
name='task_run',
),
migrations.AlterUniqueTogether(
name='s3file',
unique_together={('version', 'what', 'where', 'work_id')},
),
]
22 changes: 22 additions & 0 deletions missioncontrol/home/migrations/0023_auto_20190306_0231.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 2.1.4 on 2019-03-06 02:31

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('home', '0022_auto_20190306_0017'),
]

operations = [
migrations.AlterModelOptions(
name='s3file',
options={'ordering': ('-version',)},
),
migrations.AlterField(
model_name='s3file',
name='work_id',
field=models.TextField(blank=True, null=True),
),
]
Loading