Skip to content
This repository has been archived by the owner on Nov 11, 2019. It is now read-only.

Commit

Permalink
please/cli: Async decision task (#1985)
Browse files Browse the repository at this point in the history
  • Loading branch information
garbas authored Apr 1, 2019
1 parent 7db12a7 commit ac925d4
Show file tree
Hide file tree
Showing 9 changed files with 578 additions and 262 deletions.
8 changes: 6 additions & 2 deletions lib/cli_common/cli_common/taskcluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import click
import requests
import taskcluster
import taskcluster.aio

from cli_common.log import get_logger

Expand Down Expand Up @@ -82,7 +83,7 @@ def get_options(client_id=None, access_token=None):
return tc_options


def get_service(service_name, client_id=None, access_token=None):
def get_service(service_name, client_id=None, access_token=None, _async=False):
'''
Build a Taskcluster service instance from the environment
Supports:
Expand Down Expand Up @@ -110,7 +111,10 @@ def get_service(service_name, client_id=None, access_token=None):

# Instanciate service
options = get_options(client_id, access_token)
return getattr(taskcluster, service_name.capitalize())(options)
if _async:
return getattr(taskcluster.aio, service_name.capitalize())(options)
else:
return getattr(taskcluster, service_name.capitalize())(options)


def get_secrets(name,
Expand Down
6 changes: 4 additions & 2 deletions lib/please_cli/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ let
-C $cache_dir \
-V 3.7 \
-O ../../nix/requirements_override.nix \
-e pytest-runner \
-e setuptools-scm \
-s pytest-runner \
-s setuptools-scm \
-s intreehooks \
-s flit \
-r requirements.txt \
-r requirements-dev.txt
popd
Expand Down
3 changes: 0 additions & 3 deletions lib/please_cli/please_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import please_cli.base_image
import please_cli.build
import please_cli.check
import please_cli.check_cache
import please_cli.create
import please_cli.create_certs
import please_cli.decision_task
Expand All @@ -25,7 +24,6 @@
import please_cli.update_dependencies
import please_cli.utils


CMD_HELP = '''
Welcome to `please` command line utility which should help you develop
Expand Down Expand Up @@ -117,7 +115,6 @@ def cmd_tools(ctx):
cmd_tools.add_command(please_cli.build.cmd, 'build')
cmd_tools.add_command(please_cli.build.cmd_docker, 'docker')
cmd_tools.add_command(please_cli.shell.cmd_docker_shell, 'docker-shell')
cmd_tools.add_command(please_cli.check_cache.cmd, 'check-cache')
cmd_tools.add_command(please_cli.create_certs.cmd, 'create-certs')
cmd_tools.add_command(please_cli.decision_task.cmd, 'decision-task')
cmd_tools.add_command(please_cli.deploy.cmd_HEROKU, 'deploy:HEROKU')
Expand Down
5 changes: 3 additions & 2 deletions lib/please_cli/please_cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@
POSTGRESQL_BIN_DIR = os.environ.get('POSTGRESQL_BIN_DIR', '') # must end with /

IN_DOCKER = False
with open('/proc/1/cgroup', 'rt') as ifh:
IN_DOCKER = 'docker' in ifh.read()
if os.path.exists('/proc/1/cgroup'):
with open('/proc/1/cgroup', 'rt') as ifh:
IN_DOCKER = 'docker' in ifh.read()

TEMPLATES = {
'backend-json-api': {}
Expand Down
Loading

0 comments on commit ac925d4

Please sign in to comment.