def parse_parallel()

in esrally/track/loader.py [0:0]


    def parse_parallel(self, ops_spec, ops, challenge_name):
        # use same default values as #parseTask() in case the 'parallel' element did not specify anything
        default_warmup_iterations = self._r(ops_spec, "warmup-iterations", error_ctx="parallel", mandatory=False)
        default_iterations = self._r(ops_spec, "iterations", error_ctx="parallel", mandatory=False)
        default_warmup_time_period = self._r(ops_spec, "warmup-time-period", error_ctx="parallel", mandatory=False)
        default_time_period = self._r(ops_spec, "time-period", error_ctx="parallel", mandatory=False)
        default_ramp_up_time_period = self._r(ops_spec, "ramp-up-time-period", error_ctx="parallel", mandatory=False)
        clients = self._r(ops_spec, "clients", error_ctx="parallel", mandatory=False)
        completed_by = self._r(ops_spec, "completed-by", error_ctx="parallel", mandatory=False)
        # now descent to each operation
        tasks = []
        for task in self._r(ops_spec, "tasks", error_ctx="parallel"):
            tasks.append(
                self.parse_task(
                    task,
                    ops,
                    challenge_name,
                    default_warmup_iterations,
                    default_iterations,
                    default_warmup_time_period,
                    default_time_period,
                    default_ramp_up_time_period,
                    completed_by,
                )
            )
        for task in tasks:
            if task.ramp_up_time_period != default_ramp_up_time_period:
                if default_ramp_up_time_period is None:
                    self._error(
                        f"task '{task.name}' in 'parallel' element of challenge '{challenge_name}' specifies "
                        f"a ramp-up-time-period but it is only allowed on the 'parallel' element."
                    )
                else:
                    self._error(
                        f"task '{task.name}' specifies a different ramp-up-time-period than its enclosing "
                        f"'parallel' element in challenge '{challenge_name}'."
                    )

        if completed_by:
            has_completion_task = False
            for task in tasks:
                if task.completes_parent and not has_completion_task:
                    has_completion_task = True
                elif task.completes_parent:
                    self._error(
                        f"'parallel' element for challenge '{challenge_name}' contains multiple tasks with the "
                        f"name '{completed_by}' marked with 'completed-by' but only task is allowed to match."
                    )
                elif task.any_completes_parent:
                    has_completion_task = True
            if not has_completion_task:
                self._error(
                    f"'parallel' element for challenge '{challenge_name}' is marked with 'completed-by' with "
                    f"task name '{completed_by}' but no task with this name exists."
                )
        return track.Parallel(tasks, clients)