def parse_release_label(cluster_release_label): try: return re.findall(r'emr-(\d+\.\d+\.\d+)', cluster_release_label)[0] except IndexError: aws_docs = 'https://docs.aws.amazon.com/emr/latest/ReleaseGuide/emr-release-components.html' message = "{} is not a valid emr release label. See {} for more info".format( cluster_release_label, aws_docs, ) raise EmrError( error_type="ValidationException", message=message, template="error_json", )
def get_cluster(self, cluster_id): if cluster_id in self.clusters: return self.clusters[cluster_id] raise EmrError("ResourceNotFoundException", "", "error_json")