def process_threads()

in workflows-generator/WorkflowsGenerator.py [0:0]


    def process_threads(self,threads, level_id):
        """method to process threads"""
        thread_bodies = []
        single_thread = len(threads) == 1
        for index, thread in enumerate(threads):
            thread_body = self.thread_template.replace("{LEVEL_ID}", level_id)
            thread_body = thread_body.replace("{THREAD_ID}", thread.get("THREAD_ID"))
            #first_step_in_thread = thread.get("STEPS")[0].get("JOB_ID") + "_" + thread.get("STEPS")[0].get("JOB_NAME")
            first_step_in_thread = thread.get("STEPS")[0].get("JOB_NAME")
            thread_body = thread_body.replace("{STARTING_JOB_ID}", first_step_in_thread)
            steps = self.process_steps(thread.get("STEPS"), level_id, thread.get("THREAD_ID"), single_thread)
            thread_body = thread_body.replace("<<THREAD_STEPS>>", "".join(steps))
            thread_bodies.append(thread_body)
        return thread_bodies