9087a7f9301e17510bc903b9beb532bc7ae641fd,lambdas/access_counts/index.py,,handler,#Any#Any#,360
Before Change
for account_response in s3.list_objects_v2(
Bucket=CLOUDTRAIL_BUCKET, Prefix="AWSLogs/", Delimiter="/").get("CommonPrefixes") or []:
account = account_response["Prefix"].split("/")[1]
for region_response in s3.list_objects_v2(
Bucket=CLOUDTRAIL_BUCKET,
Prefix=f"AWSLogs/{account}/CloudTrail/", Delimiter="/").get("CommonPrefixes") or []:
region = region_response["Prefix"].split("/")[3]
date = start_ts.date()
while date <= end_ts.date():
query = ADD_CLOUDTRAIL_PARTITION.format(
account=sql_escape(account),
region=sql_escape(region),
year=date.year,
month=date.month,
day=date.day
)
partition_queries.append(query)
date += timedelta(days=1)
// Drop old Athena tables from previous runs.
// (They"re in the DB owned by the stack, so safe to do.)
run_multiple_queries([DROP_CLOUDTRAIL, DROP_OBJECT_ACCESS_LOG, DROP_PACKAGE_HASHES])
// Create new Athena tables.
run_multiple_queries([CREATE_CLOUDTRAIL, CREATE_OBJECT_ACCESS_LOG, CREATE_PACKAGE_HASHES])
After Change
// (They"re in the DB owned by the stack, so safe to do.)
run_multiple_queries([DROP_CLOUDTRAIL, DROP_OBJECT_ACCESS_LOG, DROP_PACKAGE_HASHES])
create_cloudtrail_query = CREATE_CLOUDTRAIL.format(
bucket=sql_escape(CLOUDTRAIL_BUCKET),
accounts=",".join(accounts),
regions=",".join(regions),
start_date=start_ts.date().strftime("%Y/%m/%d"),
end_date=end_ts.date().strftime("%Y/%m/%d"),
)
// Create new Athena tables.
run_multiple_queries([create_cloudtrail_query, CREATE_OBJECT_ACCESS_LOG, CREATE_PACKAGE_HASHES])
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 4
Instances
Project Name: quiltdata/quilt
Commit Name: 9087a7f9301e17510bc903b9beb532bc7ae641fd
Time: 2020-07-16
Author: dima@quiltdata.io
File Name: lambdas/access_counts/index.py
Class Name:
Method Name: handler
Project Name: zhanghang1989/PyTorch-Encoding
Commit Name: 09bff70b46b4f0149e0f470874825b650935565a
Time: 2020-04-04
Author: zhang.hang@rutgers.edu
File Name: setup.py
Class Name:
Method Name:
Project Name: catalyst-cooperative/pudl
Commit Name: 4296d854f38a7544eb02cd72d9cdb11e215051ce
Time: 2018-07-05
Author: karldw@users.noreply.github.com
File Name: pudl/init.py
Class Name:
Method Name: _ETL_cems
Project Name: pythonstock/stock
Commit Name: 93fc87ef4a966d6667a5f9dc6826555e994988c8
Time: 2017-12-07
Author: yhy
File Name: web/dataIndicatorsHandler.py
Class Name: GetDataIndicatorsHandler
Method Name: get