From d5542a922eec5b7694c3ea8eea0325078337d1cd Mon Sep 17 00:00:00 2001 From: Iakov Gan Date: Wed, 13 Nov 2024 09:05:27 +0100 Subject: [PATCH 1/4] fix crawler wait --- cfn-templates/cid-cfn.yml | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/cfn-templates/cid-cfn.yml b/cfn-templates/cid-cfn.yml index 504e0b54..c7340057 100644 --- a/cfn-templates/cid-cfn.yml +++ b/cfn-templates/cid-cfn.yml @@ -655,17 +655,21 @@ Resources: else: return (True, f'ERROR: error invoking crawler {CRAWLER} {exc}') print('started crawler started. waiting for crawler to finish') - start_time = time.time() - while time.time() - start_time < timeout_seconds: - time.sleep(10) - crawler_status = glue.get_crawler(Name=CRAWLER)['Crawler']['State'] - print('status=', crawler_status) - if crawler_status in ('READY', 'STOPPING'): - print("Stop waiting") - break - else: - return (True, f"Timeout exceeded. Crawler '{CRAWLER}' did not complete. This is not a fatal error and the rest of the deployment will continue.") + try: + start_time = time.time() + while time.time() - start_time < timeout_seconds: + time.sleep(10) + crawler_status = glue.get_crawler(Name=CRAWLER)['Crawler']['State'] + print('status=', crawler_status) + if crawler_status in ('READY', 'STOPPING'): + print("Stop waiting") + break + else: + return (True, f"Timeout exceeded. Crawler '{CRAWLER}' did not complete. This is not a fatal error and the rest of the deployment will continue.") + except Exception as exc: + return (True, f'ERROR: error waiting for crawler {CRAWLER} {exc}') return (True, 'Crawler run completed.') + return (True, 'Ended create.') def on_delete(): # Delete bucket (CF cannot delete if they are non-empty) @@ -869,7 +873,7 @@ Resources: Path: !Ref RolePath PermissionsBoundary: !If [NeedPermissionsBoundary, !Ref PermissionsBoundary, !Ref 'AWS::NoValue'] Policies: - - PolicyName: AWSCURCrawlerComponentFunction + - PolicyName: CloudWatch PolicyDocument: Version: 2012-10-17 Statement: From 903826e48593827e196fa34bb1fbdce75f321a4e Mon Sep 17 00:00:00 2001 From: Iakov Gan Date: Wed, 13 Nov 2024 09:10:52 +0100 Subject: [PATCH 2/4] release 4.0.4 --- cfn-templates/cid-cfn.yml | 4 ++-- cid/_version.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cfn-templates/cid-cfn.yml b/cfn-templates/cid-cfn.yml index 504e0b54..c724d22c 100644 --- a/cfn-templates/cid-cfn.yml +++ b/cfn-templates/cid-cfn.yml @@ -1,5 +1,5 @@ AWSTemplateFormatVersion: '2010-09-09' -Description: Deployment of Cloud Intelligence Dashboards v4.0.3 +Description: Deployment of Cloud Intelligence Dashboards v4.0.4 Metadata: AWS::CloudFormation::Interface: ParameterGroups: @@ -1777,7 +1777,7 @@ Resources: - LambdaLayerBucketPrefixIsManaged - !FindInMap [RegionMap, !Ref 'AWS::Region', BucketName] - !Sub '${LambdaLayerBucketPrefix}-${AWS::Region}' # Region added for backward compatibility - S3Key: 'cid-resource-lambda-layer/cid-4.0.3.zip' #replace version here if needed + S3Key: 'cid-resource-lambda-layer/cid-4.0.4.zip' #replace version here if needed CompatibleRuntimes: - python3.10 - python3.11 diff --git a/cid/_version.py b/cid/_version.py index 76c6b7b8..680617c7 100644 --- a/cid/_version.py +++ b/cid/_version.py @@ -1,2 +1,2 @@ -__version__ = '4.0.3' +__version__ = '4.0.4' From 31c39a38f176286d64377fac7936e9c40872d357 Mon Sep 17 00:00:00 2001 From: Iakov GAN <82834333+iakov-aws@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:42:25 +0100 Subject: [PATCH 3/4] Update cfn-templates/cid-cfn.yml --- cfn-templates/cid-cfn.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfn-templates/cid-cfn.yml b/cfn-templates/cid-cfn.yml index 277877cf..bc576352 100644 --- a/cfn-templates/cid-cfn.yml +++ b/cfn-templates/cid-cfn.yml @@ -660,7 +660,7 @@ Resources: while time.time() - start_time < timeout_seconds: time.sleep(10) crawler_status = glue.get_crawler(Name=CRAWLER)['Crawler']['State'] - print('status=', crawler_status) + print(f'status = {crawler_status}') if crawler_status in ('READY', 'STOPPING'): print("Stop waiting") break From 3b1524daa84d9752f6bcb0277968c1c70fb35a7f Mon Sep 17 00:00:00 2001 From: Iakov GAN <82834333+iakov-aws@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:44:02 +0100 Subject: [PATCH 4/4] Update cfn-templates/cid-cfn.yml --- cfn-templates/cid-cfn.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfn-templates/cid-cfn.yml b/cfn-templates/cid-cfn.yml index bc576352..c1ee2220 100644 --- a/cfn-templates/cid-cfn.yml +++ b/cfn-templates/cid-cfn.yml @@ -658,7 +658,7 @@ Resources: try: start_time = time.time() while time.time() - start_time < timeout_seconds: - time.sleep(10) + time.sleep(1) crawler_status = glue.get_crawler(Name=CRAWLER)['Crawler']['State'] print(f'status = {crawler_status}') if crawler_status in ('READY', 'STOPPING'):