Skip to content
This repository has been archived by the owner on Mar 22, 2021. It is now read-only.

Commit

Permalink
Small text fixes, update to requirements version. (#4)
Browse files Browse the repository at this point in the history
* Update to requirements version.
* Adding makefile for test data, remove large test data files.
* A few small changes to tests
* Add media gitignore
* Update readme to include instructions for building test data.
  • Loading branch information
justinrporter authored Nov 27, 2018
1 parent 7449818 commit debbe0c
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 21,148 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,18 @@ $ python ~/projects/gromppery/client/gromppery_client.py \
```

This command will connect to a gromppery running at `localhost:43443`, download a work unit from the project called `lambda-repressor`, run it in a directory like `~/sim/YEAR-MONTH-DAY-HASH`, and return it. Because the `--iterations` flag is 2, it will then repeat this process again. If `--iterations` is not specified, it will run until terminated.

## Running the Tests

First, you need to build some of the test data.

```bash
cd testdata/
make
```

Then, you'll be able to run the tests normally

```bash
./manage.py test
```
43 changes: 24 additions & 19 deletions client/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,32 @@ def setUp(self):
os.path.join(settings.BASE_DIR, 'testdata'),
os.path.join(settings.MEDIA_ROOT, 'testdata'))

short_mdp = os.path.join(settings.MEDIA_ROOT, 'testdata', 'short.mdp')
with open(short_mdp, 'w') as mdp:
with open('testdata/plcg_sh2_wt.mdp', 'r') as f:
for line in f.readlines():
if 'nsteps' in line.split():
mdp.write('nsteps = 500 ; .01 ns')
elif 'nstxtcout' in line.split():
mdp.write('nstxtcout = 25 ; 10 ps')
elif 'nstenergy' in line.split():
mdp.write('nstenergy = 25 ; 10 ps')
else:
mdp.write(line)

self.project = Project.objects.create(
name='plcg_sh2_wt',
gro='testdata/plcg_sh2_wt.gro',
mdp=short_mdp,
top='testdata/plcg_sh2_wt.top'
try:
short_mdp = os.path.join(settings.MEDIA_ROOT, 'testdata',
'short.mdp')
with open(short_mdp, 'w') as mdp:
with open('testdata/plcg_sh2_wt.mdp', 'r') as f:
for line in f.readlines():
if 'nsteps' in line.split():
mdp.write('nsteps = 500 ; .01 ns')
elif 'nstxtcout' in line.split():
mdp.write('nstxtcout = 25 ; 10 ps')
elif 'nstenergy' in line.split():
mdp.write('nstenergy = 25 ; 10 ps')
else:
mdp.write(line)

self.project = Project.objects.create(
name='plcg_sh2_wt',
gro='testdata/plcg_sh2_wt.gro',
mdp=short_mdp,
top='testdata/plcg_sh2_wt.top'
)

self.scratchpath = tempfile.mkdtemp()
self.scratchpath = tempfile.mkdtemp()
except:
self.tearDown()
raise

def tearDown(self):
shutil.rmtree(settings.MEDIA_ROOT)
Expand Down
3 changes: 0 additions & 3 deletions gromppery.sublime-project
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
"folder_exclude_patterns": ["__pycache__"],
"path": "."
},
{
"path": "../gromppery-pyramid"
},
{
"folder_exclude_patterns": ["__pycache__"],
"path": "../armoir/"
Expand Down
4 changes: 4 additions & 0 deletions media/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django==1.10.6
djangorestframework==3.6.2
Markdown==2.6.8
requests==2.13.0
requests==2.20.0
2 changes: 2 additions & 0 deletions testdata/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mdout.mdp
plcg_sh2_wt.tpr
8 changes: 8 additions & 0 deletions testdata/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.PHONY : submission
submission : submission/plcg_sh2_wt.log

submission/plcg_sh2_wt.log : plcg_sh2_wt.tpr
bash -c "cd submission; gmx mdrun -s ../plcg_sh2_wt.tpr -deffnm plcg_sh2_wt"

plcg_sh2_wt.tpr : plcg_sh2_wt.gro plcg_sh2_wt.mdp plcg_sh2_wt.top
gmx grompp -f plcg_sh2_wt.mdp -c plcg_sh2_wt.gro -p plcg_sh2_wt.top -o plcg_sh2_wt.tpr -maxwarn 1; rm mdout.mdp
Binary file removed testdata/plcg_sh2_wt.tpr
Binary file not shown.
4 changes: 4 additions & 0 deletions testdata/submission/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
plcg_sh2_wt*
# Except this file
!.gitignore
Binary file removed testdata/submission/plcg_sh2_wt.cpt
Binary file not shown.
Binary file removed testdata/submission/plcg_sh2_wt.edr
Binary file not shown.
21,108 changes: 0 additions & 21,108 deletions testdata/submission/plcg_sh2_wt.gro

This file was deleted.

Binary file removed testdata/submission/plcg_sh2_wt.xtc
Binary file not shown.
4 changes: 2 additions & 2 deletions tprs/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test_create_project(self):
'testdata/plcg_sh2_wt.top'), 'rb'),
'gro': open(os.path.join(settings.MEDIA_ROOT,
'testdata/plcg_sh2_wt.gro'), 'rb'),
}
}

response = self.client.post(url, data, format='multipart')

Expand All @@ -108,7 +108,7 @@ def test_create_project(self):
self.assertEqual(Project.objects.first().name, 'plcg_sh2_wt')

response = self.client.get(reverse('project-list'))
self.assertEqual(len(response.data), 1)
self.assertEqual(len(response.data['results']), 1)

tprdata = Project.objects.first().grompp()
self.assertGreater(len(tprdata.read()), 100)
34 changes: 19 additions & 15 deletions tprs/test_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,27 @@ def setUp(self):
os.path.join(settings.BASE_DIR, 'testdata'),
os.path.join(settings.MEDIA_ROOT, 'testdata'))

self.project = Project.objects.create(
name='plcg_sh2_wt',
gro='testdata/plcg_sh2_wt.gro',
mdp='testdata/plcg_sh2_wt.mdp',
top='testdata/plcg_sh2_wt.top'
try:
self.project = Project.objects.create(
name='plcg_sh2_wt',
gro='testdata/plcg_sh2_wt.gro',
mdp='testdata/plcg_sh2_wt.mdp',
top='testdata/plcg_sh2_wt.top'
)

self.good_data = {
'hostname': 'debug01',
'xtc': open(self.filepath('plcg_sh2_wt.xtc'), 'rb'),
'log': open(self.filepath('plcg_sh2_wt.log'), 'rb'),
'edr': open(self.filepath('plcg_sh2_wt.edr'), 'rb'),
'gro': open(self.filepath('plcg_sh2_wt.gro'), 'rb'),
'cpt': open(self.filepath('plcg_sh2_wt.cpt'), 'rb'),
'tpr': open(os.path.join(settings.MEDIA_ROOT,
'testdata/plcg_sh2_wt.tpr'), 'rb'),
}
self.good_data = {
'hostname': 'debug01',
'xtc': open(self.filepath('plcg_sh2_wt.xtc'), 'rb'),
'log': open(self.filepath('plcg_sh2_wt.log'), 'rb'),
'edr': open(self.filepath('plcg_sh2_wt.edr'), 'rb'),
'gro': open(self.filepath('plcg_sh2_wt.gro'), 'rb'),
'cpt': open(self.filepath('plcg_sh2_wt.cpt'), 'rb'),
'tpr': open(os.path.join(settings.MEDIA_ROOT,
'testdata/plcg_sh2_wt.tpr'), 'rb'),
}
except:
self.tearDown()
raise

def tearDown(self):
shutil.rmtree(settings.MEDIA_ROOT)
Expand Down

0 comments on commit debbe0c

Please sign in to comment.