Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/ansys/actions-8
Browse files Browse the repository at this point in the history
  • Loading branch information
awoimbee authored Nov 18, 2024
2 parents 0414206 + 7196d15 commit e1fdf0d
Show file tree
Hide file tree
Showing 14 changed files with 930 additions and 472 deletions.
29 changes: 28 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
Changelog
---------

Unreleased
**********

Fixes:

- Type hints on ``SimAIClient`` off by one

0.2.5 (2024-11-05)
******************

New:

- Allow users to cancel build with :py:meth:`Project.cancel_build()<ansys.simai.core.data.projects.Project.cancel_build>`
- Filter training data in :py:meth:`simai.training_data.list()<ansys.simai.core.data.training_data.TrainingDataDirectory.list>`
- Added experimental :py:meth:`Optimization.run_non_parametric()<ansys.simai.core.data.optimizations.OptimizationDirectory.run_non_parametric>`
- Added an example section to the documentation

Changes:

- `Optimization.run()` is now :py:meth:`Optimization.run()<ansys.simai.core.data.optimizations.OptimizationDirectory.run_parametric>` and checks that the generation function has a suitable signature
- Remove deprecated design of experiments feature
- Resolution steps are now printed upon error if any

Fixes:

- Correct payload for surface post-processing inputs on model build

0.2.4 (2024-09-23)
******************

Expand Down Expand Up @@ -89,7 +116,7 @@ New:

Fixes:

- The method :py:meth:`Optimization.run()<ansys.simai.core.data.optimizations.OptimizationDirectory.run>` now raises an exception if no workspace is provided and none is configured.
- The method `Optimization.run()<ansys.simai.core.data.optimizations.OptimizationDirectory.run>` now raises an exception if no workspace is provided and none is configured.
- Fix RecursionError on authentication refresh

0.1.5 (2024-04-15)
Expand Down
25 changes: 13 additions & 12 deletions doc/source/api_reference/optimizations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@ Model
:members:
:inherited-members:

TrialRuns
=========
..
TrialRuns
=========
Trial runs are a single step of the optimization process.
Trial runs are a single step of the optimization process.

Directory
---------
Directory
---------

.. autoclass:: OptimizationTrialRunDirectory()
:members:
.. autoclass:: __OptimizationTrialRunDirectory()
:members:


Model
-----
Model
-----

.. autoclass:: OptimizationTrialRun()
:members:
:inherited-members:
.. autoclass:: __OptimizationTrialRun()
:members:
:inherited-members:
804 changes: 424 additions & 380 deletions pdm.lock

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi"

[project]
name = "ansys-simai-core"
version = "0.2.4"
version = "0.2.5"
description = "A python wrapper for Ansys SimAI"
authors = [
{name = "ANSYS, Inc.", email = "[email protected]"},
Expand Down Expand Up @@ -39,11 +39,9 @@ dependencies = [
"wakepy>=0.8.0",
"tqdm>=4.66.1",
"filelock>=3.10.7",
"typing_extensions>=4.12.0"
]

[project.module]
name = "ansys.simai.core"

[tool.flit.module]
name = "ansys.simai.core"

Expand Down
8 changes: 3 additions & 5 deletions src/ansys/simai/core/api/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ class OptimizationClientMixin(ApiClientMixin):
def define_optimization(self, workspace_id: str, optimization_parameters: Dict):
return self._post(f"workspaces/{workspace_id}/optimizations", json=optimization_parameters)

def run_optimization_trial(
self, optimization_id: str, geometry_id: str, geometry_parameters: Dict
):
def run_optimization_trial(self, optimization_id: str, parameters: Dict):
return self._post(
f"optimizations/{optimization_id}/trial-runs/{geometry_id}",
json=geometry_parameters,
f"optimizations/{optimization_id}/trial-runs",
json=parameters,
)

def get_optimization(self, optimization_id: str):
Expand Down
9 changes: 9 additions & 0 deletions src/ansys/simai/core/api/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,12 @@ def compute_formula(self, project_id: str, calculette_payload: Dict[str, Any]):
json=calculette_payload,
return_json=False,
)

def cancel_build(self, project_id: str):
"""Cancels an existing model build if it exists.
Args:
project_id: ID of the project.
"""

return self._post(f"projects/{project_id}/cancel-training", return_json=True)
10 changes: 5 additions & 5 deletions src/ansys/simai/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from ansys.simai.core.data.models import ModelDirectory
from ansys.simai.core.data.optimizations import (
OptimizationDirectory,
OptimizationTrialRunDirectory,
_OptimizationTrialRunDirectory,
)
from ansys.simai.core.data.post_processings import PostProcessingDirectory
from ansys.simai.core.data.predictions import PredictionDirectory
Expand All @@ -54,7 +54,7 @@
)
from ansys.simai.core.utils.config_file import get_config
from ansys.simai.core.utils.configuration import ClientConfig
from ansys.simai.core.utils.typing import steal_kwargs_type
from ansys.simai.core.utils.typing import steal_kwargs_type_on_method

logger = logging.getLogger(__name__)

Expand All @@ -74,7 +74,7 @@ class SimAIClient:
)
"""

@steal_kwargs_type(ClientConfig)
@steal_kwargs_type_on_method(ClientConfig)
def __init__(self, **kwargs):
try:
config = ClientConfig(**kwargs)
Expand All @@ -87,7 +87,7 @@ def __init__(self, **kwargs):
self._compute_gc_formula_directory = ComputeGlobalCoefficientDirectory(client=self)
self._geometry_directory = GeometryDirectory(client=self)
self._optimization_directory = OptimizationDirectory(client=self)
self._optimization_trial_run_directory = OptimizationTrialRunDirectory(client=self)
self._optimization_trial_run_directory = _OptimizationTrialRunDirectory(client=self)
self._post_processing_directory = PostProcessingDirectory(client=self)
self._project_directory = ProjectDirectory(client=self)
self._model_directory = ModelDirectory(client=self)
Expand Down Expand Up @@ -294,7 +294,7 @@ def from_config(
import ansys.simai.core
simai = ansys.simai.core_from_config()
simai = ansys.simai.core.from_config()
Note:
The default paths are only supported on Unix systems.
Expand Down
Loading

0 comments on commit e1fdf0d

Please sign in to comment.