def _kill(app_id, scale, host):
    """
    :param app_id: the id of the application
    :type app_id: str
    :param: scale: Scale the app down
    :type: scale: bool
    :param: host: Kill only those tasks running on host specified
    :type: string
    :returns: process return code
    :rtype: int
    """
    client = marathon.create_client()

    payload = client.kill_tasks(app_id, host=host, scale=scale)
    # If scale is provided, the API return a "deploymentResult"
    # https://github.com/mesosphere/marathon/blob/50366c8/src/main/scala/mesosphere/marathon/api/RestResource.scala#L34-L36
    if scale:
        emitter.publish("Started deployment: {}".format(payload))
    else:
        if 'tasks' in payload:
            emitter.publish('Killed tasks: {}'.format(payload['tasks']))
            if len(payload['tasks']) == 0:
                return 1
        else:
            emitter.publish('Killed tasks: []')
            return 1
    return 0
dataset/ETHPy150Open dcos/dcos-cli/cli/dcoscli/marathon/main.py/_kill/original