"""Module for working with notification messages.""" from transcoding.connectors import ows_transcoding STATUS_FATAL_ERROR = 'fatal_error' STATUS_RETRYABLE_ERROR = 'retryable_error' STATUS_COMPLETED = 'completed' def post_error_status(transcoding_job_id, error_message, retryable=False): """Post transcoding job error status to ows-transcoding. Args: transcoding_job_id (int): Transcoding job id. error_message (str): Error message. retryable (bool): True if it's a retryable error, False otherwise. Returns: dict: Info about published status message. """ status = STATUS_RETRYABLE_ERROR if retryable else STATUS_FATAL_ERROR ows_transcoding.post_job_status( transcoding_job_id, status, error_message ) def post_completed_status( transcoding_job_id, metadata): """Post transcoding job completed status to ows-transcoding. Args: transcoding_job_id (int): Transcoding job id. metadata (dict): Metadata of the transcoded asset. """ ows_transcoding.post_job_status( transcoding_job_id, STATUS_COMPLETED, '', metadata )