Skip to content

Commit 3eef8ce

Browse files
committed
Merge from apdavison/master
* commit 'd73cede4159363627cb4f16facdb164565c5dc98': Add some methods to help sumatra_server Add migrations Changes to work with Django 2.x Test with Python 3.8 # Conflicts: # sumatra/tee.py
2 parents 416ce5d + d73cede commit 3eef8ce

13 files changed

Lines changed: 203 additions & 23 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ python:
44
- "2.7"
55
- "3.6"
66
- "3.7"
7+
- "3.8"
78
env:
89
global:
910
- PATH=/home/travis/miniconda/bin:$PATH

ci/requirements-3.6.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# Additional requirements for Python 3.5
1+
# Additional requirements for Python 3.6
22
pyyaml # this is already in requirements.txt, but pip doesn't allow empty requirements files

ci/requirements-3.7.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# Additional requirements for Python 3.5
1+
# Additional requirements for Python 3.7
22
pyyaml # this is already in requirements.txt, but pip doesn't allow empty requirements files

ci/requirements-3.8.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Additional requirements for Python 3.8
2+
pyyaml # this is already in requirements.txt, but pip doesn't allow empty requirements files

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def get_tip_revision(self, path=os.getcwd()):
2727
return repo.head.commit.hexsha[:7]
2828

2929

30-
install_requires = ['Django>=1.8, <2', 'django-tagging', 'httplib2',
30+
install_requires = ['Django>=1.8, <3', 'django-tagging', 'httplib2',
3131
'docutils', 'jinja2', 'parameters', 'future']
3232
major_python_version, minor_python_version, _, _, _ = sys.version_info
3333
if major_python_version < 3 or (major_python_version == 3 and minor_python_version < 4):
@@ -40,6 +40,7 @@ def get_tip_revision(self, path=os.getcwd()):
4040
package_dir = {'sumatra': 'sumatra'},
4141
packages = ['sumatra', 'sumatra.dependency_finder', 'sumatra.datastore',
4242
'sumatra.recordstore', 'sumatra.recordstore.django_store',
43+
'sumatra.recordstore.django_store.migrations',
4344
'sumatra.versioncontrol', 'sumatra.formatting',
4445
'sumatra.web', 'sumatra.web.templatetags',
4546
'sumatra.publishing',

sumatra/datastore/base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ def contains_path(self, path):
6565
"""Does the store contain a data item with the given path?"""
6666
raise NotImplementedError
6767

68+
def get_type(self):
69+
return self.__class__.__name__
70+
6871

6972
class DataKey(object):
7073
"""

sumatra/formatting/__init__.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@
1414

1515
import json
1616
import textwrap
17-
import cgi
17+
try:
18+
from html import escape
19+
except ImportError: # Python 2.7
20+
from cgi import escape
1821
import re
19-
from ..core import component, component_type, get_registered_components
20-
import parameters
2122
from functools import reduce
2223
import os
2324

25+
from ..core import component, component_type, get_registered_components
26+
import parameters
27+
2428

2529

2630
fields = ['label', 'timestamp', 'reason', 'outcome', 'duration', 'repository',
@@ -465,7 +469,7 @@ def long(self):
465469
def format_record(record):
466470
output = " <dt>%s</dt>\n <dd>\n <dl>\n" % record.label
467471
for field in fields:
468-
output += " <dt>%s</dt><dd>%s</dd>\n" % (field, cgi.escape(str(getattr(record, field))))
472+
output += " <dt>%s</dt><dd>%s</dd>\n" % (field, escape(str(getattr(record, field))))
469473
output += " </dl>\n </dd>"
470474
return output
471475
return "<dl>\n" + "\n".join(format_record(record) for record in self.records) + "\n</dl>"
@@ -475,7 +479,7 @@ def table(self):
475479
Return detailed information about a list of records as an HTML table.
476480
"""
477481
def format_record(record):
478-
return " <tr>\n <td>" + "</td>\n <td>".join(cgi.escape(str(getattr(record, field))) for field in fields) + " </td>\n </tr>"
482+
return " <tr>\n <td>" + "</td>\n <td>".join(escape(str(getattr(record, field))) for field in fields) + " </td>\n </tr>"
479483
return "<table>\n" + \
480484
" <tr>\n <th>" + "</th>\n <th>".join(field.title() for field in fields) + " </th>\n </tr>\n" + \
481485
"\n".join(format_record(record) for record in self.records) + \

sumatra/launch.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ def get_platform_information(self):
154154
version=platform.version())]
155155
# maybe add system time?
156156

157+
def get_type(self):
158+
return self.__class__.__name__
159+
157160

158161
@component
159162
class SerialLaunchMode(LaunchMode):
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
# Generated by Django 2.2.14 on 2020-07-30 13:11
2+
3+
from django.db import migrations, models
4+
import django.db.models.deletion
5+
import tagging.fields
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
initial = True
11+
12+
dependencies = [
13+
]
14+
15+
operations = [
16+
migrations.CreateModel(
17+
name='DataKey',
18+
fields=[
19+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
20+
('path', models.CharField(max_length=200)),
21+
('digest', models.CharField(max_length=40)),
22+
('creation', models.DateTimeField(blank=True, null=True)),
23+
('metadata', models.TextField(blank=True)),
24+
],
25+
options={
26+
'ordering': ('path',),
27+
},
28+
),
29+
migrations.CreateModel(
30+
name='Datastore',
31+
fields=[
32+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
33+
('type', models.CharField(max_length=100)),
34+
('parameters', models.CharField(max_length=200)),
35+
],
36+
options={
37+
'abstract': False,
38+
},
39+
),
40+
migrations.CreateModel(
41+
name='Dependency',
42+
fields=[
43+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
44+
('name', models.CharField(max_length=50)),
45+
('path', models.CharField(max_length=200)),
46+
('version', models.CharField(max_length=40)),
47+
('diff', models.TextField(blank=True)),
48+
('source', models.CharField(blank=True, max_length=200, null=True)),
49+
('module', models.CharField(max_length=50)),
50+
],
51+
options={
52+
'ordering': ['name'],
53+
},
54+
),
55+
migrations.CreateModel(
56+
name='Executable',
57+
fields=[
58+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
59+
('path', models.CharField(max_length=200)),
60+
('name', models.CharField(max_length=50)),
61+
('version', models.CharField(max_length=100)),
62+
('options', models.CharField(max_length=50)),
63+
],
64+
options={
65+
'abstract': False,
66+
},
67+
),
68+
migrations.CreateModel(
69+
name='LaunchMode',
70+
fields=[
71+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
72+
('type', models.CharField(max_length=100)),
73+
('parameters', models.CharField(max_length=1000)),
74+
],
75+
options={
76+
'abstract': False,
77+
},
78+
),
79+
migrations.CreateModel(
80+
name='ParameterSet',
81+
fields=[
82+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
83+
('type', models.CharField(max_length=100)),
84+
('content', models.TextField()),
85+
],
86+
options={
87+
'abstract': False,
88+
},
89+
),
90+
migrations.CreateModel(
91+
name='PlatformInformation',
92+
fields=[
93+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
94+
('architecture_bits', models.CharField(max_length=100)),
95+
('architecture_linkage', models.CharField(max_length=100)),
96+
('machine', models.CharField(max_length=20)),
97+
('network_name', models.CharField(max_length=100)),
98+
('ip_addr', models.GenericIPAddressField()),
99+
('processor', models.CharField(max_length=100)),
100+
('release', models.CharField(max_length=100)),
101+
('system_name', models.CharField(max_length=20)),
102+
('version', models.CharField(max_length=100)),
103+
],
104+
options={
105+
'abstract': False,
106+
},
107+
),
108+
migrations.CreateModel(
109+
name='Project',
110+
fields=[
111+
('id', models.SlugField(primary_key=True, serialize=False)),
112+
('name', models.CharField(max_length=200)),
113+
('description', models.TextField(blank=True)),
114+
],
115+
options={
116+
'ordering': ('id',),
117+
},
118+
),
119+
migrations.CreateModel(
120+
name='Repository',
121+
fields=[
122+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
123+
('type', models.CharField(max_length=100)),
124+
('url', models.URLField()),
125+
('upstream', models.URLField(blank=True, null=True)),
126+
],
127+
options={
128+
'abstract': False,
129+
},
130+
),
131+
migrations.CreateModel(
132+
name='Record',
133+
fields=[
134+
('label', models.CharField(max_length=100)),
135+
('db_id', models.AutoField(primary_key=True, serialize=False)),
136+
('reason', models.TextField(blank=True)),
137+
('duration', models.FloatField(null=True)),
138+
('main_file', models.CharField(max_length=100)),
139+
('version', models.CharField(max_length=50)),
140+
('outcome', models.TextField(blank=True)),
141+
('timestamp', models.DateTimeField()),
142+
('tags', tagging.fields.TagField(blank=True, max_length=255)),
143+
('diff', models.TextField(blank=True)),
144+
('user', models.CharField(max_length=100)),
145+
('script_arguments', models.TextField(blank=True)),
146+
('stdout_stderr', models.TextField(blank=True)),
147+
('repeats', models.CharField(blank=True, max_length=100, null=True)),
148+
('datastore', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_store.Datastore')),
149+
('dependencies', models.ManyToManyField(to='django_store.Dependency')),
150+
('executable', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='django_store.Executable')),
151+
('input_data', models.ManyToManyField(related_name='input_to_records', to='django_store.DataKey')),
152+
('input_datastore', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='input_to_records', to='django_store.Datastore')),
153+
('launch_mode', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_store.LaunchMode')),
154+
('parameters', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_store.ParameterSet')),
155+
('platforms', models.ManyToManyField(to='django_store.PlatformInformation')),
156+
('project', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='django_store.Project')),
157+
('repository', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='django_store.Repository')),
158+
],
159+
options={
160+
'ordering': ('-timestamp',),
161+
},
162+
),
163+
migrations.AddField(
164+
model_name='datakey',
165+
name='output_from_record',
166+
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='output_data', to='django_store.Record'),
167+
),
168+
]

sumatra/recordstore/django_store/migrations/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)