def kill_task(client, app_id, task_id, scale):
    try:
        return client.kill_task(app_id=app_id, task_id=task_id, scale=True)
    except MarathonHttpError as e:
        # Marathon allows you to kill and scale in one action, but this is not
        # idempotent. If you kill&scale the same task ID twice, the number of instances
        # gets decremented twice. This can lead to a situation where kill&scaling the
        # last task decrements the number of instances below zero, causing a "Bean is not
        # valid" message.
        if e.error_message == 'Bean is not valid' and e.status_code == 422:
            log.debug("Probably tried to kill a task id that didn't exist. Continuing.")
            return []
        elif 'does not exist' in e.error_message and e.status_code == 404:
            log.debug("Probably tried to kill a task id that was already dead. Continuing.")
            return []
        else:
            raise
This checks the successful commitCheck method call
dataset/ETHPy150Open Yelp/paasta/paasta_tools/marathon_tools.py/kill_task--crossover with--dataset/ETHPy150Open facebook/fbpush/tests/test_push.py/FBPushJunoscriptRpcTestCase.test_success_commit_check