Skip to content

[Feature]: Efficient way to retrieve other subscription data in computed_fields #899

Open
@Mark90

Description

@Mark90

Contact Details

No response

What should we build?

At SURF we have a couple of product blocks definitions with a @computed_field property that retrieves another subscription to access a couple of attributes. (see pseudo code below)

This works but has a significant impact on performance for subscriptions with many product blocks.

It's not yet clear what we should build, perhaps a derivative of @computed_field which can be instrumented to retrieve specific fixed_inputs/resource_types of other subscriptions (which must be able to cross more than 1 subscription boundary)

Relevant pseudo code

class PeerBlockProvisioning(PeerBlockInactive, lifecycle=[SubscriptionLifecycle.PROVISIONING])
    port: IpPeerPortBlock

    @computed_field
    @property
    def title(self) -> str:
        sap = self.port.sap
        subscription = SubscriptionModel.from_subscription(sap.owner_subscription_id)
        return f"IP Peering on {subscription.description} vlan {sap.vlanrange}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementEnhancement or extension of existing featurefeatureRequest for new featuretriageIssue that need to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions