Skip to content
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

Fine tuning for web app purpose #1126

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
28 changes: 17 additions & 11 deletions integration_tests/test_full_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
from pathlib import Path
import os
import shutil
from haddock.libs.libworkflow import WorkflowManager

from haddock.clis.cli import main as cli_main
from haddock.clis.cli_analyse import main as cli_analyse
from haddock.clis.cli_re import maincli
from haddock.core.typing import Any
from haddock.libs.libworkflow import WorkflowManager

from integration_tests import GOLDEN_DATA


Expand Down Expand Up @@ -66,7 +71,7 @@ def test_interactive_analysis_on_workflow(monkeypatch):

monkeypatch.chdir(tmpdir)

from haddock.clis.cli import main as cli_main

cli_main(
Path("workflow.cfg"),
)
Expand All @@ -85,7 +90,7 @@ def test_interactive_analysis_on_workflow(monkeypatch):

# now running interactive re-clustering
clustfcc_dir = f"{run_dir}/2_clustfcc"
from haddock.clis.cli_re import maincli

# faking sys.argv in input to haddock3-re
monkeypatch.setattr("sys.argv",
["haddock3-re", "clustfcc", clustfcc_dir, "-f", "0.7"]
Expand All @@ -106,14 +111,15 @@ def test_interactive_analysis_on_workflow(monkeypatch):
assert Path(run_dir, "3_caprieval_interactive/capri_ss.tsv").exists() is True

# now analyse the interactive folders
from haddock.clis.cli_analyse import main as cli_analyse
cli_analyse(run_dir,
[2,3],
10,
format=None,
scale=None,
is_cleaned=True,
inter=True)
cli_analyse(
run_dir,
[2, 3],
10,
format=None,
scale=None,
is_cleaned=True,
inter=True,
)
exp_clustfcc_dir = Path(run_dir, "analysis", "2_clustfcc_interactive_analysis")
exp_caprieval_dir = Path(run_dir, "analysis", "3_caprieval_interactive_analysis")
assert os.path.isdir(exp_clustfcc_dir) is True
Expand Down
20 changes: 14 additions & 6 deletions src/haddock/clis/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def cli(ap: ArgumentParser, main: Callable[..., None]) -> None:

def maincli() -> None:
"""Execute main client."""
cli(ap, main)
cli(_ap(), main)


def main(
Expand Down Expand Up @@ -117,6 +117,7 @@ def main(
get_initial_greeting,
gen_feedback_messages,
)
from haddock.gear.postprocessing import archive_run
from haddock.gear.prepare_run import setup_run
from haddock.libs.libio import working_directory
from haddock.libs.liblog import (
Expand Down Expand Up @@ -181,10 +182,7 @@ def main(
restart_step = restart
WorkflowManager_ = WorkflowManager

with (
working_directory(_run_dir),
log_error_and_exit(),
):
with (working_directory(_run_dir), log_error_and_exit()):
workflow = WorkflowManager_(
workflow_params=params,
start=restart_step,
Expand All @@ -193,10 +191,20 @@ def main(

# Main loop of execution
workflow.run()

# Run post-processing steps
if other_params["postprocess"]:
workflow.postprocess()
workflow.postprocess(self_contained=other_params["gen_archive"])
# Clean outputs
workflow.clean()

# Generate archive of the run
if other_params["gen_archive"]:
_run_archive, _analysis_archive = archive_run(_run_dir)
log.info(f"Run archive created: {_run_archive}!")
if _analysis_archive:
log.info(f"Run analysis archive created: {_analysis_archive}")

# Finish
end = time()
elapsed = convert_seconds_to_min_sec(end - start)
Expand Down
Loading