-
Notifications
You must be signed in to change notification settings - Fork 18
Contest: prepare HW split #100
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
base: main
Are you sure you want to change the base?
Changes from all commits
948c812
d8438de
349a4c3
240142d
7f76dc7
558538d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,11 +15,8 @@ | |
| Config: | ||
|
|
||
| [input] | ||
| branches=/path/to/branches.json,/path/to/branches2.json | ||
| infos=/path/to/infos.json,/path/to/infos2.json | ||
| [output] | ||
| dir=/path/to/output | ||
| url_pfx=relative/within/server | ||
| info=/path/to/info.json | ||
| """ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this commit. If you want to get rid of the faker why not delete the whole thing? You're removing the main reason for its existence. Combining infos can move to the brancher probably?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The combined infos is still used by the UI of I remember well (status I think, I can check when I have access) |
||
|
|
||
|
|
@@ -47,56 +44,6 @@ def main() -> None: | |
|
|
||
| combine_infos(config) | ||
|
|
||
| branches = [] | ||
| paths = config.get("input", "branches") | ||
| for path in paths.split(','): | ||
| with open(path, "r") as fp: | ||
| branches += json.load(fp) | ||
|
|
||
| branches = sorted(branches, key=lambda x: x["date"]) | ||
|
|
||
| url = config.get("output", "url_pfx") | ||
| if url[-1] != '/': | ||
| url += '/' | ||
| directory = config.get("output", "dir") | ||
|
|
||
| used_cookies = set() | ||
| results = [] | ||
| for br in branches: | ||
| br_dt = datetime.datetime.fromisoformat(br["date"]) | ||
| run_id_cookie = int(br_dt.timestamp() / 60) % 1000000 | ||
| while run_id_cookie in used_cookies: | ||
| run_id_cookie += 1 | ||
| used_cookies.add(run_id_cookie) | ||
| fname = f"results-{run_id_cookie}.json" | ||
|
|
||
| data = {'url': url + fname, | ||
| 'branch': br["branch"], | ||
| 'executor': "brancher"} | ||
| results.append(data) | ||
|
|
||
| run = {'branch': br["branch"], 'executor': "brancher"} | ||
| br_dt += datetime.timedelta(seconds=1) | ||
| run["start"] = br_dt.isoformat() | ||
| br_dt += datetime.timedelta(seconds=3) | ||
| run["end"] = br_dt.isoformat() | ||
|
|
||
| tail = br["url"].find('.git ') | ||
| if br["url"].startswith('https://github.com') and tail > 0: | ||
| br_url = br["url"][:tail] + "/commits/" + br["url"][tail + 5:] | ||
| else: | ||
| br_url = "https://netdev.bots.linux.dev/contest/branches.json" | ||
|
|
||
| run["results"] = [ | ||
| {"test": "branch-created", "group": "---", "result": "pass", "link": br_url} | ||
| ] | ||
|
|
||
| with open(os.path.join(directory, fname), "w") as fp: | ||
| json.dump(run, fp) | ||
|
|
||
| with open(os.path.join(directory, 'results.json'), "w") as fp: | ||
| json.dump(results, fp) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -390,10 +390,7 @@ def dump_branches(config, state) -> None: | |
| "url": pub_url + " " + name}) | ||
|
|
||
| write_json_atomic(config.get("output", "branches"), data) | ||
|
|
||
| info = config.get("output", "info") | ||
| with open(info, 'w') as fp: | ||
| json.dump(state["info"], fp) | ||
| write_json_atomic(config.get("output", "info"), state["info"]) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this going to work? Last time we did this the writer did not have write permissions to the directory where the files are. So we could not do an atomic swap. Please double check if this will be a problem for branches info?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I already checked the directory permission (and created the new files), but I will sure double check, thank you for the reminder |
||
| log_end_sec() | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure but also - why? Is it that bad to have two instances running?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was feeling this safer, not too have two confident writers (for the DB, even if it is supposed to be safe), and to keep the remote DB as is.
But I can revert back to two services (what I had in the v1)