aws / aws-rfdk

The Render Farm Deployment Kit on AWS is a library for use with the AWS Cloud Development Kit that helps you define your render farm cloud infrastructure as code.
https://docs.aws.amazon.com/rfdk/index.html
Apache License 2.0
107 stars 42 forks source link

Can't create a deadline render farm construct using RFDK constructs provided in Python SEP example #1028

Open mainframenzo opened 1 year ago

mainframenzo commented 1 year ago

I have an existing non-deadline render farm stack. I am trying to integrate deadline using the RFDK.

I tried to move the example SEP stack code (Python) into a CDK construct and then pull that construct in to my existing render farm stack, but I'm running into issues like this: 'deadline/recipes/RemoteConnectionServer' should be created in the scope of a Stack, but no Stack found for various constructs.

It's highly probable I'm doing something wrong as it seems very unCDK-like to force stack-level constructs? Do ya'll have any guidance on for doing this? For example, here is what I'm doing:

class ExistingRenderFarmStack(cdk.Stack):
    def __init__(self, scope: Construct, id: str, *, props: Props, **kwargs) -> None:
        super().__init__(scope, id, **kwargs)

                ExistingFargateRenderFleet(scope, 'fargate-render-fleet')
                ExistingLambdaHeadlessRenderFleet(scope, 'lambda-render-fleet')

        cinema4d_render_fleet = RenderFleet(
            deadline_group='cinema4d',
            ami_type='windows',
            amis_by_region={
                'us-east-1': 'ami-07bc6c154e92f72bf'
            },
            instance_type=InstanceType.of(InstanceClass.C5, InstanceSize.XLARGE4),
            max_capacity=1,
            user_data_file='powershell.sh'
        )

        # The UBL licenses to use. See: https://www.awsthinkbox.com/ubl-info
        ubl_licenses = [
            UsageBasedLicense.for_cinema4_d()
        ]

        # Note: SingletonFunction at 'deadline/version/VersionProviderFunction' should be created in the scope of a Stack, but no Stack found
        #version = VersionQuery(self, 'version', version=props.deadline_version)

        props = DeadlineRenderFarmProps(
            #deadline_version=version,
            docker_recipes_stage_path=props.docker_recipes_stage_path,
            render_fleets=[cinema4d_render_fleet],
            ubl_certificate_secret_arn='TODO',
            ubl_licenses=ubl_licenses
        )

        DeadlineRenderFarm(scope, 'deadline', props)` # Your SEP example code more or less, but as a construct, not a stack
jusiskin commented 1 year ago

I believe the issue is with the line:

DeadlineRenderFarm(scope, 'deadline', props)

The scope of the stack is actually a cdk.App instance, so you're attempting to attach a construct to an App. Instead it should be:

DeadlineRenderFarm(self, 'deadline', props)

Let me know if that works.

jusiskin commented 10 months ago

@mainframenzo - just circling back here. Did the suggestion fix your problem?