def _set_common_params()

in infra/src/stages/train_stage_codebuild_long_polling.py [0:0]


    def _set_common_params(self, scope):
        if self._obj is not None: return
        self._obj = object()

        stage = "Train"

        stack_scope = Stack.of(scope)

        self._cfn_data_uri_file_parameter = CfnParameter(stack_scope, f"{stage}Datauri", type="String",
                                                         description="The data uri",
                                                         default="")

        self._cfn_buildspec_file_parameter = CfnParameter(stack_scope,
                                                          f"{stage}Buildspec",
                                                          type="String",
                                                          description="The name of the codebuild spec file. e.g. codebuild/buildspec.yml")

        self._cfn_build_image_parameter = CfnParameter(stack_scope, f"{stage}BuildImage", type="String",
                                                       description="The codebuild image as specified in https://docs.aws.amazon.com/codebuild/latest/userguide/codebuild-env-ref-available.html. e.g. aws/codebuild/amazonlinux2-x86_64-standard:2.0",
                                                       default="aws/codebuild/standard:4.0")

        # Lambda
        lambda_assets = os.path.join(os.path.dirname(__file__), "..", "lambda_poller")

        self._handler = aws_lambda.Function(scope, f"{stage}StatusHandler",
                                            runtime=aws_lambda.Runtime.PYTHON_3_8,
                                            code=aws_lambda.Code.asset(lambda_assets),
                                            handler="lambda_function.lambda_handler"
                                            )

        build_image = self._cfn_build_image_parameter.value_as_string
        buildspec_file = self._cfn_buildspec_file_parameter.value_as_string

        self._code_build = aws_codebuild.PipelineProject(
            scope,
            "{}CodeBuild".format(stage),
            environment=aws_codebuild.BuildEnvironment(
                build_image=aws_codebuild.LinuxBuildImage.from_code_build_image_id(build_image),
                privileged=True),
            build_spec=aws_codebuild.BuildSpec.from_source_filename(buildspec_file)
        )