diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2da9b6f1..d2991140 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,8 +9,10 @@ Changelog - Fix missing of groups in `obr run --list-operations` view, see https://github.com/hpsim/OBR/pull/159. - Make view folders relative see https://github.com/hpsim/OBR/pull/164 - Use cached version of git repo instead of cloning, see https://github.com/hpsim/OBR/pull/166 +- Bump signac version, see https://github.com/hpsim/OBR/pull/169 - Validate simulation state after runSerial|ParallelSolver, see https://github.com/hpsim/OBR/pull/168 + 0.2.0 (2023-09-14) ------------------ - Add --json=file.json option to obr query, which writes the result of the query to a json file. diff --git a/pyproject.toml b/pyproject.toml index a40e6c54..95bf5544 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,8 +17,8 @@ requires-python = ">=3.6" dependencies = [ "click", "PyYAML", - "signac==1.8.0", - "signac-flow==0.23.0", + "signac==2.1.0", + "signac-flow==0.26.1", "GitPython==3.1.31", "pandas", "DeepDiff", diff --git a/src/obr/OpenFOAM/case.py b/src/obr/OpenFOAM/case.py index e395704f..4717b613 100644 --- a/src/obr/OpenFOAM/case.py +++ b/src/obr/OpenFOAM/case.py @@ -6,7 +6,7 @@ from typing import Union, Generator, Tuple, Any from pathlib import Path from subprocess import check_output -from signac.contrib.job import Job +from signac.job import Job from datetime import datetime from Owls.parser.FoamDict import FileParser from Owls.parser.LogFile import LogFile diff --git a/src/obr/cli.py b/src/obr/cli.py index 963cf347..ae30d68f 100644 --- a/src/obr/cli.py +++ b/src/obr/cli.py @@ -23,12 +23,7 @@ import json import logging -from signac.contrib.job import Job -from .signac_wrapper.operations import OpenFOAMProject, get_values -from .create_tree import create_tree -from .core.parse_yaml import read_yaml -from .core.queries import input_to_queries, query_impl, build_filter_query, Query -from .core.core import map_view_folder_to_job_id +from signac.job import Job from pathlib import Path from subprocess import check_output from git.repo import Repo @@ -38,6 +33,12 @@ from typing import Union, Optional, Any from copy import deepcopy +from .signac_wrapper.operations import OpenFOAMProject, get_values +from .create_tree import create_tree +from .core.parse_yaml import read_yaml +from .core.queries import input_to_queries, query_impl, build_filter_query, Query +from .core.core import map_view_folder_to_job_id + def check_cli_operations( project: OpenFOAMProject, operations: list[str], list_operations: Optional[Any] @@ -341,7 +342,7 @@ def init(ctx: click.Context, **kwargs): if kwargs.get("verbose", 0) >= 1: logging.info(config) - project = OpenFOAMProject.init_project(root=kwargs["folder"]) + project = OpenFOAMProject.init_project(path=kwargs["folder"]) create_tree(project, config, kwargs) logging.info("successfully initialised") diff --git a/src/obr/core.py b/src/obr/core.py new file mode 100644 index 00000000..e5a0d9b4 --- /dev/null +++ b/src/obr/core.py @@ -0,0 +1 @@ +#!/usr/bin/env python3 diff --git a/src/obr/core/core.py b/src/obr/core/core.py index 6bab9c2b..582453f5 100644 --- a/src/obr/core/core.py +++ b/src/obr/core/core.py @@ -10,7 +10,7 @@ from subprocess import check_output from typing import Union, Generator from datetime import datetime -from signac.contrib.job import Job +from signac.job import Job from copy import deepcopy # these are to be replaced with each other diff --git a/src/obr/core/queries.py b/src/obr/core/queries.py index 34ed88f5..c65607bc 100644 --- a/src/obr/core/queries.py +++ b/src/obr/core/queries.py @@ -1,10 +1,11 @@ -from dataclasses import dataclass, field -from typing import Any, Union, Callable, Iterable -from copy import deepcopy import re import logging -from signac.contrib.job import Job import pandas as pd + +from dataclasses import dataclass, field +from typing import Any, Union, Callable, Iterable +from copy import deepcopy +from signac.job import Job from typing import TYPE_CHECKING, Union from enum import Enum diff --git a/src/obr/create_tree.py b/src/obr/create_tree.py index 78ab5f22..b8acb521 100644 --- a/src/obr/create_tree.py +++ b/src/obr/create_tree.py @@ -21,7 +21,7 @@ from collections.abc import MutableMapping from pathlib import Path from subprocess import check_output -from signac.contrib.job import Job +from signac.job import Job from obr.signac_wrapper.operations import OpenFOAMProject from copy import deepcopy diff --git a/src/obr/signac_wrapper/operations.py b/src/obr/signac_wrapper/operations.py index 144a9505..d5be4a55 100644 --- a/src/obr/signac_wrapper/operations.py +++ b/src/obr/signac_wrapper/operations.py @@ -9,7 +9,7 @@ from ..core.core import execute from .labels import owns_mesh, final, finished from obr.OpenFOAM.case import OpenFOAMCase -from signac.contrib.job import Job +from signac.job import Job from typing import Union, Literal from datetime import datetime import logging @@ -111,7 +111,7 @@ def basic_eligible(job: Job, operation: str) -> bool: def parent_job_is_ready(job: Job) -> str: """Checks whether the parent of the given job is ready""" if job.sp().get("parent_id"): - project = OpenFOAMProject.get_project(root=job.path + "/../..") + project = OpenFOAMProject.get_project(path=job.path + "/../..") parent_job = project.open_job(id=job.sp().get("parent_id")) return parent_job.doc["state"].get("global", "") return "" diff --git a/tests/test_create_tree.py b/tests/test_create_tree.py index 20d23baa..23ce7d2b 100644 --- a/tests/test_create_tree.py +++ b/tests/test_create_tree.py @@ -91,7 +91,7 @@ def open_job(self, statepoint): def test_create_tree(tmpdir, emit_test_config): - project = OpenFOAMProject.init_project(root=tmpdir) + project = OpenFOAMProject.init_project(path=tmpdir) create_tree(project, emit_test_config, {"folder": tmpdir}, skip_foam_src_check=True) @@ -118,7 +118,7 @@ def test_create_tree(tmpdir, emit_test_config): def test_call_generate_tree(tmpdir, emit_test_config): - project = OpenFOAMProject.init_project(root=tmpdir) + project = OpenFOAMProject.init_project(path=tmpdir) workspace_dir = tmpdir / "workspace" view_dir = tmpdir / "view" @@ -146,7 +146,7 @@ def test_call_generate_tree(tmpdir, emit_test_config): def test_cache_folder(tmpdir, emit_test_config): emit_test_config["case"]["cache_folder"] = f"{tmpdir}/tmp" - project = OpenFOAMProject.init_project(root=tmpdir) + project = OpenFOAMProject.init_project(path=tmpdir) create_tree(project, emit_test_config, {"folder": tmpdir}, skip_foam_src_check=True) @@ -166,8 +166,8 @@ def test_cache_folder(tmpdir, emit_test_config): # after purgin and recreating the workspace, the cache folder should be used Path(f"{tmpdir}/tmp/test").touch() shutil.rmtree(workspace_dir) - os.remove(f"{tmpdir}/signac.rc") - project = OpenFOAMProject.init_project(root=tmpdir) + shutil.rmtree(tmpdir /".signac") + project = OpenFOAMProject.init_project(path=tmpdir) create_tree(project, emit_test_config, {"folder": tmpdir}, skip_foam_src_check=True) project.run(names=["fetchCase"]) diff --git a/tests/test_md5sum.py b/tests/test_md5sum.py index 901b8dd7..7bec3391 100644 --- a/tests/test_md5sum.py +++ b/tests/test_md5sum.py @@ -35,7 +35,7 @@ def emit_test_config(): def test_md5sum_calculation(tmpdir, emit_test_config): - project = OpenFOAMProject.init_project(root=tmpdir) + project = OpenFOAMProject.init_project(path=tmpdir) create_tree(project, emit_test_config, {"folder": tmpdir}, skip_foam_src_check=True) diff --git a/tests/test_queries.py b/tests/test_queries.py index 7a639ea9..47f856dc 100644 --- a/tests/test_queries.py +++ b/tests/test_queries.py @@ -134,7 +134,7 @@ def get_project(tmpdir): } os.chdir(tmpdir) - project = OpenFOAMProject.init_project(root=tmpdir) + project = OpenFOAMProject.init_project(path=tmpdir) create_tree(project, config, {"folder": tmpdir}, skip_foam_src_check=True) project.run(names=["fetchCase"]) return project