metafold 0.12.dev0__tar.gz → 0.12.dev1__tar.gz
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.
- {metafold-0.12.dev0 → metafold-0.12.dev1}/PKG-INFO +1 -1
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold/simulation/run_experiment.py +22 -3
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold.egg-info/PKG-INFO +1 -1
- {metafold-0.12.dev0 → metafold-0.12.dev1}/pyproject.toml +1 -1
- {metafold-0.12.dev0 → metafold-0.12.dev1}/tests/test_run_experiment.py +31 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/LICENSE +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/README.md +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold/__init__.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold/api.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold/assets.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold/auth.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold/client.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold/exceptions.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold/jobs.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold/materials.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold/projects.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold/simulation/__init__.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold/simulation/compression_experiment.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold/simulation/compression_simulation.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold/utils.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold/workflows.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold.egg-info/SOURCES.txt +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold.egg-info/dependency_links.txt +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold.egg-info/requires.txt +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/metafold.egg-info/top_level.txt +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/setup.cfg +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/tests/test_assets.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/tests/test_compession_experiment.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/tests/test_compression_simulation.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/tests/test_jobs.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/tests/test_projects.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/tests/test_utils.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev1}/tests/test_workflows.py +0 -0
|
@@ -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
|
-
|
|
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:
|
|
@@ -309,6 +315,7 @@ def run_experiment(
|
|
|
309
315
|
CompressionExperiment(
|
|
310
316
|
simulation=sim,
|
|
311
317
|
varying=varying,
|
|
318
|
+
auto_download_results=wait_for_results,
|
|
312
319
|
)
|
|
313
320
|
|
|
314
321
|
return sim.project_id
|
|
@@ -321,6 +328,7 @@ def run_experiment_from_zip(
|
|
|
321
328
|
access_token: Optional[str] = None,
|
|
322
329
|
base_url: str = "https://api.metafold3d.com/",
|
|
323
330
|
credentials: Optional[dict] = None,
|
|
331
|
+
wait_for_results: bool = False,
|
|
324
332
|
) -> str:
|
|
325
333
|
"""Extract a zip containing experiment.json + mesh files and run the experiment.
|
|
326
334
|
|
|
@@ -334,7 +342,11 @@ def run_experiment_from_zip(
|
|
|
334
342
|
access_token, when provided, is forwarded to run_experiment — see its
|
|
335
343
|
docstring. When omitted, credentials are loaded from the environment.
|
|
336
344
|
|
|
337
|
-
|
|
345
|
+
By default this returns once the simulation workflows are dispatched;
|
|
346
|
+
pass wait_for_results=True to block until they finish and download the
|
|
347
|
+
results into output_path (see run_experiment).
|
|
348
|
+
|
|
349
|
+
Returns the Metafold project_id for the experiment.
|
|
338
350
|
"""
|
|
339
351
|
with tempfile.TemporaryDirectory() as tmp_dir:
|
|
340
352
|
with ZipFile(zip_path) as zf:
|
|
@@ -352,4 +364,11 @@ def run_experiment_from_zip(
|
|
|
352
364
|
if project_id:
|
|
353
365
|
config["project_id"] = project_id
|
|
354
366
|
|
|
355
|
-
return run_experiment(
|
|
367
|
+
return run_experiment(
|
|
368
|
+
config,
|
|
369
|
+
output_path=output_path,
|
|
370
|
+
access_token=access_token,
|
|
371
|
+
base_url=base_url,
|
|
372
|
+
credentials=credentials,
|
|
373
|
+
wait_for_results=wait_for_results,
|
|
374
|
+
)
|
|
@@ -414,6 +414,37 @@ class TestRunExperiment:
|
|
|
414
414
|
|
|
415
415
|
assert captured["output_path"] == str(tmp_path / "actual")
|
|
416
416
|
|
|
417
|
+
def test_does_not_wait_for_results_by_default(self, ply_folder, tmp_path):
|
|
418
|
+
fake_sim = self._fake_sim(ply_folder)
|
|
419
|
+
with (
|
|
420
|
+
patch("metafold.simulation.run_experiment.CompressionSimulation", return_value=fake_sim),
|
|
421
|
+
patch("metafold.simulation.run_experiment.CompressionExperiment") as mock_exp_cls,
|
|
422
|
+
):
|
|
423
|
+
run_experiment({
|
|
424
|
+
"project_name": "t",
|
|
425
|
+
"output_path": str(tmp_path / "out"),
|
|
426
|
+
"parts": [],
|
|
427
|
+
})
|
|
428
|
+
|
|
429
|
+
assert mock_exp_cls.call_args.kwargs["auto_download_results"] is False
|
|
430
|
+
|
|
431
|
+
def test_wait_for_results_downloads(self, ply_folder, tmp_path):
|
|
432
|
+
fake_sim = self._fake_sim(ply_folder)
|
|
433
|
+
with (
|
|
434
|
+
patch("metafold.simulation.run_experiment.CompressionSimulation", return_value=fake_sim),
|
|
435
|
+
patch("metafold.simulation.run_experiment.CompressionExperiment") as mock_exp_cls,
|
|
436
|
+
):
|
|
437
|
+
run_experiment(
|
|
438
|
+
{
|
|
439
|
+
"project_name": "t",
|
|
440
|
+
"output_path": str(tmp_path / "out"),
|
|
441
|
+
"parts": [],
|
|
442
|
+
},
|
|
443
|
+
wait_for_results=True,
|
|
444
|
+
)
|
|
445
|
+
|
|
446
|
+
assert mock_exp_cls.call_args.kwargs["auto_download_results"] is True
|
|
447
|
+
|
|
417
448
|
|
|
418
449
|
class TestRunExperimentFromZip:
|
|
419
450
|
def _make_zip(self, tmp_path, manifest: dict, mesh_files: list[str] = None) -> Path:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|