flamapy 2.9.0.dev1__py3-none-any.whl → 2.9.0.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.
- flamapy/interfaces/python/flamapy_feature_model.py +38 -17
- {flamapy-2.9.0.dev1.dist-info → flamapy-2.9.0.dev2.dist-info}/METADATA +12 -12
- {flamapy-2.9.0.dev1.dist-info → flamapy-2.9.0.dev2.dist-info}/RECORD +7 -7
- {flamapy-2.9.0.dev1.dist-info → flamapy-2.9.0.dev2.dist-info}/WHEEL +0 -0
- {flamapy-2.9.0.dev1.dist-info → flamapy-2.9.0.dev2.dist-info}/entry_points.txt +0 -0
- {flamapy-2.9.0.dev1.dist-info → flamapy-2.9.0.dev2.dist-info}/licenses/LICENSE +0 -0
- {flamapy-2.9.0.dev1.dist-info → flamapy-2.9.0.dev2.dist-info}/top_level.txt +0 -0
|
@@ -63,6 +63,19 @@ class Backend(str, Enum):
|
|
|
63
63
|
# Facade backend name -> fm-to-backend transformation extension (the only non-identity mapping).
|
|
64
64
|
_BACKEND_ALIAS = {"sat": "pysat"}
|
|
65
65
|
|
|
66
|
+
# The solver libraries are not thread-safe: Z3 shares one global context, and dd parses
|
|
67
|
+
# every BDD expression with one module-level parser, so two threads building or querying the
|
|
68
|
+
# same kind of backend model corrupt each other (wrong results, or a crash of the whole
|
|
69
|
+
# interpreter). One process-wide lock per backend serialises that work; jobs on different
|
|
70
|
+
# backends still run concurrently.
|
|
71
|
+
_BACKEND_LOCKS: Dict[str, threading.RLock] = {}
|
|
72
|
+
_BACKEND_LOCKS_GUARD = threading.Lock()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _backend_lock(extension: str) -> threading.RLock:
|
|
76
|
+
with _BACKEND_LOCKS_GUARD:
|
|
77
|
+
return _BACKEND_LOCKS.setdefault(extension, threading.RLock())
|
|
78
|
+
|
|
66
79
|
# Operations that ran on a fixed backend in 2.6 and accept ``backend=`` since 2.9. In 2.x only a
|
|
67
80
|
# per-call ``backend=`` changes them: the workspace default and FLAMAPY_BACKEND do not, so code
|
|
68
81
|
# that set a default backend in 2.6 keeps the same results (the default would otherwise move
|
|
@@ -266,10 +279,15 @@ class FLAMAFeatureModel:
|
|
|
266
279
|
def _backend_model(self, extension: str) -> VariabilityModel:
|
|
267
280
|
if extension == self.fm_model.get_extension():
|
|
268
281
|
return self.fm_model
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
282
|
+
return self._transformed(self.fm_model, extension)
|
|
283
|
+
|
|
284
|
+
def _transformed(self, source: VariabilityModel, extension: str) -> VariabilityModel:
|
|
285
|
+
"""The cached ``extension`` model, built from ``source`` once even under concurrency."""
|
|
286
|
+
with _backend_lock(extension):
|
|
287
|
+
if extension not in self._backend_models:
|
|
288
|
+
self._backend_models[extension] = (
|
|
289
|
+
self.discover_metamodel.use_transformation_m2m(source, extension))
|
|
290
|
+
return self._backend_models[extension]
|
|
273
291
|
|
|
274
292
|
def _language_level(self) -> LanguageLevel:
|
|
275
293
|
if self._model_language_level is None:
|
|
@@ -326,10 +344,7 @@ class FLAMAFeatureModel:
|
|
|
326
344
|
route = dataclasses.replace(route, planner=f'auto: {chosen.rationale}')
|
|
327
345
|
model = self.fm_model
|
|
328
346
|
for _, destination in chosen.transformation_chain:
|
|
329
|
-
|
|
330
|
-
self._backend_models[destination] = (
|
|
331
|
-
self.discover_metamodel.use_transformation_m2m(model, destination))
|
|
332
|
-
model = self._backend_models[destination]
|
|
347
|
+
model = self._transformed(model, destination)
|
|
333
348
|
return model, route
|
|
334
349
|
|
|
335
350
|
def _prepare_operation(
|
|
@@ -377,10 +392,11 @@ class FLAMAFeatureModel:
|
|
|
377
392
|
descriptor, backend_arg, call_kwargs, allow_approximate)
|
|
378
393
|
# The hash is always the source feature model's (memoized there), whichever
|
|
379
394
|
# backend model the operation actually runs on.
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
395
|
+
with _backend_lock(model.get_extension()):
|
|
396
|
+
envelope = run_and_wrap(
|
|
397
|
+
operation, model,
|
|
398
|
+
operation_name=descriptor.name, plugin=self._plugin_name_for(model),
|
|
399
|
+
model_hash=self.fm_model.canonical_hash())
|
|
384
400
|
if descriptor.result_adapter is not None:
|
|
385
401
|
envelope = dataclasses.replace(
|
|
386
402
|
envelope, value=descriptor.result_adapter(envelope.value))
|
|
@@ -441,10 +457,14 @@ class FLAMAFeatureModel:
|
|
|
441
457
|
f"'{descriptor.name}' was cancelled before execution started.")
|
|
442
458
|
if isinstance(prepared, Interruptible):
|
|
443
459
|
prepared.set_interrupt_event(interrupt_event)
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
460
|
+
with _backend_lock(model.get_extension()):
|
|
461
|
+
if interrupt_event.is_set(): # gave up while waiting for the backend
|
|
462
|
+
raise OperationTimeout(
|
|
463
|
+
f"'{descriptor.name}' was cancelled before execution started.")
|
|
464
|
+
envelope = run_and_wrap(
|
|
465
|
+
prepared, model,
|
|
466
|
+
operation_name=descriptor.name, plugin=self._plugin_name_for(model),
|
|
467
|
+
model_hash=self.fm_model.canonical_hash())
|
|
448
468
|
return _stamp(envelope, job_route, model)
|
|
449
469
|
|
|
450
470
|
return default_engine().submit_call(task, result_adapter=descriptor.result_adapter)
|
|
@@ -461,7 +481,8 @@ class FLAMAFeatureModel:
|
|
|
461
481
|
operation, model, _ = self._prepare_operation(descriptor, backend or 'sat', {})
|
|
462
482
|
if isinstance(operation, StreamingOperation):
|
|
463
483
|
return operation.iter_execute(model)
|
|
464
|
-
|
|
484
|
+
with _backend_lock(model.get_extension()):
|
|
485
|
+
operation.execute(model)
|
|
465
486
|
return iter(operation.get_result())
|
|
466
487
|
|
|
467
488
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flamapy
|
|
3
|
-
Version: 2.9.0.
|
|
3
|
+
Version: 2.9.0.dev2
|
|
4
4
|
Summary: Flamapy feature model is a distribution of the flama framework containing all plugins required to analyze feature models. It also offers a richer API and a complete command line interface and documentation.
|
|
5
5
|
Author-email: Flamapy <flamapy@us.es>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -8,21 +8,21 @@ Project-URL: Homepage, https://github.com/flamapy/flamapy-feature-model
|
|
|
8
8
|
Requires-Python: >=3.11
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
10
|
License-File: LICENSE
|
|
11
|
-
Requires-Dist: flamapy-fw~=2.9.0.
|
|
12
|
-
Requires-Dist: flamapy-fm~=2.9.0.
|
|
13
|
-
Requires-Dist: flamapy-sat~=2.9.0.
|
|
14
|
-
Requires-Dist: flamapy-bdd~=2.9.0.
|
|
15
|
-
Requires-Dist: flamapy-z3~=2.9.0.
|
|
11
|
+
Requires-Dist: flamapy-fw~=2.9.0.dev2
|
|
12
|
+
Requires-Dist: flamapy-fm~=2.9.0.dev2
|
|
13
|
+
Requires-Dist: flamapy-sat~=2.9.0.dev2
|
|
14
|
+
Requires-Dist: flamapy-bdd~=2.9.0.dev2
|
|
15
|
+
Requires-Dist: flamapy-z3~=2.9.0.dev2
|
|
16
16
|
Provides-Extra: sharpsat
|
|
17
|
-
Requires-Dist: flamapy-sharpsat~=2.9.0.
|
|
17
|
+
Requires-Dist: flamapy-sharpsat~=2.9.0.dev2; extra == "sharpsat"
|
|
18
18
|
Provides-Extra: dnnf
|
|
19
|
-
Requires-Dist: flamapy-dnnf~=2.9.0.
|
|
19
|
+
Requires-Dist: flamapy-dnnf~=2.9.0.dev2; extra == "dnnf"
|
|
20
20
|
Provides-Extra: sdd
|
|
21
|
-
Requires-Dist: flamapy-sdd~=2.9.0.
|
|
21
|
+
Requires-Dist: flamapy-sdd~=2.9.0.dev2; extra == "sdd"
|
|
22
22
|
Provides-Extra: all-solvers
|
|
23
|
-
Requires-Dist: flamapy-sharpsat~=2.9.0.
|
|
24
|
-
Requires-Dist: flamapy-dnnf~=2.9.0.
|
|
25
|
-
Requires-Dist: flamapy-sdd~=2.9.0.
|
|
23
|
+
Requires-Dist: flamapy-sharpsat~=2.9.0.dev2; extra == "all-solvers"
|
|
24
|
+
Requires-Dist: flamapy-dnnf~=2.9.0.dev2; extra == "all-solvers"
|
|
25
|
+
Requires-Dist: flamapy-sdd~=2.9.0.dev2; extra == "all-solvers"
|
|
26
26
|
Provides-Extra: dev
|
|
27
27
|
Requires-Dist: pytest; extra == "dev"
|
|
28
28
|
Requires-Dist: pytest-mock; extra == "dev"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
flamapy/commands/__init__.py,sha256=DdRS2Xyt37H_k2YaaFWUcE6xfJALzllraerIup1l_OU,14646
|
|
2
2
|
flamapy/interfaces/python/__init__.py,sha256=NVQH1l6O9ElD8YvUVBXJN0Y_ETmu3AbyQBZJJ9qiuoU,86
|
|
3
3
|
flamapy/interfaces/python/_stub.py,sha256=7JMmnmxHFbpC7XHVqozZUooLwPbHS4p1-B8QXH5wQf8,3898
|
|
4
|
-
flamapy/interfaces/python/flamapy_feature_model.py,sha256=
|
|
4
|
+
flamapy/interfaces/python/flamapy_feature_model.py,sha256=m_aPkDi_B11789mHpJPLRws1vKB3PLPAfAtiQGICcdY,29902
|
|
5
5
|
flamapy/interfaces/python/flamapy_feature_model.pyi,sha256=u-GtNc1wRslPO1I2sIIsNuOxrdT-dR0GZpqzyskHT34,6189
|
|
6
|
-
flamapy-2.9.0.
|
|
7
|
-
flamapy-2.9.0.
|
|
8
|
-
flamapy-2.9.0.
|
|
9
|
-
flamapy-2.9.0.
|
|
10
|
-
flamapy-2.9.0.
|
|
11
|
-
flamapy-2.9.0.
|
|
6
|
+
flamapy-2.9.0.dev2.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
7
|
+
flamapy-2.9.0.dev2.dist-info/METADATA,sha256=LP-2mlXxcwWaCu1wNCIN7h20Gq9fonomlp7eYBjYwfI,1731
|
|
8
|
+
flamapy-2.9.0.dev2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
9
|
+
flamapy-2.9.0.dev2.dist-info/entry_points.txt,sha256=CS_W4K9LW9xOf-7ymWD58KklNHBnhMHm0RXAZ9JLgVo,57
|
|
10
|
+
flamapy-2.9.0.dev2.dist-info/top_level.txt,sha256=2YBI9dg4GVk28AJuyNu6dldi5Riwt5SP0zpNe2lSU5M,8
|
|
11
|
+
flamapy-2.9.0.dev2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|