mirror of
https://github.com/rosenpass/rosenpass.git
synced 2026-02-28 14:33:37 -08:00
feat: move analyze to Python, including parallel execution
Co-authored-by: Anja Rabich <a.rabich@uni-luebeck.de>
This commit is contained in:
@@ -16,14 +16,13 @@
|
|||||||
* ~~why is everything red in the pretty output? (see line 96 in __init__.py)~~
|
* ~~why is everything red in the pretty output? (see line 96 in __init__.py)~~
|
||||||
* ~~awk RESULT flush in marzipan()~~
|
* ~~awk RESULT flush in marzipan()~~
|
||||||
* ~~move the whole metaverif function to Python~~
|
* ~~move the whole metaverif function to Python~~
|
||||||
|
* ~move the whole analyze function to Python~
|
||||||
|
* ~find the files~
|
||||||
|
* ~start subprocesses in parallel~
|
||||||
|
* ~wait for them to finish~
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
|
|
||||||
|
|
||||||
* move the whole analyze function to Python
|
|
||||||
* find the files
|
|
||||||
* start subprocesses in parallel
|
|
||||||
* wait for them to finish
|
|
||||||
* think about next steps
|
* think about next steps
|
||||||
* integrate this upstream, into the CI?
|
* integrate this upstream, into the CI?
|
||||||
* “make it beautiful” steps? more resiliency to working directory?
|
* “make it beautiful” steps? more resiliency to working directory?
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ def _run_proverif(file, extra_args=[]):
|
|||||||
try:
|
try:
|
||||||
null, p = clean_warnings_init()
|
null, p = clean_warnings_init()
|
||||||
for line in process.stdout:
|
for line in process.stdout:
|
||||||
print(f"received a line: {line.strip()}")
|
#print(f"received a line: {line.strip()}")
|
||||||
# clean warnings
|
# clean warnings
|
||||||
line = line.rstrip()
|
line = line.rstrip()
|
||||||
if not pkgs.re.match(r"^Warning: identifier \w+ rebound.$", line):
|
if not pkgs.re.match(r"^Warning: identifier \w+ rebound.$", line):
|
||||||
@@ -165,14 +165,27 @@ def pretty_output(file_path):
|
|||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@click.argument("command")
|
|
||||||
@click.argument("path")
|
@click.argument("path")
|
||||||
def analyze(command, path):
|
def analyze(path):
|
||||||
exc([
|
pkgs.os.chdir(path)
|
||||||
f"{pkgs.pathlib.Path(__file__).resolve().parent}/analyze.sh",
|
|
||||||
command,
|
tmpdir = "target/proverif"
|
||||||
path
|
pkgs.os.makedirs(tmpdir, exist_ok=True)
|
||||||
])
|
|
||||||
|
entries = []
|
||||||
|
entries.extend(sorted(pkgs.glob.glob('analysis/*.entry.mpv')))
|
||||||
|
|
||||||
|
with pkgs.concurrent.futures.ProcessPoolExecutor() as executor:
|
||||||
|
futures = {executor.submit(_metaverif, tmpdir, entry): entry for entry in entries}
|
||||||
|
for future in pkgs.concurrent.futures.as_completed(futures):
|
||||||
|
cmd = futures[future]
|
||||||
|
try:
|
||||||
|
#res = future.result()
|
||||||
|
print(f"Metaverif {cmd} finished.", file=pkgs.sys.stderr)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Metaverif {cmd} generated an exception: {e}")
|
||||||
|
|
||||||
|
print("all processes finished.")
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@@ -232,6 +245,10 @@ def clean_warnings():
|
|||||||
@click.argument("tmpdir")
|
@click.argument("tmpdir")
|
||||||
@click.argument("file")
|
@click.argument("file")
|
||||||
def metaverif(tmpdir, file):
|
def metaverif(tmpdir, file):
|
||||||
|
metaverif(tmpdir, file)
|
||||||
|
|
||||||
|
def _metaverif(tmpdir, file):
|
||||||
|
print(f"Start metaverif on {file}")
|
||||||
# Extract the name using regex
|
# Extract the name using regex
|
||||||
name_match = pkgs.re.search(r'([^/]*)(?=\.mpv)', file)
|
name_match = pkgs.re.search(r'([^/]*)(?=\.mpv)', file)
|
||||||
if name_match:
|
if name_match:
|
||||||
|
|||||||
Reference in New Issue
Block a user