mirror of
https://github.com/zama-ai/concrete.git
synced 2026-04-17 03:00:54 -04:00
feat(frontend-python): support ctrl+c during compilation and key generation
This commit is contained in:
@@ -11,6 +11,7 @@ from typing import Optional, Union
|
||||
from concrete.compiler import ClientSupport, EvaluationKeys, KeySet, KeySetCache
|
||||
|
||||
from .specs import ClientSpecs
|
||||
from .utils import interruptable_native_call
|
||||
|
||||
# pylint: enable=import-error,no-name-in-module
|
||||
|
||||
@@ -64,11 +65,13 @@ class Keys:
|
||||
seed_msb = (seed >> 64) & ((2**64) - 1)
|
||||
|
||||
if self._keyset is None or force:
|
||||
self._keyset = ClientSupport.key_set(
|
||||
self.client_specs.client_parameters,
|
||||
self._keyset_cache,
|
||||
seed_msb,
|
||||
seed_lsb,
|
||||
self._keyset = interruptable_native_call(
|
||||
lambda: ClientSupport.key_set(
|
||||
self.client_specs.client_parameters,
|
||||
self._keyset_cache,
|
||||
seed_msb,
|
||||
seed_lsb,
|
||||
)
|
||||
)
|
||||
|
||||
def save(self, location: Union[str, Path]):
|
||||
|
||||
@@ -147,7 +147,7 @@ class Server:
|
||||
output_dir = None
|
||||
|
||||
support = JITSupport.new()
|
||||
compilation_result = support.compile(mlir, options)
|
||||
compilation_result = interruptable_native_call(lambda: support.compile(mlir, options))
|
||||
server_lambda = support.load_server_lambda(compilation_result)
|
||||
|
||||
else:
|
||||
@@ -159,7 +159,7 @@ class Server:
|
||||
support = LibrarySupport.new(
|
||||
str(output_dir_path), generateCppHeader=False, generateStaticLib=False
|
||||
)
|
||||
compilation_result = support.compile(mlir, options)
|
||||
compilation_result = interruptable_native_call(lambda: support.compile(mlir, options))
|
||||
server_lambda = support.load_server_lambda(compilation_result)
|
||||
|
||||
client_parameters = support.load_client_parameters(compilation_result)
|
||||
|
||||
Reference in New Issue
Block a user