This repository has been archived by the owner on Mar 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor settings structure, build upload_to_gromppery.py
- Loading branch information
1 parent
0a9b9f9
commit 7b01948
Showing
8 changed files
with
150 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# The Gromppery | ||
Its thirst for simulations cannot be slaked. | ||
|
||
## Configuration | ||
|
||
In gromppery/gromppery/local.py, you can set important local configuration options. An example is provided. | ||
|
||
## Basic Use | ||
|
||
The provided client/gromppery_client.py is a script that can request work from the gromppery, run it, and return it. | ||
|
||
It is invoked like: | ||
|
||
```bash | ||
$ python ~/projects/gromppery/client/gromppery_client.py \ | ||
--gromppery http://localhost:43443/api \ | ||
--scratch ~/sim/ \ | ||
--protein lambda-repressor \ | ||
--iterations 2 | ||
``` | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import sys | ||
import argparse | ||
|
||
from .gromppery_client import submit_work | ||
|
||
|
||
def process_command_line(argv): | ||
'''Parse the command line and do a first-pass on processing them into a | ||
format appropriate for the rest of the script.''' | ||
|
||
parser = argparse.ArgumentParser( | ||
formatter_class=argparse.ArgumentDefaultsHelpFormatter, | ||
description='Upload a bundle of files to the gromppery as a ' | ||
'Submission (usually a finished simulation).') | ||
|
||
for ftype in ['xtc', 'cpt', 'gro', 'log', 'edr', 'tpr']: | ||
parser.add_argument( | ||
"--%s" % ftype, required=True, | ||
help="The GROMACS %s file to upload to the gromppery." % ftype) | ||
|
||
parser.add_argument( | ||
"--gromppery", required=True, | ||
help="The URL and port where the gromppery can be found.") | ||
parser.add_argument( | ||
"--protein", required=True, | ||
help="Always choose this protein from the gromppery.") | ||
parser.add_argument( | ||
"--hostname", default=None, | ||
help="Override the current hostname when indicating the host " | ||
"that ran the simulation.") | ||
|
||
args = parser.parse_args(argv[1:]) | ||
|
||
return args | ||
|
||
|
||
def main(argv=None): | ||
'''Run the driver script for this module. This code only runs if we're | ||
being run as a script. Otherwise, it's silent and just exposes methods.''' | ||
args = process_command_line(argv) | ||
|
||
submit_work( | ||
gromppery=args.gromppery, | ||
tag=args.protein, | ||
files={[getattr(args, ftype) for ftype in | ||
['xtc', 'cpt', 'gro', 'log', 'edr', 'tpr']]} | ||
) | ||
|
||
|
||
return 0 | ||
|
||
if __name__ == "__main__": | ||
sys.exit(main(sys.argv)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from __future__ import absolute_import, unicode_literals | ||
import os | ||
|
||
from .base import * | ||
|
||
ALLOWED_HOSTS = [] | ||
|
||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | ||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
SECRETS_DIR = os.path.join(BASE_DIR, 'secrets') | ||
|
||
# Quick-start development settings - unsuitable for production | ||
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/ | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
with open(os.path.join(SECRETS_DIR, 'django_key.txt'), 'r') as f: | ||
SECRET_KEY = f.read().rstrip() | ||
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
DEBUG = True | ||
|
||
|
||
# Static files (CSS, JavaScript, Images) | ||
# https://docs.djangoproject.com/en/1.10/howto/static-files/ | ||
|
||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') | ||
STATIC_ROOT = os.path.join(BASE_DIR, 'static') | ||
|
||
STATIC_URL = '/static/' | ||
MEDIA_URL = '/media/' | ||
|
||
# Database | ||
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), | ||
} | ||
} | ||
|
||
|
||
try: | ||
from .local import * | ||
except ImportError: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GROMACS_TIMEOUT = 10 | ||
FILE_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024 * 64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters