diff --git a/dev/archery/archery/bot.py b/dev/archery/archery/bot.py index c548e9a2a47..468b6246577 100644 --- a/dev/archery/archery/bot.py +++ b/dev/archery/archery/bot.py @@ -232,8 +232,10 @@ def _clone_arrow_and_crossbow(dest, crossbow_repo, pull_request): help='Additional task parameters for rendering the CI templates') @click.option('--arrow-version', '-v', default=None, help='Set target version explicitly.') +@click.option('--wait', default=60, + help='Wait the specified seconds before generating a report.') @click.pass_obj -def submit(obj, tasks, groups, params, arrow_version): +def submit(obj, tasks, groups, params, arrow_version, wait): """ Submit crossbow testing tasks. @@ -270,7 +272,8 @@ def submit(obj, tasks, groups, params, arrow_version): queue.push() # render the response comment's content - report = CommentReport(job, crossbow_repo=crossbow_repo) + report = CommentReport(job, crossbow_repo=crossbow_repo, + wait_for_task=wait) # send the response pull_request.create_issue_comment(report.show()) diff --git a/dev/archery/archery/crossbow/reports.py b/dev/archery/archery/crossbow/reports.py index a3958d8ccf2..2c8a0f0375c 100644 --- a/dev/archery/archery/crossbow/reports.py +++ b/dev/archery/archery/crossbow/reports.py @@ -20,6 +20,7 @@ import operator import fnmatch import functools +import time import click import requests @@ -41,7 +42,7 @@ class Report: "arrow_commit", ] - def __init__(self, job, task_filters=None): + def __init__(self, job, task_filters=None, wait_for_task=None): self.job = job tasks = sorted(job.tasks.items()) @@ -53,6 +54,7 @@ def __init__(self, job, task_filters=None): tasks = [(name, task) for name, task in tasks if name in filtered] self._tasks = dict(tasks) + self._wait_for_task = wait_for_task @property def repo_url(self): @@ -66,6 +68,8 @@ def branch_url(self, branch): return '{}/tree/{}'.format(self.repo_url, branch) def task_url(self, task): + if self._wait_for_task: + time.sleep(self._wait_for_task) if task.status().build_links: # show link to the actual build, some CI providers implement # the statuses API others implement the checks API, retrieve any. @@ -307,9 +311,9 @@ class CommentReport(Report): ), } - def __init__(self, job, crossbow_repo): + def __init__(self, job, crossbow_repo, wait_for_task=None): self.crossbow_repo = crossbow_repo - super().__init__(job) + super().__init__(job, wait_for_task=wait_for_task) def show(self): url = 'https://github.com/{repo}/branches/all?query={branch}'