metafold 0.12.dev0__py3-none-any.whl → 0.12.dev2__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.
@@ -244,6 +244,7 @@ def run_experiment(
244
244
  access_token: Optional[str] = None,
245
245
  base_url: str = "https://api.metafold3d.com/",
246
246
  credentials: Optional[dict] = None,
247
+ wait_for_results: bool = False,
247
248
  ) -> str:
248
249
  """Create and run a compression experiment from a config dict.
249
250
 
@@ -259,7 +260,12 @@ def run_experiment(
259
260
  - neither: CompressionSimulation reads credentials from the environment via
260
261
  dotenv (local / programmable use).
261
262
 
262
- Returns the Metafold project_id for the completed experiment.
263
+ By default this returns as soon as the simulation workflows have been
264
+ dispatched (after assets are uploaded and prep workflows finish); results
265
+ stay server-side. Pass wait_for_results=True to block until every
266
+ simulation finishes and download the results into output_path.
267
+
268
+ Returns the Metafold project_id for the experiment.
263
269
  """
264
270
  project_name = config.get("project_name", "")
265
271
  if not project_name:
@@ -283,9 +289,14 @@ def run_experiment(
283
289
  output_path=resolved_output_path,
284
290
  simulation_parameters=sim_params,
285
291
  project_id=project_id,
286
- project_name=project_name,
287
292
  create_project_if_needed=not bool(project_id),
288
293
  )
294
+ # Only pass project_name when we have to create a project. When a
295
+ # project_id is supplied the project already exists, and passing the name
296
+ # would keep the find-or-create-by-name path alive — risking a duplicate
297
+ # project. simulation_name (set above) drives UPS/result naming regardless.
298
+ if not project_id:
299
+ sim_kwargs["project_name"] = project_name
289
300
  if "workflow_steps" in config:
290
301
  sim_kwargs["workflow_steps"] = _build_workflow_steps(config["workflow_steps"])
291
302
 
@@ -309,6 +320,7 @@ def run_experiment(
309
320
  CompressionExperiment(
310
321
  simulation=sim,
311
322
  varying=varying,
323
+ auto_download_results=wait_for_results,
312
324
  )
313
325
 
314
326
  return sim.project_id
@@ -321,6 +333,7 @@ def run_experiment_from_zip(
321
333
  access_token: Optional[str] = None,
322
334
  base_url: str = "https://api.metafold3d.com/",
323
335
  credentials: Optional[dict] = None,
336
+ wait_for_results: bool = False,
324
337
  ) -> str:
325
338
  """Extract a zip containing experiment.json + mesh files and run the experiment.
326
339
 
@@ -334,7 +347,11 @@ def run_experiment_from_zip(
334
347
  access_token, when provided, is forwarded to run_experiment — see its
335
348
  docstring. When omitted, credentials are loaded from the environment.
336
349
 
337
- Returns the Metafold project_id for the completed experiment.
350
+ By default this returns once the simulation workflows are dispatched;
351
+ pass wait_for_results=True to block until they finish and download the
352
+ results into output_path (see run_experiment).
353
+
354
+ Returns the Metafold project_id for the experiment.
338
355
  """
339
356
  with tempfile.TemporaryDirectory() as tmp_dir:
340
357
  with ZipFile(zip_path) as zf:
@@ -352,4 +369,11 @@ def run_experiment_from_zip(
352
369
  if project_id:
353
370
  config["project_id"] = project_id
354
371
 
355
- return run_experiment(config, output_path=output_path, access_token=access_token, base_url=base_url, credentials=credentials)
372
+ return run_experiment(
373
+ config,
374
+ output_path=output_path,
375
+ access_token=access_token,
376
+ base_url=base_url,
377
+ credentials=credentials,
378
+ wait_for_results=wait_for_results,
379
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: metafold
3
- Version: 0.12.dev0
3
+ Version: 0.12.dev2
4
4
  Summary: Metafold SDK for Python
5
5
  Author-email: Metafold 3D <info@metafold3d.com>
6
6
  License: Copyright 2024 Metafold 3D
@@ -12,9 +12,9 @@ metafold/workflows.py,sha256=Mhv3n3ChUHw1Vaj3q8HNDbOgljn03AF6WslZfXzexsI,7802
12
12
  metafold/simulation/__init__.py,sha256=siIIJv3hjiHLohSztAZcMi0eePqEkc_K5Q8Azsf90d4,776
13
13
  metafold/simulation/compression_experiment.py,sha256=Dc7EKPAmKEZsNcH5vnKuj3dQcFFeh0hsus9CIA0Ycv4,14221
14
14
  metafold/simulation/compression_simulation.py,sha256=-amZGNGJthXI4zvFlYm9xdYPjRJue04JJu8Ra2QAfaE,97589
15
- metafold/simulation/run_experiment.py,sha256=O-HWPmgqCV0gUU0D4ts2wKCUcQ09IesHCKhxHqKlKAo,12593
16
- metafold-0.12.dev0.dist-info/licenses/LICENSE,sha256=LejZXzGwe9t0Ezk6g0bRmWUuFSI9vQSk1wJAc1NrrhE,1059
17
- metafold-0.12.dev0.dist-info/METADATA,sha256=kDRW11XZnc2BDJTa8-bm58Kv8rzIpOPJjwPPzUwLztU,3495
18
- metafold-0.12.dev0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
19
- metafold-0.12.dev0.dist-info/top_level.txt,sha256=0dvwa2N6gvl2x4T9c62V4MbYD2soFedI6hm3-lWgyew,9
20
- metafold-0.12.dev0.dist-info/RECORD,,
15
+ metafold/simulation/run_experiment.py,sha256=i-ZsYDYTbo-0EFXAjCqBvmA67b8VnRtLimGQNF76z8k,13647
16
+ metafold-0.12.dev2.dist-info/licenses/LICENSE,sha256=LejZXzGwe9t0Ezk6g0bRmWUuFSI9vQSk1wJAc1NrrhE,1059
17
+ metafold-0.12.dev2.dist-info/METADATA,sha256=I4rXO9-j762tHilLAHCvP1yYLYkgdCqfK2CTO4XFHNM,3495
18
+ metafold-0.12.dev2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
19
+ metafold-0.12.dev2.dist-info/top_level.txt,sha256=0dvwa2N6gvl2x4T9c62V4MbYD2soFedI6hm3-lWgyew,9
20
+ metafold-0.12.dev2.dist-info/RECORD,,