def on_update(event, context): try: if "MlArtifactsResource" == event["LogicalResourceId"]: artifacts = Artifacts(event, context, s3_bucket, s3_destination_bucket, sb_bucket, sb_prefix_artifacts, s3_prefix_artifacts, s3_prefix_rawdata, output_path) artifacts.__call__() elif "MlGlueResource" == event["LogicalResourceId"]: glue_job = GlueJobs(event, context, job_name, database, s3_prefix_rawdata, s3_bucket, s3_prefix_artifacts, output_path) glue_job.__call__() elif "MlSagemakerResource" == event["LogicalResourceId"]: sagemaker = Sagemaker(event, context, config_name, s3_bucket, s3_prefix_artifacts) sagemaker.__call__() physical_resource_id = { 'PhysicalResourceId': event["LogicalResourceId"] } except Exception as e: print('An error occurred: {}.'.format(e)) raise e return physical_resource_id
def on_delete(event, context): try: if "MlGlueResource" == event["LogicalResourceId"]: glue_job = GlueJobs(event, context, job_name) glue_job.__delete__() elif "MlSagemakerResource" == event["LogicalResourceId"]: sagemaker = Sagemaker(event, context, config_name) sagemaker.__delete__() physical_resource_id = {'PhysicalResourceId': event["LogicalResourceId"]} except Exception as e: print('An error occurred: {}.'.format(e)) raise e return physical_resource_id