luminarycloud 0.16.2__py3-none-any.whl → 0.18.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. luminarycloud/_auth/auth.py +23 -34
  2. luminarycloud/_client/client.py +23 -4
  3. luminarycloud/_client/retry_interceptor.py +7 -0
  4. luminarycloud/_helpers/_create_geometry.py +134 -34
  5. luminarycloud/_helpers/_wait_for_mesh.py +14 -4
  6. luminarycloud/_helpers/cond.py +0 -1
  7. luminarycloud/_proto/api/v0/luminarycloud/geometry/geometry_pb2.py +146 -123
  8. luminarycloud/_proto/api/v0/luminarycloud/geometry/geometry_pb2.pyi +82 -15
  9. luminarycloud/_proto/api/v0/luminarycloud/geometry/geometry_pb2_grpc.py +34 -0
  10. luminarycloud/_proto/api/v0/luminarycloud/geometry/geometry_pb2_grpc.pyi +12 -0
  11. luminarycloud/_proto/api/v0/luminarycloud/inference/inference_pb2.py +8 -8
  12. luminarycloud/_proto/api/v0/luminarycloud/inference/inference_pb2.pyi +12 -7
  13. luminarycloud/_proto/api/v0/luminarycloud/mesh/mesh_pb2.py +25 -3
  14. luminarycloud/_proto/api/v0/luminarycloud/mesh/mesh_pb2.pyi +30 -0
  15. luminarycloud/_proto/api/v0/luminarycloud/mesh/mesh_pb2_grpc.py +34 -0
  16. luminarycloud/_proto/api/v0/luminarycloud/mesh/mesh_pb2_grpc.pyi +12 -0
  17. luminarycloud/_proto/api/v0/luminarycloud/pipelines/pipelines_pb2.py +246 -0
  18. luminarycloud/_proto/api/v0/luminarycloud/pipelines/pipelines_pb2.pyi +420 -0
  19. luminarycloud/_proto/api/v0/luminarycloud/pipelines/pipelines_pb2_grpc.py +240 -0
  20. luminarycloud/_proto/api/v0/luminarycloud/pipelines/pipelines_pb2_grpc.pyi +90 -0
  21. luminarycloud/_proto/api/v0/luminarycloud/project/project_pb2.py +54 -3
  22. luminarycloud/_proto/api/v0/luminarycloud/project/project_pb2.pyi +92 -1
  23. luminarycloud/_proto/api/v0/luminarycloud/project/project_pb2_grpc.py +132 -0
  24. luminarycloud/_proto/api/v0/luminarycloud/project/project_pb2_grpc.pyi +40 -0
  25. luminarycloud/_proto/api/v0/luminarycloud/project_ui_state/project_ui_state_pb2.py +97 -0
  26. luminarycloud/_proto/api/v0/luminarycloud/project_ui_state/project_ui_state_pb2.pyi +93 -0
  27. luminarycloud/_proto/api/v0/luminarycloud/project_ui_state/project_ui_state_pb2_grpc.py +132 -0
  28. luminarycloud/_proto/api/v0/luminarycloud/project_ui_state/project_ui_state_pb2_grpc.pyi +44 -0
  29. luminarycloud/_proto/api/v0/luminarycloud/simulation_template/simulation_template_pb2.py +48 -26
  30. luminarycloud/_proto/api/v0/luminarycloud/simulation_template/simulation_template_pb2.pyi +30 -2
  31. luminarycloud/_proto/api/v0/luminarycloud/simulation_template/simulation_template_pb2_grpc.py +36 -0
  32. luminarycloud/_proto/api/v0/luminarycloud/simulation_template/simulation_template_pb2_grpc.pyi +18 -0
  33. luminarycloud/_proto/api/v0/luminarycloud/vis/vis_pb2.py +153 -133
  34. luminarycloud/_proto/api/v0/luminarycloud/vis/vis_pb2.pyi +51 -3
  35. luminarycloud/_proto/client/simulation_pb2.py +261 -251
  36. luminarycloud/_proto/client/simulation_pb2.pyi +35 -2
  37. luminarycloud/_proto/frontend/output/output_pb2.py +24 -24
  38. luminarycloud/_proto/frontend/output/output_pb2.pyi +6 -3
  39. luminarycloud/_proto/geometry/geometry_pb2.py +63 -63
  40. luminarycloud/_proto/geometry/geometry_pb2.pyi +16 -8
  41. luminarycloud/_proto/hexmesh/hexmesh_pb2.py +17 -4
  42. luminarycloud/_proto/hexmesh/hexmesh_pb2.pyi +22 -1
  43. luminarycloud/_proto/inferenceservice/inferenceservice_pb2.py +10 -10
  44. luminarycloud/_proto/inferenceservice/inferenceservice_pb2.pyi +12 -7
  45. luminarycloud/_proto/quantity/quantity_pb2.py +19 -19
  46. luminarycloud/enum/geometry_status.py +15 -8
  47. luminarycloud/enum/pipeline_job_status.py +23 -0
  48. luminarycloud/feature_modification.py +3 -6
  49. luminarycloud/geometry.py +25 -0
  50. luminarycloud/geometry_version.py +23 -0
  51. luminarycloud/mesh.py +16 -0
  52. luminarycloud/params/enum/_enum_wrappers.py +29 -0
  53. luminarycloud/params/simulation/physics/fluid/boundary_conditions/inlet/fan_curve_inlet_.py +1 -1
  54. luminarycloud/params/simulation/physics/fluid/boundary_conditions/inlet/mach_inlet_.py +5 -1
  55. luminarycloud/params/simulation/physics/fluid/boundary_conditions/inlet/mass_flow_inlet_.py +5 -1
  56. luminarycloud/params/simulation/physics/fluid/boundary_conditions/inlet/total_pressure_inlet_.py +5 -1
  57. luminarycloud/params/simulation/physics/fluid/boundary_conditions/inlet/velocity_magnitude_inlet_.py +5 -1
  58. luminarycloud/physics_ai/inference.py +46 -30
  59. luminarycloud/pipelines/__init__.py +7 -0
  60. luminarycloud/pipelines/api.py +213 -0
  61. luminarycloud/project.py +98 -11
  62. luminarycloud/simulation_template.py +15 -6
  63. luminarycloud/vis/__init__.py +6 -0
  64. luminarycloud/vis/data_extraction.py +201 -31
  65. luminarycloud/vis/filters.py +94 -35
  66. luminarycloud/vis/interactive_inference.py +153 -0
  67. luminarycloud/vis/interactive_scene.py +35 -16
  68. luminarycloud/vis/primitives.py +87 -1
  69. luminarycloud/vis/visualization.py +50 -6
  70. luminarycloud/volume_selection.py +3 -6
  71. {luminarycloud-0.16.2.dist-info → luminarycloud-0.18.0.dist-info}/METADATA +18 -18
  72. {luminarycloud-0.16.2.dist-info → luminarycloud-0.18.0.dist-info}/RECORD +73 -62
  73. {luminarycloud-0.16.2.dist-info → luminarycloud-0.18.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,23 @@
1
+ # Copyright 2025 Luminary Cloud, Inc. All Rights Reserved.
2
+ from enum import IntEnum
3
+ from .._proto.api.v0.luminarycloud.pipelines import pipelines_pb2 as pipelinespb
4
+
5
+
6
+ class PipelineJobStatus(IntEnum):
7
+ """
8
+ Status of a pipeline job.
9
+
10
+ Attributes
11
+ ----------
12
+ PENDING
13
+ RUNNING
14
+ COMPLETED
15
+ FAILED
16
+ """
17
+
18
+ UNSPECIFIED = pipelinespb.PIPELINE_JOB_STATUS_UNSPECIFIED
19
+
20
+ PENDING = pipelinespb.PIPELINE_JOB_STATUS_PENDING
21
+ RUNNING = pipelinespb.PIPELINE_JOB_STATUS_RUNNING
22
+ COMPLETED = pipelinespb.PIPELINE_JOB_STATUS_COMPLETED
23
+ FAILED = pipelinespb.PIPELINE_JOB_STATUS_FAILED
@@ -2,6 +2,8 @@
2
2
  from enum import Enum, auto
3
3
  from typing import Dict, Iterable, List, Optional, cast
4
4
  from copy import deepcopy
5
+
6
+ from luminarycloud.types.adfloat import _to_ad_proto, _from_ad_proto
5
7
  from ._proto.geometry import geometry_pb2 as gpb
6
8
  from .types import Vector3Like
7
9
  from .types.vector3 import _to_vector3
@@ -150,7 +152,6 @@ def modify_import(
150
152
  feature: gpb.Feature,
151
153
  geometry_url: Optional[str] = None,
152
154
  scaling: Optional[float] = None,
153
- force_discrete: Optional[bool] = None,
154
155
  ) -> gpb.Modification:
155
156
  """
156
157
  Modify an import feature with optional new values.
@@ -160,7 +161,6 @@ def modify_import(
160
161
  feature: A gpb.Feature object
161
162
  geometry_url: The new geometry URL
162
163
  scaling: New scaling factor
163
- force_discrete: Whether to force discrete geometry
164
164
 
165
165
  Returns:
166
166
  A gpb.Modification object
@@ -175,10 +175,7 @@ def modify_import(
175
175
  feature_copy.import_geometry.geometry_url = geometry_url
176
176
 
177
177
  if scaling is not None:
178
- feature_copy.import_geometry.scaling = scaling
179
-
180
- if force_discrete is not None:
181
- feature_copy.import_geometry.force_discrete = force_discrete
178
+ feature_copy.import_geometry.scaling.CopyFrom(_to_ad_proto(scaling))
182
179
 
183
180
  return gpb.Modification(
184
181
  mod_type=gpb.Modification.ModificationType.MODIFICATION_TYPE_UPDATE_FEATURE,
luminarycloud/geometry.py CHANGED
@@ -29,6 +29,7 @@ from .named_variable_set import NamedVariableSet, get_named_variable_set
29
29
 
30
30
  if TYPE_CHECKING:
31
31
  from .project import Project
32
+ from .geometry_version import GeometryVersion
32
33
 
33
34
 
34
35
  @ProtoWrapper(geometrypb.Geometry)
@@ -276,6 +277,30 @@ class Geometry(ProtoWrapperBase):
276
277
  )
277
278
  )
278
279
 
280
+ def convert_colors_to_tags(self) -> None:
281
+ """
282
+ Convert colors to tags in the geometry.
283
+ If the imported geometry has surface or volume colors, this will create a tag per color
284
+ (formatted as "[RRR,GGG,BBB]") and assign the corresponding surfaces and volumes to that
285
+ tag.
286
+ """
287
+ self._modify(
288
+ modification=gpb.Modification(
289
+ mod_type=gpb.Modification.MODIFICATION_TYPE_CONVERT_COLORS_TO_TAGS,
290
+ )
291
+ )
292
+
293
+ def latest_version(self) -> GeometryVersion:
294
+ """
295
+ Get the latest version of the geometry.
296
+ """
297
+ from .geometry_version import get_geometry_version
298
+
299
+ req = geometrypb.GetGeometryRequest(geometry_id=self.id)
300
+ res_geo: geometrypb.GetGeometryResponse = get_default_client().GetGeometry(req)
301
+ geometry_version_id = res_geo.geometry.last_version_id
302
+ return get_geometry_version(geometry_version_id)
303
+
279
304
  def check(self) -> tuple[bool, list[str]]:
280
305
  """
281
306
  Check the geometry for any issues that may prevent meshing.
@@ -87,6 +87,29 @@ class GeometryVersion(ProtoWrapperBase):
87
87
  ]
88
88
  return surfaces, volumes
89
89
 
90
+ def copy_to_new_geometry(self, name: str = "") -> Geometry:
91
+ """
92
+ Copy this GeometryVersion and create a new Geometry containing only that newly copied version.
93
+
94
+ Parameters
95
+ ----------
96
+ name : str, optional
97
+ The name of the new Geometry. If not provided, a default name will be used.
98
+
99
+ Returns
100
+ -------
101
+ Geometry
102
+ The new Geometry containing only the newly copied GeometryVersion.
103
+ """
104
+ req = geometrypb.CopyGeometryFromVersionRequest(
105
+ geometry_version_id=self.id,
106
+ name=name,
107
+ )
108
+ res: geometrypb.CopyGeometryFromVersionResponse = (
109
+ get_default_client().CopyGeometryFromVersion(req)
110
+ )
111
+ return Geometry(res.geometry)
112
+
90
113
  def _list_features(
91
114
  self,
92
115
  ) -> list[gpb.Feature]:
luminarycloud/mesh.py CHANGED
@@ -136,6 +136,22 @@ class Mesh(ProtoWrapperBase):
136
136
  """
137
137
  return get_mesh_metadata(self.id)
138
138
 
139
+ def to_code(self) -> str:
140
+ """
141
+ Returns the Python code that recreates this mesh.
142
+
143
+ Examples:
144
+ --------
145
+ >>> mesh = lc.get_mesh("mesh-123")
146
+ >>> python_code = mesh.to_code()
147
+ >>> print(python_code)
148
+ """
149
+ req = meshpb.GetMeshGenerationSdkCodeRequest(id=self.id)
150
+ res: meshpb.GetMeshGenerationSdkCodeResponse = (
151
+ get_default_client().GetMeshGenerationSdkCode(req)
152
+ )
153
+ return res.sdk_code
154
+
139
155
 
140
156
  def get_mesh(id: MeshID) -> Mesh:
141
157
  """
@@ -1776,6 +1776,9 @@ class DirectionSpecification(_IntEnum):
1776
1776
  Impose a flow direction normal to the inlet boundary toward the interior of the domain.
1777
1777
  DIRECTION_VECTOR
1778
1778
  Specify a vector for the inlet flow direction.
1779
+ CYLINDRICAL_DIRECTIONS
1780
+ Specify the inlet flow direction in a cylindrical coordinate system whose main axis
1781
+ is defined by the z axis of the inlet frame.
1779
1782
 
1780
1783
 
1781
1784
  Examples
@@ -1783,11 +1786,37 @@ class DirectionSpecification(_IntEnum):
1783
1786
  >>> from luminarycloud.params.enum import DirectionSpecification
1784
1787
  >>> DirectionSpecification.NORMAL_TO_BOUNDARY
1785
1788
  >>> DirectionSpecification.DIRECTION_VECTOR
1789
+ >>> DirectionSpecification.CYLINDRICAL_DIRECTIONS
1786
1790
  """
1787
1791
 
1788
1792
  INVALID = _clientpb.INVALID_DIRECTION_SPECIFICATION
1789
1793
  NORMAL_TO_BOUNDARY = _clientpb.NORMAL_TO_BOUNDARY
1790
1794
  DIRECTION_VECTOR = _clientpb.DIRECTION_VECTOR
1795
+ CYLINDRICAL_DIRECTIONS = _clientpb.CYLINDRICAL_DIRECTIONS
1796
+
1797
+
1798
+ class DirectionFrame(_IntEnum):
1799
+ """
1800
+ Frame used to define the flow direction.
1801
+
1802
+ Attributes
1803
+ ----------
1804
+ DIRECTION_FRAME_GLOBAL
1805
+ The direction vectors are defined by the global frame.
1806
+ DIRECTION_FRAME_BOUNDARY
1807
+ The direction vectors are defined by the frame to which the boundary surfaces are attached.
1808
+
1809
+
1810
+ Examples
1811
+ --------
1812
+ >>> from luminarycloud.params.enum import DirectionFrame
1813
+ >>> DirectionFrame.DIRECTION_FRAME_GLOBAL
1814
+ >>> DirectionFrame.DIRECTION_FRAME_BOUNDARY
1815
+ """
1816
+
1817
+ INVALID = _clientpb.INVALID_DIRECTION_FRAME
1818
+ DIRECTION_FRAME_GLOBAL = _clientpb.DIRECTION_FRAME_GLOBAL
1819
+ DIRECTION_FRAME_BOUNDARY = _clientpb.DIRECTION_FRAME_BOUNDARY
1791
1820
 
1792
1821
 
1793
1822
  class OutletPressureConstraint(_IntEnum):
@@ -32,7 +32,7 @@ class FanCurveInlet(Inlet):
32
32
  )
33
33
  "Method of defining the flow direction at the inlet."
34
34
  direction: Vector3 = field(default_factory=lambda: Vector3(1.0, 0.0, 0.0))
35
- "Vector (x,y,z) defining the flow direction. Automatically scaled to a unit vector internally."
35
+ "Vector (x,y,z) or (ρ,φ,z) defining the flow direction. Automatically scaled to a unit vector internally."
36
36
  fan_curve_table: RectilinearTable | None = None
37
37
  "Correlation between fan pressure rise and volume flow rate."
38
38
  head_loss_coefficient: LcFloat = 0.0
@@ -33,8 +33,10 @@ class MachInlet(Inlet):
33
33
  enum.DirectionSpecification.NORMAL_TO_BOUNDARY
34
34
  )
35
35
  "Method of defining the flow direction at the inlet."
36
+ direction_frame: enum.DirectionFrame = enum.DirectionFrame.DIRECTION_FRAME_GLOBAL
37
+ "Frame used to define the flow direction."
36
38
  direction: Vector3 = field(default_factory=lambda: Vector3(1.0, 0.0, 0.0))
37
- "Vector (x,y,z) defining the flow direction. Automatically scaled to a unit vector internally."
39
+ "Vector (x,y,z) or (ρ,φ,z) defining the flow direction. Automatically scaled to a unit vector internally."
38
40
 
39
41
  def _to_proto(self) -> clientpb.BoundaryConditionsFluid:
40
42
  _proto = super()._to_proto()
@@ -42,6 +44,7 @@ class MachInlet(Inlet):
42
44
  _proto.farfield_mach_number.CopyFrom(_to_ad_proto(self.mach_number))
43
45
  _proto.farfield_pressure.CopyFrom(_to_ad_proto(self.pressure))
44
46
  _proto.direction_specification = self.direction_specification.value
47
+ _proto.direction_frame = self.direction_frame.value
45
48
  _proto.flow_direction.CopyFrom(self.direction._to_ad_proto())
46
49
  return _proto
47
50
 
@@ -51,5 +54,6 @@ class MachInlet(Inlet):
51
54
  self.mach_number = _from_ad_proto(proto.farfield_mach_number)
52
55
  self.pressure = _from_ad_proto(proto.farfield_pressure)
53
56
  self.direction_specification = enum.DirectionSpecification(proto.direction_specification)
57
+ self.direction_frame = enum.DirectionFrame(proto.direction_frame)
54
58
  self.direction._from_ad_proto(proto.flow_direction)
55
59
  return None
@@ -31,14 +31,17 @@ class MassFlowInlet(Inlet):
31
31
  enum.DirectionSpecification.NORMAL_TO_BOUNDARY
32
32
  )
33
33
  "Method of defining the flow direction at the inlet."
34
+ direction_frame: enum.DirectionFrame = enum.DirectionFrame.DIRECTION_FRAME_GLOBAL
35
+ "Frame used to define the flow direction."
34
36
  direction: Vector3 = field(default_factory=lambda: Vector3(1.0, 0.0, 0.0))
35
- "Vector (x,y,z) defining the flow direction. Automatically scaled to a unit vector internally."
37
+ "Vector (x,y,z) or (ρ,φ,z) defining the flow direction. Automatically scaled to a unit vector internally."
36
38
 
37
39
  def _to_proto(self) -> clientpb.BoundaryConditionsFluid:
38
40
  _proto = super()._to_proto()
39
41
  _proto.inlet_momentum = clientpb.InletMomentum.MASS_FLOW_INLET
40
42
  _proto.mass_flow_rate.CopyFrom(_to_ad_proto(self.mass_flow_rate))
41
43
  _proto.direction_specification = self.direction_specification.value
44
+ _proto.direction_frame = self.direction_frame.value
42
45
  _proto.flow_direction.CopyFrom(self.direction._to_ad_proto())
43
46
  return _proto
44
47
 
@@ -47,5 +50,6 @@ class MassFlowInlet(Inlet):
47
50
  assert proto.inlet_momentum == clientpb.InletMomentum.MASS_FLOW_INLET
48
51
  self.mass_flow_rate = _from_ad_proto(proto.mass_flow_rate)
49
52
  self.direction_specification = enum.DirectionSpecification(proto.direction_specification)
53
+ self.direction_frame = enum.DirectionFrame(proto.direction_frame)
50
54
  self.direction._from_ad_proto(proto.flow_direction)
51
55
  return None
@@ -33,8 +33,10 @@ class TotalPressureInlet(Inlet):
33
33
  enum.DirectionSpecification.NORMAL_TO_BOUNDARY
34
34
  )
35
35
  "Method of defining the flow direction at the inlet."
36
+ direction_frame: enum.DirectionFrame = enum.DirectionFrame.DIRECTION_FRAME_GLOBAL
37
+ "Frame used to define the flow direction."
36
38
  direction: Vector3 = field(default_factory=lambda: Vector3(1.0, 0.0, 0.0))
37
- "Vector (x,y,z) defining the flow direction. Automatically scaled to a unit vector internally."
39
+ "Vector (x,y,z) or (ρ,φ,z) defining the flow direction. Automatically scaled to a unit vector internally."
38
40
 
39
41
  def _to_proto(self) -> clientpb.BoundaryConditionsFluid:
40
42
  _proto = super()._to_proto()
@@ -42,6 +44,7 @@ class TotalPressureInlet(Inlet):
42
44
  _proto.total_pressure.CopyFrom(_to_ad_proto(self.total_pressure))
43
45
  _proto.total_pressure_col.value = self.total_pressure_column_index
44
46
  _proto.direction_specification = self.direction_specification.value
47
+ _proto.direction_frame = self.direction_frame.value
45
48
  _proto.flow_direction.CopyFrom(self.direction._to_ad_proto())
46
49
  return _proto
47
50
 
@@ -51,5 +54,6 @@ class TotalPressureInlet(Inlet):
51
54
  self.total_pressure = _from_ad_proto(proto.total_pressure)
52
55
  self.total_pressure_column_index = proto.total_pressure_col.value
53
56
  self.direction_specification = enum.DirectionSpecification(proto.direction_specification)
57
+ self.direction_frame = enum.DirectionFrame(proto.direction_frame)
54
58
  self.direction._from_ad_proto(proto.flow_direction)
55
59
  return None
@@ -33,8 +33,10 @@ class VelocityMagnitudeInlet(Inlet):
33
33
  enum.DirectionSpecification.NORMAL_TO_BOUNDARY
34
34
  )
35
35
  "Method of defining the flow direction at the inlet."
36
+ direction_frame: enum.DirectionFrame = enum.DirectionFrame.DIRECTION_FRAME_GLOBAL
37
+ "Frame used to define the flow direction."
36
38
  direction: Vector3 = field(default_factory=lambda: Vector3(1.0, 0.0, 0.0))
37
- "Vector (x,y,z) defining the flow direction. Automatically scaled to a unit vector internally."
39
+ "Vector (x,y,z) or (ρ,φ,z) defining the flow direction. Automatically scaled to a unit vector internally."
38
40
  pressure: LcFloat = 101325
39
41
  "Static pressure at the boundary relative to the material reference pressure."
40
42
 
@@ -44,6 +46,7 @@ class VelocityMagnitudeInlet(Inlet):
44
46
  _proto.inlet_velocity_magnitude.CopyFrom(_to_ad_proto(self.velocity))
45
47
  _proto.inlet_velocity_magnitude_col.value = self.velocity_column_index
46
48
  _proto.direction_specification = self.direction_specification.value
49
+ _proto.direction_frame = self.direction_frame.value
47
50
  _proto.flow_direction.CopyFrom(self.direction._to_ad_proto())
48
51
  _proto.farfield_pressure.CopyFrom(_to_ad_proto(self.pressure))
49
52
  return _proto
@@ -54,6 +57,7 @@ class VelocityMagnitudeInlet(Inlet):
54
57
  self.velocity = _from_ad_proto(proto.inlet_velocity_magnitude)
55
58
  self.velocity_column_index = proto.inlet_velocity_magnitude_col.value
56
59
  self.direction_specification = enum.DirectionSpecification(proto.direction_specification)
60
+ self.direction_frame = enum.DirectionFrame(proto.direction_frame)
57
61
  self.direction._from_ad_proto(proto.flow_direction)
58
62
  self.pressure = _from_ad_proto(proto.farfield_pressure)
59
63
  return None
@@ -1,8 +1,8 @@
1
1
  # File: python/sdk/luminarycloud/inference/inference.py
2
2
  # Copyright 2025 Luminary Cloud, Inc. All Rights Reserved.
3
3
  from datetime import datetime
4
- from typing import Any, Callable
5
- from json import loads as json_loads
4
+ from typing import Any, Callable, Dict, Optional
5
+ from json import loads as json_loads, dumps as json_dumps
6
6
  from dataclasses import dataclass
7
7
  import base64
8
8
  import os
@@ -48,7 +48,11 @@ class ExtAeroInferenceResult:
48
48
 
49
49
 
50
50
  def external_aero_inference(
51
- project: Project, stl_file: str, checkpoint_file: str, config_name: str, stencil_size: int
51
+ project: Project,
52
+ stl_file: str,
53
+ artifact_url: str,
54
+ parameters: Optional[Dict[str, Any]] = None,
55
+ stencil_size: int = 1,
52
56
  ) -> ExtAeroInferenceResult:
53
57
  """Performs an inference job returning external aerodynamic results.
54
58
  Parameters
@@ -57,12 +61,12 @@ def external_aero_inference(
57
61
  The project to which the inference files will be added.
58
62
  stl_file : str
59
63
  Fullpath the STL file to be used for inference.
60
- checkpoint_file : str
61
- Fullpath of the model to be used for inference.
62
- config_name :str
63
- Name of the configuration to be used for inference.
64
- stencil_size :int
65
- Size of the stencil to be used for inference.
64
+ artifact_url : str
65
+ Fullpath of the model artifact directory to be used for inference.
66
+ parameters : Dict[str, Any], optional
67
+ Dictionary of parameters to be passed to the inference service (e.g., alpha, beta, etc.).
68
+ stencil_size : int, optional
69
+ Size of the stencil to be used for inference. Defaults to 1.
66
70
 
67
71
  Returns
68
72
  ExtAeroInferenceResult
@@ -71,12 +75,16 @@ def external_aero_inference(
71
75
  warning:: This feature is experimental and may change or be removed without notice.
72
76
  """
73
77
 
74
- result = perform_inference(project, stl_file, checkpoint_file, config_name, stencil_size)
78
+ result = perform_inference(project, stl_file, artifact_url, parameters, stencil_size)
75
79
  return ExtAeroInferenceResult(result)
76
80
 
77
81
 
78
82
  def perform_inference(
79
- project: Project, stl_file: str, checkpoint_file: str, config_name: str, stencil_size: int
83
+ project: Project,
84
+ stl_file: str,
85
+ artifact_url: str,
86
+ parameters: Optional[Dict[str, Any]] = None,
87
+ stencil_size: int = 1,
80
88
  ) -> dict[str, Any]:
81
89
  """Creates an inference service job.
82
90
  Parameters
@@ -85,12 +93,12 @@ def perform_inference(
85
93
  The project to which the inference files will be added.
86
94
  stl_file : str
87
95
  Fullpath the STL file to be used for inference.
88
- checkpoint_file : str
89
- Fullpath of the model to be used for inference.
90
- config_name :str
91
- Name of the configuration to be used for inference.
92
- stencil_size :int
93
- Size of the stencil to be used for inference.
96
+ artifact_url : str
97
+ Fullpath of the model artifact directory to be used for inference.
98
+ parameters : Dict[str, Any], optional
99
+ Dictionary of parameters to be passed to the inference service (e.g., alpha, beta, etc.).
100
+ stencil_size : int, optional
101
+ Size of the stencil to be used for inference. Defaults to 1.
94
102
 
95
103
 
96
104
  Returns
@@ -123,9 +131,8 @@ def perform_inference(
123
131
  return download_file
124
132
 
125
133
  stl_url = upload_if_file(stl_file)
126
- check_url = upload_if_file(checkpoint_file)
127
134
 
128
- raw = start_inference_job(project, stl_url, check_url, config_name, stencil_size)
135
+ raw = start_inference_job(project, stl_url, artifact_url, parameters, stencil_size)
129
136
  currated: dict[str, Any] = {}
130
137
  for k, v in raw.items():
131
138
  if isinstance(v, str) and v.startswith("https://"):
@@ -144,9 +151,10 @@ def perform_inference(
144
151
  def start_inference_job(
145
152
  project: Project,
146
153
  stl_url: str,
147
- checkpoint_url: str,
148
- config_name: str,
149
- stencil_size: int,
154
+ artifact_url: str,
155
+ parameters: Optional[Dict[str, Any]] = None,
156
+ stencil_size: int = 1,
157
+ write_visualization_data=False,
150
158
  ) -> dict[str, Any]:
151
159
  """Creates an inference service job.
152
160
  Parameters
@@ -155,12 +163,14 @@ def start_inference_job(
155
163
  Reference to a project.
156
164
  stl_url : str
157
165
  URL of the STL file to be used for inference.
158
- checkpoint_url : str
159
- URL of the model to be used for inference.
160
- config_name :str
161
- Name of the configuration to be used for inference.
162
- stencil_size :int
163
- Size of the stencil to be used for inference.
166
+ artifact_url : str
167
+ URL of the model artifact directory to be used for inference.
168
+ parameters : Dict[str, Any], optional
169
+ Dictionary of parameters to be passed to the inference service (e.g., alpha, beta, etc.).
170
+ stencil_size : int, optional
171
+ Size of the stencil to be used for inference. Defaults to 1.
172
+ write_visualization_data : bool, optional
173
+ Whether to write LC render data for visualization by Luminary.
164
174
 
165
175
 
166
176
  Returns
@@ -170,12 +180,18 @@ def start_inference_job(
170
180
  warning:: This feature is experimental and may change or be removed without notice.
171
181
  """
172
182
 
183
+ # Convert parameters dict to bytes if provided
184
+ parameters_bytes = b""
185
+ if parameters is not None:
186
+ parameters_bytes = json_dumps(parameters).encode("utf-8")
187
+
173
188
  req = inferencepb.CreateInferenceServiceJobRequest(
174
189
  stl_url=stl_url,
175
- checkpoint_url=checkpoint_url,
176
- config_name=config_name,
190
+ artifact_url=artifact_url,
191
+ parameters=parameters_bytes,
177
192
  stencil_size=stencil_size,
178
193
  project_id=project.id,
194
+ write_visualization_data=write_visualization_data,
179
195
  )
180
196
 
181
197
  res: inferencepb.CreateInferenceServiceJobResponse = (
@@ -33,3 +33,10 @@ from .arguments import (
33
33
  PipelineArgs as PipelineArgs,
34
34
  ArgNamedVariableSet as ArgNamedVariableSet,
35
35
  )
36
+
37
+ from .api import (
38
+ create_pipeline as create_pipeline,
39
+ list_pipelines as list_pipelines,
40
+ get_pipeline as get_pipeline,
41
+ create_pipeline_job as create_pipeline_job,
42
+ )