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

Commit

Permalink
Add assertion in option parsing to check files exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
justinrporter committed Jul 27, 2019
1 parent cee40c4 commit 9fc0f93
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client/upload_to_gromppery.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
import argparse
import os

from gromppery_client import submit_work

Expand All @@ -13,7 +14,8 @@ def process_command_line(argv):
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']:
ftypes = ['xtc', 'cpt', 'gro', 'log', 'edr', 'tpr']
for ftype in ftypes:
parser.add_argument(
"--%s" % ftype, required=True,
help="The GROMACS %s file to upload to the gromppery." % ftype)
Expand All @@ -31,6 +33,9 @@ def process_command_line(argv):

args = parser.parse_args(argv[1:])

for ftype in ftypes:
assert os.path.isfile(getattr(args, ftype))

return args


Expand Down

0 comments on commit 9fc0f93

Please sign in to comment.