import json import boto3 client = boto3.client('ecs') concurrency = 20 chunk_size = 16 uow = { "uow_id": "spotify-20190820-sme-streams-v2-{0}c-{1}mb".format(concurrency, chunk_size), "dsp": "spotify", "extension": "json", "config_key": "ecs-run-config.json", "licensor": "sme", "config_bucket": "dev-delphi-configs", "report_type": "streams", "contexts": [ "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MV", "MW", "MX", "MY", "MZ", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "SK", "TW", "US", "UY", "UZ", "VA", "VE", "YE", "YT", "ZA", "ZM", "ZW", "ZZ" ], "version": "v2", "report_date": "2019-08-20", "job_id": "vadimsjob", } jsonified_uow = json.dumps(uow) command = [ '--environment=dev', '--debug', f'-c={concurrency}', '-b={}'.format(str(chunk_size * 1024 * 1024)), "--content-status-table-name=dev-delphi-slz_content_status", "--bucket-archive=dev-sme-data-archive", "--bucket-decompressed=dev-sme-data-decompressed", "--bucket-corrupted=dev-delphi-sme-data-corrupted", '--input={}'.format(jsonified_uow).replace(" ", "", -1), ] print(" \\ ".join(command)) response = client.run_task( cluster="arn:aws:ecs:us-east-1:475275892927:cluster/dev-delphi-clu", taskDefinition="arn:aws:ecs:us-east-1:475275892927:task-definition/dev-delphi-slz-downloader:9", overrides={ 'containerOverrides': [{ "command": command, "name": "slz-downloader", "memoryReservation": 7500, }, ] }, networkConfiguration={ 'awsvpcConfiguration': { 'subnets': [ "subnet-039d0dc7ea7f5e541", "subnet-0c4ef8a4bcfc0f530", "subnet-0f75f14582a00610f" ], } }, launchType='FARGATE', ) print(response)