You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/10/14 09:45:24 UTC

[GitHub] [arrow] raulcd commented on a diff in pull request #14412: ARROW-18048: [Dev][Archery][Crossbow] Comment bot waits for a while before generate a report

raulcd commented on code in PR #14412:
URL: https://github.com/apache/arrow/pull/14412#discussion_r995567721


##########
dev/archery/archery/bot.py:
##########
@@ -269,6 +272,10 @@ def submit(obj, tasks, groups, params, arrow_version):
         queue.put(job, prefix="actions", increment_job_id=False)
         queue.push()
 
+        # # wait for tasks of the job are triggered to collect more
+        # # suitable task URLs
+        time.sleep(wait)

Review Comment:
   I am ok with the heuristic implementation but I think I would prefer this to be implemented inside the `CommentReport` and the `task_url` itself as I can see us requiring to wait for the job to trigger on other places. I had something like this patch in mind:
   ```
   diff --git a/dev/archery/archery/bot.py b/dev/archery/archery/bot.py
   index c548e9a..8b02dc7 100644
   --- a/dev/archery/archery/bot.py
   +++ b/dev/archery/archery/bot.py
   @@ -270,7 +270,7 @@ 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 a3958d8..d887574 100644
   --- a/dev/archery/archery/crossbow/reports.py
   +++ b/dev/archery/archery/crossbow/reports.py
   @@ -20,6 +20,7 @@ import csv
    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 @@ class Report:
                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 @@ class Report:
            return '{}/tree/{}'.format(self.repo_url, branch)
    
        def task_url(self, task):
   +        if self._wait_for_task:
   +            time.wait(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.
   ```
   what do you think?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org