in rabbitmq/CDSResponderProcessor.py [0:0]
def set_asset_data(routename, asset, job_id=None, upload_status=None):
"""
Set data for asset on the correct route model if job_id and upload_status as present
:param routename: The routename to use to load the correct model
:param asset: The number of the asset
:param job_id: Optional job id. to set
:param upload_status: Optional upload status to set
:return:
"""
try:
route_mapping = get_route_mapping(routename)
if route_mapping == 'mainstream':
mainstream = get_mainstream_record(asset)
if job_id is not None:
mainstream.job_id = job_id
if upload_status is not None:
mainstream.upload_status = upload_status
mainstream.save()
elif route_mapping == 'dailymotion':
dailymotion = get_dailymotion_record(asset)
if job_id is not None:
dailymotion.job_id = job_id
if upload_status is not None:
dailymotion.upload_status = upload_status
dailymotion.save()
except DeliverableAsset.DoesNotExist:
raise PermanentFailure