chip-job-download-gridfs 1.24 KB
Newer Older
1
2
3
4
5
#!/usr/bin/env python
import chipathlon.utils
import argparse

parser = argparse.ArgumentParser(description="Download target file from GridFS.")
6
7
8
parser.add_argument("-H", "--host", dest="host", default="localhost", help="Database host. (default: %(default)s)")
parser.add_argument("-u", "--username", dest="username", help="Database username (if required).")
parser.add_argument("-p", "--password", dest="password", help="Database password (if required).")
9
10
11
12
parser.add_argument("-i", "--id", dest="gridfs_id", required=True, help="GridFS ID.")
parser.add_argument("-d", "--destination", dest="destination", required=True, help="Local path to file destination.")
parser.add_argument("-r", "--retries", dest="retries", default=3, type=int, help="Number of retries.")
parser.add_argument("-n", "--overwrite", dest="overwrite", default=True, action="store_false", help="Don't overwrite local file if it exists.")
aknecht2's avatar
aknecht2 committed
13
parser.add_argument("-c", "--checkmd5", dest="checkmd5", action="store_true", help="Check md5 value of downloaded file against database value.")
14
15
16
17
18
19
20
21
22
23
24
25
args = parser.parse_args()

chipathlon.utils.downloadFromGridFS(
    args.host,
    args.username,
    args.password,
    args.gridfs_id,
    args.destination,
    args.retries,
    args.overwrite,
    args.checkmd5
)