def wait_for_service_tasks_state(
        service_name,
        expected_task_count,
        expected_task_states,
        timeout_sec=120
):
    """ Returns once the service has at least N tasks in one of the specified state(s)

        :param service_name: the service name
        :type service_name: str
        :param expected_task_count: the expected number of tasks in the specified state(s)
        :type expected_task_count: int
        :param expected_task_states: the expected state(s) for tasks to be in, e.g. 'TASK_RUNNING'
        :type expected_task_states: [str]
        :param timeout_sec: duration to wait
        :type timeout_sec: int

        :return: the duration waited in seconds
        :rtype: int
    """
    return time_wait(
        lambda: task_states_predicate(service_name, expected_task_count, expected_task_states),
        timeout_seconds=timeout_sec)
def wait_for_service_tasks_state ( service_name , expected_task_count , expected_task_states , timeout_sec = 120 ) : return time_wait ( lambda : task_states_predicate ( service_name , expected_task_count , expected_task_states ) , timeout_seconds = timeout_sec )
Returns once the service has at least N tasks in one of the specified state(s)

        :param service_name: the service name
        :type service_name: str
        :param expected_task_count: the expected number of tasks in the specified state(s)
        :type expected_task_count: int
        :param expected_task_states: the expected state(s) for tasks to be in, e.g. 'TASK_RUNNING'
        :type expected_task_states: [str]
        :param timeout_sec: duration to wait
        :type timeout_sec: int

        :return: the duration waited in seconds
        :rtype: int