aws-rfdk icon indicating copy to clipboard operation
aws-rfdk copied to clipboard

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

Open mainframenzo opened this issue 1 year ago • 2 comments

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

mainframenzo avatar Mar 29 '23 18:03 mainframenzo

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 avatar Mar 30 '23 18:03 jusiskin

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

jusiskin avatar Oct 24 '23 22:10 jusiskin