qdk_chemistry.remote package
Remote execution and result caching for QDK/Chemistry algorithms.
Algorithms created through the registry accept remote and cache
keyword arguments on run().
- Usage:
>>> from qdk_chemistry.algorithms import create >>> from qdk_chemistry.remote import create_remote >>> >>> scf = create("scf_solver") >>> backend = create_remote("local") >>> backend.connect() >>> try: ... energy, wfn = scf.run(structure, 0, 1, "cc-pvdz", remote=backend) ... finally: ... backend.disconnect()
- qdk_chemistry.remote.available_backends()
Return list of registered backend names.
- qdk_chemistry.remote.create_remote(name, **config)
Create a configured remote backend instance.
- Parameters:
name (
str) – Backend name (e.g., “custom” or “local”)**config – Backend-specific configuration options.
- Return type:
- Returns:
Configured RemoteBackend instance ready for use
Examples
>>> from qdk_chemistry.remote import create_remote >>> from qdk_chemistry.algorithms import create >>> >>> remote = create_remote("local", timeout=7200, poll_interval=10.0) >>> scf = create("scf_solver") >>> energy, wfn = scf.run(structure, 0, 1, "cc-pvdz", ... cache="./cache", remote=remote)
- qdk_chemistry.remote.get_backend(name, **config)
Create a backend instance by name.
- Parameters:
name (
str) – Backend name (e.g., “custom” or “local”)**config – Backend-specific configuration.
- Return type:
- Returns:
Configured RemoteBackend instance
- Raises:
ValueError – If no backend is registered with that name
- qdk_chemistry.remote.resolve_cache(cache, **kwargs)
Normalise a user-supplied cache argument.
Accepts any of the following:
NonereturnsNoneA
CacheBackendinstance → returned as-isA
Pathor path-like string →FolderCache(path=...)A registered name string → looked up in the registry; extra
kwargsare forwarded to the backend constructor.
- Parameters:
cache (
str|Path|CacheBackend|None) – Cache instance, registered backend name, filesystem path, orNone.**kwargs (
Any) – Backend-specific configuration for a name or filesystem path.
- Return type:
- qdk_chemistry.remote.run(algorithm, *args, cache=None, remote=None, force_rerun=False, _on_job_submitted=None, _owner=None, **kwargs)
Execute any algorithm with optional caching and remote backend.
Works with both Python and C++ algorithm implementations — anything with
run(),hash(),type_name(),name(), andsettings()methods.On a cache hit the result is returned immediately. On a miss the algorithm is executed (locally or via remote) and the result is stored. If a previous remote submission is still in-flight, polling resumes automatically — no duplicate submission.
- Parameters:
algorithm (
Any) – Any algorithm instance (fromcreate(...)).*args (
Any) – Positional arguments foralgorithm.run().cache (
Any) – Cache backend — aCacheBackend, a path (str/Path→FolderCache), orNone. For remote execution, complete caller-side records are cache hits whether or not the backend is shared. Shared backends are also used by the compute node as transport. ATieredCachecan combine local and shared backends.remote (
Any) – Remote backend name or instance, orNonefor local.force_rerun (
bool) – IfTrue, skip the cache lookup and re-execute, overwriting any previously cached result._on_job_submitted (
Callable[[Job],None] |None) – Internal callback invoked after a remote job handle is persisted to the local cache._owner (
dict[str,str|None] |None) – Internal workspace and project ownership for MCP-managed jobs.**kwargs (
Any) – Keyword arguments foralgorithm.run().
- Return type:
- Returns:
The algorithm result (e.g.
(energy, wavefunction)).
Examples:
# "scheduler" is provided by an installed plugin # Shared cache — both sides use the same backend shared = FolderCache("/mnt/shared/cache", is_shared=True) energy, wfn = run(scf, mol, 0, 1, "cc-pvdz", cache=shared, remote="scheduler") # Local cache backed by a shared cache for remote execution cache = TieredCache([FolderCache("./cache"), shared]) energy, wfn = run(scf, mol, 0, 1, "cc-pvdz", cache=cache, remote="scheduler")
- qdk_chemistry.remote.submit(algorithm, *args, remote, job_dir=None, **kwargs)
Submit an algorithm for remote execution without blocking.
- Parameters:
algorithm (
Any) – Algorithm-like object to execute remotely.*args (
Any) – Positional arguments for the algorithm.remote (
Any) – Remote backend name or connected backend instance.job_dir (
str|Path|None) – Optional directory where the job record is saved.**kwargs (
Any) – Keyword arguments for the algorithm.
- Return type:
- Returns:
A job handle that can be checked, canceled, fetched, or waited on.
Subpackages
Submodules
- qdk_chemistry.remote.job module
JobJob.job_idJob.backendJob.backend_configJob.backend_stateJob.algorithm_infoJob.statusJob.submitted_atJob.file_pathJob.run_hashJob.input_hashesJob.output_hashesJob.output_is_tupleJob.ownerJob.__init__()Job.to_dict()Job.save()Job.load()Job.discover()Job.attach_backend()Job.detach_backend()Job.check()Job.cancel()Job.fetch()Job.cleanup()Job.wait()Job.is_terminalJob.is_successful
- qdk_chemistry.remote.proxy module
JobJob.job_idJob.backendJob.backend_configJob.backend_stateJob.algorithm_infoJob.statusJob.submitted_atJob.file_pathJob.run_hashJob.input_hashesJob.output_hashesJob.output_is_tupleJob.ownerJob.__init__()Job.to_dict()Job.save()Job.load()Job.discover()Job.attach_backend()Job.detach_backend()Job.check()Job.cancel()Job.fetch()Job.cleanup()Job.wait()Job.is_terminalJob.is_successful
submit()run()
- qdk_chemistry.remote.serialization module
- qdk_chemistry.remote.worker module