qiskit_serverless.core.QiskitFunction¶
- class QiskitFunction(title, provider=None, entrypoint=None, working_dir='./', env_vars=None, dependencies=None, description=None, version=None, tags=None, raw_data=None, image=None, runner='ray', arguments_schema=None, type='GENERIC', sizes_map=None, default_size=None)[source]¶
Serverless QiskitPattern.
- Parameters:
title (
str) – program nameprovider (
Optional[str]) – Qiskit Function provider referenceentrypoint (
Optional[str]) – is a script that will be executed as a job ex: job.pyenv_vars (
Optional[Dict[str,str]]) – env varsdependencies (
Optional[List[str]]) – list of python dependencies to execute a programworking_dir (
Optional[str]) – directory where entrypoint file is located (max size 50MB)description (
Optional[str]) – description of a programversion (
Optional[str]) – version of a programsizes_map (
Optional[Dict[str,str]]) – the function’s{size_label: compute_profile}t-shirt size catalog, e.g.{"s": "24x120", "m": "16x128"}. Set it to declare the catalog on upload; it is also how the catalog is carried back in a fetched function, read throughRunnableQiskitFunction.sizes(). A size is picked per run withfunction.run(function_size="s"); labels are matched case-insensitively and each compute profile must name one the deployment has registered, or the upload is rejected. Only meaningful for the"fleets"runner. On upload,Noneleaves any stored catalog untouched and a sent mapping replaces it wholesale; a fetched function carriesNonewhen the representation has no size information and an empty dict when it declares no sizes.default_size (
Optional[str]) – the size label used when a run omits an explicit size. Set it on upload to declare the default (it must be one of the labels insizes_mapand requiressizes_mapto be declared); also read back throughRunnableQiskitFunction.get_default_size(). None when the function declares no default (a run then falls back to the platform default). Only meaningful for the"fleets"runner.arguments_schema (
Union[Dict[str,Any],bool,None]) –JSON Schema describing valid arguments for this function. Normally an object;
TrueandFalseare also valid schemas, accepting and rejecting every argument respectively.Nonemeans the function does not declare one, and setting it to{}on an upload removes the schema an earlier upload stored.The gateway applies the schema to the arguments as this SDK encodes them, not as they look in Python, so a
QuantumCircuitargument is matched against{"__type__": "QuantumCircuit", "__value__": "<base64 QPY>"}and a numpy array against an object rather than an array. Describing either with{"type": "array"}therefore rejects every legitimate call. Constrain the plain arguments (counts, names, options, flags) and check only the__type__tag of the Qiskit ones. Seespecs/ARGUMENTS_VALIDATION.md.
- __init__(title, provider=None, entrypoint=None, working_dir='./', env_vars=None, dependencies=None, description=None, version=None, tags=None, raw_data=None, image=None, runner='ray', arguments_schema=None, type='GENERIC', sizes_map=None, default_size=None)¶
Methods
__init__(title[, provider, entrypoint, ...])from_json(data)Reconstructs QiskitPattern from dictionary.
Attributes
APPLICATIONCIRCUITGENERICarguments_schemadefault_sizedependenciesdescriptionentrypointenv_varsimageproviderraw_datarunnersizes_maptagstypeversionworking_dirtitle