Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.1 #142

Merged
merged 24 commits into from
May 5, 2020
Merged

v1.1 #142

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
ignore = E501
exclude = .git,__pycache__,sip_assembly/migrations
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.5
hooks:
- id: autopep8
args:
- --in-place
- --aggressive
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
- id: flake8
- repo: git://github.com/doublify/pre-commit-isort
rev: v4.3.0
hooks:
- id: isort
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ before_install:
- cp fornax/config.py.example fornax/config.py
- docker-compose up -d
- sleep 20s
- docker-compose exec fornax-web pip install coverage
- docker-compose exec fornax-web pip install coverage pre-commit
- docker-compose exec fornax-web pre-commit install
install: true
before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
script:
- docker-compose exec fornax-web pre-commit run --all-files --show-diff-on-failure
- docker-compose exec fornax-web coverage run manage.py test
after_script:
- docker-compose exec fornax-web coverage xml
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ fornax has six services, all of which are exposed via HTTP endpoints (see [Route
* Cleanup - removes files from the destination directory.
* Request Cleanup - sends a POST request to another service requesting cleanup of the source directory. fornax only has read access for this directory.

![SIP Assembly diagram](fornax-services.png)

For an example of the data fornax expects to receive (both bags and JSON), see the `fixtures/` directory


Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ services:
entrypoint: /code/entrypoint.sh
volumes:
- .:/code
- ~/.am/ss-location-data:/code/archivematica_transfer_source/
ports:
- "8003:8003"
depends_on:
Expand Down
3 changes: 0 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,5 @@ fi
echo "Apply database migrations"
python manage.py migrate

echo "Create dirs"
python manage.py shell < make_dirs.py

echo "Starting server"
python manage.py runserver 0.0.0.0:8003
Binary file removed fornax-services.png
Binary file not shown.
7 changes: 3 additions & 4 deletions fornax/config.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ ALLOWED_HOSTS = ['fornax-web', 'localhost']
BASE_DIR = ''

SRC_DIR = '{}/src'.format(BASE_DIR)
TEST_SRC_DIR = '{}/src_test'.format(BASE_DIR)
TMP_DIR = '{}/tmp'.format(BASE_DIR)
TEST_TMP_DIR = '{}/tmp_test'.format(BASE_DIR)
DEST_DIR = '{}/dest'.format(BASE_DIR)
TEST_DEST_DIR = '{}/dest_test'.format(BASE_DIR)

PROCESSING_CONFIG_DIR = 'processing_configs'
PROCESSING_CONFIG = 'processingMCP.xml'
Expand Down Expand Up @@ -51,4 +48,6 @@ ARCHIVEMATICA = {
}
}

STATIC_ROOT = '/static'
STATIC_ROOT = "/static"

CLEANUP_URL = "http://ursa-major-web:8005/cleanup/"
6 changes: 3 additions & 3 deletions fornax/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

import os

from fornax import config as CF

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
Expand Down Expand Up @@ -40,6 +41,7 @@
'sip_assembly',
'rest_framework',
'health_check',
'asterism',
]

MIDDLEWARE = [
Expand Down Expand Up @@ -115,14 +117,12 @@
STATIC_ROOT = CF.STATIC_ROOT

SRC_DIR = CF.SRC_DIR
TEST_SRC_DIR = CF.TEST_SRC_DIR
TMP_DIR = CF.TMP_DIR
TEST_TMP_DIR = CF.TEST_TMP_DIR
DEST_DIR = CF.DEST_DIR
TEST_DEST_DIR = CF.TEST_DEST_DIR
PROCESSING_CONFIG_DIR = CF.PROCESSING_CONFIG_DIR
PROCESSING_CONFIG = CF.PROCESSING_CONFIG
ARCHIVEMATICA = CF.ARCHIVEMATICA
CLEANUP_URL = CF.CLEANUP_URL

REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
Expand Down
12 changes: 4 additions & 8 deletions fornax/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,12 @@
"""
from django.conf.urls import url
from django.urls import include
from sip_assembly.views import (
SIPViewSet,
SIPAssemblyView,
CreatePackageView,
RemoveCompletedTransfersView,
RemoveCompletedIngestsView,
CleanupRoutineView,
CleanupRequestView)
from rest_framework import routers
from rest_framework.schemas import get_schema_view
from sip_assembly.views import (CleanupRequestView, CleanupRoutineView,
CreatePackageView, RemoveCompletedIngestsView,
RemoveCompletedTransfersView, SIPAssemblyView,
SIPViewSet)

router = routers.DefaultRouter()
router.register(r'sips', SIPViewSet)
Expand Down
11 changes: 0 additions & 11 deletions make_dirs.py

This file was deleted.

4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
amclient==1.0.0
asterism==0.5.2
bagit==1.7.0
certifi==2019.11.28
chardet==3.0.4
click==7.0
clinner==1.12.3
colorlog==4.0.2
csvvalidator==1.2
Django==2.2.8
Django==2.2.10
djangorestframework==3.10.3
git+https://github.com/RockefellerArchiveCenter/asterism@v0.1#egg=asterism
gitdb2==2.0.6
GitPython==3.0.5
health-check==3.4.1
Expand Down
3 changes: 0 additions & 3 deletions sip_assembly/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
from django.contrib import admin

# Register your models here.
27 changes: 24 additions & 3 deletions sip_assembly/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,34 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='SIP',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('process_status', models.CharField(choices=[(10, 'New SIP created'), (20, 'SIP files moved to processing'), (30, 'SIP validated according to BagIt'), (30, 'SIP restructured'), (40, 'PREMIS CSV rights added to SIP'), (50, 'Submission documentation added to SIP'), (60, 'SIP bag-info.txt updated'), (70, 'SIP Manifests updated'), (90, 'SIP Delivered to Archivematica Transfer Source')], max_length=100)),
('id', models.AutoField(auto_created=True,
primary_key=True, serialize=False, verbose_name='ID')),
('process_status',
models.CharField(choices=[(10,
'New SIP created'),
(20,
'SIP files moved to processing'),
(30,
'SIP validated according to BagIt'),
(30,
'SIP restructured'),
(40,
'PREMIS CSV rights added to SIP'),
(50,
'Submission documentation added to SIP'),
(60,
'SIP bag-info.txt updated'),
(70,
'SIP Manifests updated'),
(90,
'SIP Delivered to Archivematica Transfer Source')],
max_length=100)),
('bag_path', models.CharField(max_length=100)),
('bag_identifier', models.CharField(max_length=255, unique=True)),
('created', models.DateTimeField(auto_now=True)),
('last_modified', models.DateTimeField(auto_now_add=True)),
('data', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)),
('data', django.contrib.postgres.fields.jsonb.JSONField(
blank=True, null=True)),
],
),
]
24 changes: 23 additions & 1 deletion sip_assembly/migrations/0002_auto_20180910_1744.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,28 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='sip',
name='process_status',
field=models.CharField(choices=[(10, 'New SIP created'), (20, 'SIP files moved to processing'), (30, 'SIP validated according to BagIt'), (30, 'SIP restructured'), (40, 'PREMIS CSV rights added to SIP'), (50, 'Submission documentation added to SIP'), (60, 'SIP bag-info.txt updated'), (70, 'Archivematica processing config added'), (80, 'SIP Manifests updated'), (90, 'SIP Delivered to Archivematica Transfer Source')], max_length=100),
field=models.CharField(
choices=[
(10,
'New SIP created'),
(20,
'SIP files moved to processing'),
(30,
'SIP validated according to BagIt'),
(30,
'SIP restructured'),
(40,
'PREMIS CSV rights added to SIP'),
(50,
'Submission documentation added to SIP'),
(60,
'SIP bag-info.txt updated'),
(70,
'Archivematica processing config added'),
(80,
'SIP Manifests updated'),
(90,
'SIP Delivered to Archivematica Transfer Source')],
max_length=100),
),
]
12 changes: 11 additions & 1 deletion sip_assembly/migrations/0003_auto_20181112_2040.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='sip',
name='process_status',
field=models.CharField(choices=[(10, 'New SIP created'), (20, 'SIP assembled and delivered to Archivematica'), (30, 'SIP started in Archivematica'), (40, 'SIP approved in Archivematica')], max_length=100),
field=models.CharField(
choices=[
(10,
'New SIP created'),
(20,
'SIP assembled and delivered to Archivematica'),
(30,
'SIP started in Archivematica'),
(40,
'SIP approved in Archivematica')],
max_length=100),
),
]
14 changes: 13 additions & 1 deletion sip_assembly/migrations/0004_auto_20181118_2151.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='sip',
name='process_status',
field=models.CharField(choices=[(10, 'New SIP created'), (20, 'SIP assembled and delivered to Archivematica'), (30, 'SIP started in Archivematica'), (40, 'SIP approved in Archivematica'), (50, 'SIP removed from src directory')], max_length=100),
field=models.CharField(
choices=[
(10,
'New SIP created'),
(20,
'SIP assembled and delivered to Archivematica'),
(30,
'SIP started in Archivematica'),
(40,
'SIP approved in Archivematica'),
(50,
'SIP removed from src directory')],
max_length=100),
),
]
11 changes: 10 additions & 1 deletion sip_assembly/migrations/0005_sip_origin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='sip',
name='origin',
field=models.CharField(choices=[('aurora', 'Aurora'), ('legacy_digital', 'Legacy Digital Processing'), ('digitization', 'Digitization')], default='aurora', max_length=20),
field=models.CharField(
choices=[
('aurora',
'Aurora'),
('legacy_digital',
'Legacy Digital Processing'),
('digitization',
'Digitization')],
default='aurora',
max_length=20),
),
]
38 changes: 38 additions & 0 deletions sip_assembly/migrations/0006_auto_20200317_0220.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Generated by Django 2.2.10 on 2020-03-17 02:20

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('sip_assembly', '0005_sip_origin'),
]

operations = [
migrations.AddField(
model_name='sip',
name='type',
field=models.CharField(blank=True, choices=[('aip', 'Archival Information Package'), ('dip', 'Dissemination Information Package')], max_length=50, null=True),
),
migrations.AlterField(
model_name='sip',
name='bag_path',
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name='sip',
name='created',
field=models.DateTimeField(auto_now_add=True),
),
migrations.AlterField(
model_name='sip',
name='last_modified',
field=models.DateTimeField(auto_now=True),
),
migrations.AlterField(
model_name='sip',
name='process_status',
field=models.IntegerField(),
),
]
17 changes: 2 additions & 15 deletions sip_assembly/models.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from django.contrib.postgres.fields import JSONField
from django.db import models
from asterism.models import BasePackage


class SIP(models.Model):
class SIP(BasePackage):
CREATED = 10
ASSEMBLED = 20
STARTED = 30
Expand All @@ -15,15 +14,3 @@ class SIP(models.Model):
(APPROVED, "SIP approved in Archivematica"),
(CLEANED_UP, "SIP removed from src directory")
)
process_status = models.CharField(max_length=100, choices=PROCESS_STATUS_CHOICES)
bag_path = models.CharField(max_length=100)
bag_identifier = models.CharField(max_length=255, unique=True)
created = models.DateTimeField(auto_now=True)
last_modified = models.DateTimeField(auto_now_add=True)
data = JSONField(null=True, blank=True)
ORIGIN_CHOICES = (
('aurora', 'Aurora'),
('legacy_digital', 'Legacy Digital Processing'),
('digitization', 'Digitization')
)
origin = models.CharField(max_length=20, choices=ORIGIN_CHOICES, default='aurora')
Loading