Nightly torch ci (#13550)

* Nightly CI torch

* Version

* Reformat

* Only subset
Fix

* Revert

* Better formatting

* New channel
This commit is contained in:
Lysandre Debut
2021-09-13 16:17:29 -04:00
committed by GitHub
parent 5c14fceac0
commit 3ab0185b06
2 changed files with 280 additions and 5 deletions

View File

@@ -38,13 +38,13 @@ def handle_test_results(test_results):
return failed, success, time_spent
def format_for_slack(total_results, results, scheduled: bool):
def format_for_slack(total_results, results, scheduled: bool, title: str):
print(total_results, results)
header = {
"type": "header",
"text": {
"type": "plain_text",
"text": "🤗 Results of the scheduled tests." if scheduled else "🤗 Self-push results",
"text": title,
"emoji": True,
},
}
@@ -105,7 +105,13 @@ def format_for_slack(total_results, results, scheduled: bool):
if __name__ == "__main__":
scheduled = sys.argv[1] == "scheduled"
arguments = sys.argv[1:]
if "scheduled" in arguments:
arguments.remove("scheduled")
scheduled = True
else:
scheduled = False
if scheduled:
# The scheduled run has several artifacts for each job.
@@ -149,7 +155,21 @@ if __name__ == "__main__":
}
client = WebClient(token=os.environ["CI_SLACK_BOT_TOKEN"])
channel_id = os.environ["CI_SLACK_CHANNEL_ID_DAILY"] if scheduled else os.environ["CI_SLACK_CHANNEL_ID"]
if not scheduled:
channel_id = os.environ["CI_SLACK_CHANNEL_ID"]
elif scheduled and len(arguments):
channel_id = os.environ["CI_SLACK_CHANNEL_ID_PAST_FUTURE"]
else:
channel_id = os.environ["CI_SLACK_CHANNEL_ID_DAILY"]
if scheduled:
title = "🤗 Results of the scheduled tests."
else:
title = "🤗 Self-push results"
if len(arguments):
title = f"{arguments} " + title
try:
results = {}
@@ -182,7 +202,7 @@ if __name__ == "__main__":
total[result_key] += job_result[result_key]
if total["failed"] != 0 or scheduled:
to_be_sent_to_slack = format_for_slack(total, results, scheduled)
to_be_sent_to_slack = format_for_slack(total, results, scheduled, title)
result = client.chat_postMessage(
channel=channel_id,