Bug 1546757 - [tryselect] Provide defaults to generate_tasks arguments, r=Callek

This allows consumers to call 'generate_tasks()' without arguments.

Differential Revision: https://phabricator.services.mozilla.com/D28770

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew Halberstadt 2019-04-30 16:41:47 +00:00
Родитель 31e861116c
Коммит a33e10de46
4 изменённых файлов: 8 добавлений и 7 удалений

Просмотреть файл

@ -10,7 +10,7 @@ from threading import Timer
from tryselect.cli import BaseTryParser from tryselect.cli import BaseTryParser
from tryselect.tasks import generate_tasks from tryselect.tasks import generate_tasks
from tryselect.push import check_working_directory, push_to_try, vcs from tryselect.push import check_working_directory, push_to_try
here = os.path.abspath(os.path.dirname(__file__)) here = os.path.abspath(os.path.dirname(__file__))
@ -28,7 +28,7 @@ def run(update=False, query=None, templates=None, full=False, parameters=None,
from .app import create_application from .app import create_application
check_working_directory(push) check_working_directory(push)
tg = generate_tasks(parameters, full, root=vcs.path) tg = generate_tasks(parameters, full)
app = create_application(tg) app = create_application(tg)
if os.environ.get('WERKZEUG_RUN_MAIN') == 'true': if os.environ.get('WERKZEUG_RUN_MAIN') == 'true':

Просмотреть файл

@ -352,7 +352,7 @@ def run(templates={}, full=False, parameters=None, push=True, message='{msg}', c
print('ERROR Could not find any tests or chunks to run.') print('ERROR Could not find any tests or chunks to run.')
return 1 return 1
tg = generate_tasks(parameters, full, root=build.topsrcdir) tg = generate_tasks(parameters, full)
all_tasks = tg.tasks.keys() all_tasks = tg.tasks.keys()
tasks_by_chunks = filter_tasks_by_chunks(all_tasks, test_chunks) tasks_by_chunks = filter_tasks_by_chunks(all_tasks, test_chunks)

Просмотреть файл

@ -16,7 +16,7 @@ from mozterm import Terminal
from ..cli import BaseTryParser from ..cli import BaseTryParser
from ..tasks import generate_tasks, filter_tasks_by_paths from ..tasks import generate_tasks, filter_tasks_by_paths
from ..push import check_working_directory, push_to_try, vcs from ..push import check_working_directory, push_to_try
terminal = Terminal() terminal = Terminal()
@ -228,7 +228,7 @@ def run(update=False, query=None, intersect_query=None, templates=None, full=Fal
return 1 return 1
check_working_directory(push) check_working_directory(push)
tg = generate_tasks(parameters, full, root=vcs.path) tg = generate_tasks(parameters, full)
all_tasks = sorted(tg.tasks.keys()) all_tasks = sorted(tg.tasks.keys())
if not full: if not full:

Просмотреть файл

@ -53,9 +53,10 @@ def invalidate(cache, root):
os.remove(cache) os.remove(cache)
def generate_tasks(params, full, root): def generate_tasks(params=None, full=False):
# TODO: Remove after January 1st, 2020. # TODO: Remove after January 1st, 2020.
# Try to delete the old taskgraph cache directories. # Try to delete the old taskgraph cache directories.
root = build.topsrcdir
root_hash = hashlib.sha256(os.path.abspath(root)).hexdigest() root_hash = hashlib.sha256(os.path.abspath(root)).hexdigest()
old_cache_dirs = [ old_cache_dirs = [
os.path.join(get_state_dir(), 'cache', 'taskgraph'), os.path.join(get_state_dir(), 'cache', 'taskgraph'),
@ -81,7 +82,7 @@ def generate_tasks(params, full, root):
taskgraph.fast = True taskgraph.fast = True
cwd = os.getcwd() cwd = os.getcwd()
os.chdir(build.topsrcdir) os.chdir(root)
root = os.path.join(root, 'taskcluster', 'ci') root = os.path.join(root, 'taskcluster', 'ci')
params = parameters_loader(params, strict=False, overrides={'try_mode': 'try_select'}) params = parameters_loader(params, strict=False, overrides={'try_mode': 'try_select'})