def create_tasks(MV, available_offers, driver, command, ns):
    """
    Launch up to `MV` mesos tasks, depending on availability of mesos
    resources.

    `MV` max number of mesos tasks to spin up.  Relay chooses this number
    `available_offers` a dict of mesos offers and num tasks they can support
    `driver` a mesos driver instance
    """
    n_fulfilled = 0
    for offer, ntasks in available_offers:
        if MV >= n_fulfilled:
            driver.declineOffer(offer.id)
            continue
        tasks = []
        for ID in range(ntasks):
            if n_fulfilled >= MV:
                break
            n_fulfilled += 1

            tid = "%s.%s.%s" % (
                ID, offer.id.value, random.randint(1, sys.maxint))
            log.debug(
                "Accepting offer to start a task", extra=dict(
                    offer_host=offer.hostname, task_id=tid,
                    mesos_framework_name=ns.mesos_framework_name))
            task = _create_task(
                tid, offer, command, ns)
            tasks.append(task)
        driver.launchTasks(offer.id, tasks)
    return n_fulfilled
dataset/ETHPy150Open sailthru/relay.mesos/relay_mesos/scheduler.py/create_tasks/swapped operands of `>=`