def _compose_restart(services):
def _restart_container(client, container):<EOL><INDENT>log_to_client('<STR_LIT>'.format(get_canonical_container_name(container)))<EOL>client.restart(container['<STR_LIT>'], timeout=<NUM_LIT:1>)<EOL><DEDENT>assembled_specs = get_assembled_specs()<EOL>if services == []:<EOL><INDENT>services = [spec.name for spec in assembled_specs.get_apps_and_services()]<EOL><DEDENT>logging.info('<STR_LIT>'.format(services))<EOL>client = get_docker_client()<EOL>for service in services:<EOL><INDENT>container = get_container_for_app_or_service(service, include_exited=True)<EOL>if container is None:<EOL><INDENT>log_to_client('<STR_LIT>'.format(service))<EOL>continue<EOL><DEDENT>stopped_linked_containers = _check_stopped_linked_containers(container, assembled_specs)<EOL>if stopped_linked_containers:<EOL><INDENT>log_to_client('<STR_LIT>'.format(<EOL>stopped_linked_containers, service))<EOL><DEDENT>else:<EOL><INDENT>_restart_container(client, container)<EOL><DEDENT><DEDENT>
Well, this is annoying. Compose 1.2 shipped with the
    restart functionality fucking broken, so we can't set a faster
    timeout than 10 seconds (which is way too long) using Compose.
    We are therefore resigned to trying to hack this together
    ourselves. Lame.

    Relevant fix which will make it into the next release:
    https://github.com/docker/compose/pull/1318