Skip to content

bot: Do not re-generate full reports on same day #162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions bot/tools/covdir_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,37 @@ def main():
# Read the history file
history = json.load(args.history)

# Load initial dates from our history
history_dates = {
item["changeset"]: datetime.fromtimestamp(item["date"]).date()
for item in history
}
dates = [history_dates[commit] for commit in commits if commit in history_dates]

# Trigger a task for each commit
nb = 0
for commit in history:
date = datetime.fromtimestamp(commit["date"])
if nb >= args.nb_tasks:
break
if commit in commits:
print("Skipping {commit {changeset} from {date}".format(**commit))
if commit["changeset"] in commits:
print(
f"Skipping commit {commit['changeset']} from {date} : already processed"
)
continue
print("Triggering commit {changeset} from {date}".format(**commit))

if date.date() in dates:
print(f"Skipping commit {commit['changeset']} from {date} : same day")
continue

print(f"Triggering commit {commit['changeset']} from {date}")
if args.dry_run:
print(">>> No trigger on dry run")
else:
out = trigger_task(args.group, commit)
print(">>>", out["status"]["taskId"])
nb += 1
dates.append(date.date())


if __name__ == "__main__":
Expand Down