Changeset View
Changeset View
Standalone View
Standalone View
swh/graph/luigi/utils.py
| Show All 27 Lines | def run_script(script: str, output_path: Path) -> None: | ||||
| with tmp_output_path.open("wb") as tmp_output: | with tmp_output_path.open("wb") as tmp_output: | ||||
| subprocess.run( | subprocess.run( | ||||
| ["bash", "-c", f"{script.strip()}"], stdout=tmp_output, env=env, check=True | ["bash", "-c", f"{script.strip()}"], stdout=tmp_output, env=env, check=True | ||||
| ) | ) | ||||
| # Atomically write the output file | # Atomically write the output file | ||||
| tmp_output_path.replace(output_path) | tmp_output_path.replace(output_path) | ||||
| def silence_webgraph_cache_warning(local_graph_path: Path): | |||||
| """Touches .obl files so WebGraph does not warn about them being older than | |||||
| .offset files. | |||||
| This workaround is a workaround for https://github.com/vigna/webgraph-big/pull/6 | |||||
| """ | |||||
| for path in local_graph_path.glob("*.obl"): | |||||
| path.touch() | |||||