-
Notifications
You must be signed in to change notification settings - Fork 4
/
run_upload_photometry.py
43 lines (34 loc) · 1.32 KB
/
run_upload_photometry.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
Upload photometry results to Flows server.
.. codeauthor:: Rasmus Handberg <[email protected]>
"""
import argparse
import logging
from tendrils import api
def main():
# Parse command line arguments:
parser = argparse.ArgumentParser(description='Upload photometry.')
parser.add_argument('-d', '--debug', help='Print debug messages.', action='store_true')
parser.add_argument('-q', '--quiet', help='Only report warnings and errors.', action='store_true')
parser.add_argument('fileids', type=int, help='File IDs to be uploaded.', nargs='+')
args = parser.parse_args()
# Set logging level:
logging_level = logging.INFO
if args.quiet:
logging_level = logging.WARNING
elif args.debug:
logging_level = logging.DEBUG
# Setup logging:
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
console = logging.StreamHandler()
console.setFormatter(formatter)
logger = logging.getLogger('flows')
if not logger.hasHandlers():
logger.addHandler(console)
logger.setLevel(logging_level)
# Loop through the fileids and upload the results:
for fid in args.fileids:
api.upload_photometry(fid)
# --------------------------------------------------------------------------------------------------
if __name__ == '__main__':
main()