prepare_parser=subparsers.add_parser('prepare',help='Databank download from the Website, extraction and transformation for another Programm')
prepare_parser.add_argument('database',help='Database which have to be prepared',type=str)
prepare_parser.add_argument('tool',help='Programm/Tool for the post analysis',type=str,)
prepare_parser.add_argument('-d','--directory',dest='dir',help='target directory for the output.Default will be a created("output") folder in the working directory',type=str)
prepare_parser.set_defaults(func=prepare)
upload_parser=subparsers.add_parser('upload',help='Databank copy from the local directory to the web storage')
upload_parser.add_argument('database',help='database to be transfered from the local directory',type=str)
upload_parser.add_argument('tool',type=str,help='database type which have to be transfered')
upload_parser.add_argument('-d','--directory',dest='dir',help='Target directory for the file transfer into "S3". Default will be "s3://db_storage"',type=str)
upload_parser.set_defaults(func=upload)
download_parser=subparsers.add_parser('download',help='Datenbank copy from the web storage to the working computer')
download_parser.add_argument('file',help='File to be transfered from "S3"',type=str)
download_parser.add_argument('-d','--directory',dest='dir',help='Target directory for the file transfer. Default will be a created folder("output) in the current working directory',type=str)
download_parser.set_defaults(func=download)
delete_parser=subparsers.add_parser('delete',help='delete existing files from local directory or from "S3"')
delete_parser.add_argument('database',help='database which have to be delete')
delete_parser.add_argument('place',choices=['local','S3'],help='defined the place where the database have to be delete')
delete_parser.add_argument('-d','--directory',dest='dir',help='directory where the database have to be delete')
delete_parser.set_defaults(func=delete)
returnparser.parse_args()
deftargetdir_maker(args):
databasedir="./output"
ifargs.dir:
databasedir=args.dir
elif"DBMAN_DBDIR"inos.environ:
databasedir=os.environ["DBMAN_DBDIR"]
returndatabasedir
defs3dir_maker(args):
web_dir='s3://db_storage'
ifargs.dir:
web_dir=args.dir
elif'S3_DBDIR'inos.environ:
web_dir=os.environ['S3_DBDIR']
returnweb_dir
# paste the target directory with the filename.(will be important to test if the file is already there. "/" or not)