"""Constants for encoding queue jobs.""" from vectororder.constants import STATUS_BY_CATEGORY from vectororder.models.schemas import JobStatus JOB_ACTION_REENCODE = "reencode" JOB_ACTION_REDELIVER = "redeliver" JOB_ACTION_CANCEL = "cancel" JOBS_ACTIONS = ( JOB_ACTION_REENCODE, JOB_ACTION_REDELIVER, JOB_ACTION_CANCEL, ) FIELD_JOB_IDS = "job_ids" FIELD_ACTION = "action" # perform duplicates check only for actions CHECK_DUPLICATES_ACTIONS = (JOB_ACTION_REENCODE, JOB_ACTION_REDELIVER) # allowed statuses for re-queue operations ALLOWED_STATUSES = { JOB_ACTION_REENCODE: [ *STATUS_BY_CATEGORY.stuck.statuses, *STATUS_BY_CATEGORY.error.statuses, ], JOB_ACTION_REDELIVER: [JobStatus.DELIVERING_STUCK, JobStatus.DELIVERY_FAILURE], JOB_ACTION_CANCEL: [ JobStatus.SYSTEM_CANCELLED, *STATUS_BY_CATEGORY.stuck.statuses, *STATUS_BY_CATEGORY.error.statuses, ], } # Delivered XML download constants XML_DOWNLOAD_PRESIGNED_LINK_EXPIRATION_TIME = 300 XML_DOWNLOAD_PRESIGNED_LINK_CONTENT_DISPOSITION = "attachment;" XML_FILE_PATH_PATTERN = "metadata/{0}-0.xml"