def sanitise_job_name()

in cdsresponder/cds/cds_launcher.py [0:0]


    def sanitise_job_name(job_name:str) -> str:
        """
        converts the incoming string into a form that is suitable for a Kubernetes job name
        :param job_name: string to convert
        :return:
        """
        first_sub = re.sub(r"\s+","-", job_name)
        second_sub = re.sub(r'[^A-Za-z0-9-]', "", first_sub).lower()
        if len(second_sub) <= 59:   #kubernetes name length is 63 chars, we prepend "cds-" so take that off
            truncated = second_sub
        else:
            truncated = second_sub[0:59]
        third_sub = re.sub(r'[^a-z0-9]+$', "", truncated)
        fourth_sub = re.sub(r'^[^a-z0-9]+', "", third_sub)
        return fourth_sub