<s> from celery import shared_task <EOL> from nodeconductor . cost_tracking . models import PriceEstimate <EOL> from nodeconductor . structure . models import Resource <EOL> @ shared_task ( name = '<STR_LIT>' ) <EOL> def update_projected_estimate ( customer_uuid = None , resource_str = None ) : <EOL> if customer_uuid and resource_str : <EOL> raise RuntimeError ( "<STR_LIT>" ) <EOL> if resource_str : <EOL> resource = next ( Resource . from_string ( resource_str ) ) <EOL> PriceEstimate . update_price_for_resource ( resource ) <EOL> else : <EOL> for model in Resource . get_all_models ( ) : <EOL> queryset = model . objects . exclude ( state = model . States . ERRED ) <EOL> if customer_uuid : <EOL> queryset = queryset . filter ( customer__uuid = customer_uuid ) <EOL> for resource in queryset . iterator ( ) : <EOL> PriceEstimate . update_price_for_resource ( resource ) </s>
