You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/08/04 17:01:09 UTC

[GitHub] [tvm] csullivan commented on a diff in pull request #12295: [ci][tvmbot] Enable re-run for GitHub Actions

csullivan commented on code in PR #12295:
URL: https://github.com/apache/tvm/pull/12295#discussion_r938043083


##########
tests/scripts/github_tvmbot.py:
##########
@@ -503,6 +523,30 @@ def rerun_jenkins_ci(self) -> None:
         else:
             post(url, auth=("tvm-bot", TVM_BOT_JENKINS_TOKEN))
 
+    def rerun_github_actions(self) -> None:
+        job_ids = []
+        for item in self.head_commit()["statusCheckRollup"]["contexts"]["nodes"]:
+            if "checkSuite" in item:
+                job_ids.append(item["databaseId"])
+
+        logging.info(f"Rerunning GitHub Actions jobs with IDs: {job_ids}")
+        actions_github = GitHubRepo(
+            user=self.github.user, repo=self.github.repo, token=GH_ACTIONS_TOKEN
+        )
+        for job_id in job_ids:
+            if self.dry_run:
+                try:
+                    actions_github.post(f"actions/jobs/{job_id}/rerun", data={})
+                except RuntimeError as e:
+                    # Ignore errors about jobs that are part of the same workflow to avoid
+                    # having to figure out which jobs are in which workflows ahead of time
+                    if "The workflow run containing this job is already running" in str(e):

Review Comment:
   Does this imply if one of the actions is still running from the last post, it will continue to run and the new instance of the same action will not start on a `@tvm-bot rerun`? 



##########
tests/scripts/github_tvmbot.py:
##########
@@ -503,6 +523,30 @@ def rerun_jenkins_ci(self) -> None:
         else:
             post(url, auth=("tvm-bot", TVM_BOT_JENKINS_TOKEN))
 
+    def rerun_github_actions(self) -> None:
+        job_ids = []
+        for item in self.head_commit()["statusCheckRollup"]["contexts"]["nodes"]:
+            if "checkSuite" in item:
+                job_ids.append(item["databaseId"])
+
+        logging.info(f"Rerunning GitHub Actions jobs with IDs: {job_ids}")
+        actions_github = GitHubRepo(
+            user=self.github.user, repo=self.github.repo, token=GH_ACTIONS_TOKEN
+        )
+        for job_id in job_ids:
+            if self.dry_run:
+                try:
+                    actions_github.post(f"actions/jobs/{job_id}/rerun", data={})
+                except RuntimeError as e:
+                    # Ignore errors about jobs that are part of the same workflow to avoid
+                    # having to figure out which jobs are in which workflows ahead of time
+                    if "The workflow run containing this job is already running" in str(e):

Review Comment:
   Also, a point for potential future improvement could also be to only restart jobs that failed on a `rerun`. Since the commit hasn't changed the other actions that have passed likely do not need to be rerun.



-- 
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: commits-unsubscribe@tvm.apache.org

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