metafold 0.12.dev0__tar.gz → 0.12.dev2__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.dev2}/PKG-INFO +1 -1
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold/simulation/run_experiment.py +28 -4
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold.egg-info/PKG-INFO +1 -1
- {metafold-0.12.dev0 → metafold-0.12.dev2}/pyproject.toml +1 -1
- {metafold-0.12.dev0 → metafold-0.12.dev2}/tests/test_run_experiment.py +31 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/LICENSE +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/README.md +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold/__init__.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold/api.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold/assets.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold/auth.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold/client.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold/exceptions.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold/jobs.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold/materials.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold/projects.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold/simulation/__init__.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold/simulation/compression_experiment.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold/simulation/compression_simulation.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold/utils.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold/workflows.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold.egg-info/SOURCES.txt +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold.egg-info/dependency_links.txt +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold.egg-info/requires.txt +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/metafold.egg-info/top_level.txt +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/setup.cfg +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/tests/test_assets.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/tests/test_compession_experiment.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/tests/test_compression_simulation.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/tests/test_jobs.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/tests/test_projects.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/tests/test_utils.py +0 -0
- {metafold-0.12.dev0 → metafold-0.12.dev2}/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:
|
|
@@ -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
|
-
|
|
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(
|
|
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
|
+
)
|
|
@@ -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
|