/
logdownloader.py
25 lines (22 loc) · 1 KB
/
logdownloader.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
import boto3, argparse, os, sys, logging
from application import Application
from loghelper import LogHelper
def main():
LogHelper.start_logging("logdownloader.log")
parser = argparse.ArgumentParser(
description="AWS bootstrapper log downloader" +
"Downloads instances logs from AWS S3")
parser.add_argument("--manifestPath", help = "path to a manifest file describing the jobs and data requirements for the application", required=True)
parser.add_argument("--outputPath", help = "directory to where instance logs will be copied", required=True)
try:
args = vars(parser.parse_args())
manifestPath = os.path.abspath(args["manifestPath"])
outputdir = os.path.abspath(args["outputPath"])
s3 = boto3.resource('s3')
app = Application(s3, manifestPath, outputdir)
app.downloadLogs(outputdir)
except Exception as ex:
logging.exception("error in log downloader")
sys.exit(1)
if __name__ == "__main__":
main()