Skip to content

Commit

Permalink
Merge branch 'main' into chore/client-ibmprovider-url
Browse files Browse the repository at this point in the history
  • Loading branch information
IceKhan13 committed Nov 1, 2023
2 parents 73fd4f3 + 00cc971 commit 25b78e5
Show file tree
Hide file tree
Showing 45 changed files with 753 additions and 396 deletions.
10 changes: 5 additions & 5 deletions .github/actions/helm-lint/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ runs:
uses: azure/setup-helm@v1
with:
version: v3.12.1

# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
# yamllint (https://github.com/adrienverge/yamllint) which require Python
- uses: actions/setup-python@v4
with:
python-version: '3.9'
check-latest: true

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.4.0
uses: helm/chart-testing-action@v2.6.0

- name: Run chart-testing (list-changed)
shell: bash
Expand All @@ -27,12 +27,12 @@ runs:
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run chart-testing (lint)
shell: bash
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --config ct.yaml --check-version-increment=false

# - name: Create kind cluster
# if: steps.list-changed.outputs.changed == 'true'
# uses: helm/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions charts/qs-observability/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: Quantum-Serverless helm chart for observabililty (i.e. logging/moni

type: application

version: 0.6.6
appVersion: "0.6.6"
version: 0.7.0
appVersion: "0.7.0"

dependencies:
- name: kube-prometheus-stack
Expand Down
10 changes: 5 additions & 5 deletions charts/quantum-serverless/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
dependencies:
- name: gateway
repository: ""
version: 0.6.6
version: 0.7.0
- name: jupyter
repository: ""
version: 0.6.6
version: 0.7.0
- name: nginx-ingress-controller
repository: https://charts.bitnami.com/bitnami
version: 9.7.9
Expand All @@ -16,6 +16,6 @@ dependencies:
version: 13.4.1
- name: repository
repository: ""
version: 0.6.6
digest: sha256:8a3d3204a79bc6819e64e06fd60df91091de1e39cc6f71fc65c5aa61ddf6784d
generated: "2023-10-26T12:13:31.057502-04:00"
version: 0.7.0
digest: sha256:a29f6203eb43606172334c1ed3ea376a100cef711c412da39ac048c0c4f43517
generated: "2023-10-30T12:50:03.461125-04:00"
10 changes: 5 additions & 5 deletions charts/quantum-serverless/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ description: Quantum-Serverless helm chart that contains different dependencies.

type: application

version: 0.6.6
appVersion: "0.6.6"
version: 0.7.0
appVersion: "0.7.0"

dependencies:
- name: gateway
condition: gatewayEnable
version: 0.6.6
version: 0.7.0
- name: jupyter
condition: jupyterEnable
version: 0.6.6
version: 0.7.0
- name: nginx-ingress-controller
condition: nginxIngressControllerEnable
version: 9.7.9
Expand All @@ -28,7 +28,7 @@ dependencies:
repository: https://charts.bitnami.com/bitnami
- name: repository
condition: repositoryEnable
version: 0.6.6
version: 0.7.0

maintainers:
- name: akihikokuroda
Expand Down
4 changes: 2 additions & 2 deletions charts/quantum-serverless/charts/gateway/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.6.6
version: 0.7.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.6.6"
appVersion: "0.7.0"
2 changes: 1 addition & 1 deletion charts/quantum-serverless/charts/gateway/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ application:
superuser:
enable: true
ray:
nodeImage: "icr.io/quantum-public/quantum-serverless-ray-node:0.6.6-py39"
nodeImage: "icr.io/quantum-public/quantum-serverless-ray-node:0.7.0-py39"
cpu: 2
memory: 2
replicas: 1
Expand Down
4 changes: 2 additions & 2 deletions charts/quantum-serverless/charts/jupyter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.6.6
version: 0.7.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.6.6"
appVersion: "0.7.0"
4 changes: 2 additions & 2 deletions charts/quantum-serverless/charts/repository/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.6.6
version: 0.7.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.6.6"
appVersion: "0.7.0"
8 changes: 4 additions & 4 deletions charts/quantum-serverless/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ gateway:
image:
repository: "icr.io/quantum-public/quantum-serverless-gateway"
pullPolicy: IfNotPresent
tag: "0.6.6"
tag: "0.7.0"
application:
siteHost: "http://gateway:8000"
rayHost: "http://kuberay-head-svc:8265"
Expand All @@ -57,7 +57,7 @@ gateway:
type: ClusterIP
port: 8000
ray:
nodeImage: "icr.io/quantum-public/quantum-serverless-ray-node:0.6.6-py39"
nodeImage: "icr.io/quantum-public/quantum-serverless-ray-node:0.7.0-py39"
opensslImage: registry.access.redhat.com/ubi8/openssl:8.8-9
kubectlImage: alpine/k8s:1.28.2@sha256:d7b859ed3422c920e733e07c860867f208796a03b35960530ac8da63ffb2c262
limits:
Expand Down Expand Up @@ -112,7 +112,7 @@ jupyter:

image:
repository: "icr.io/quantum-public/quantum-serverless-notebook"
tag: "0.6.6-py39"
tag: "0.7.0-py39"
pullPolicy: IfNotPresent
container:
port: 8888
Expand Down Expand Up @@ -182,7 +182,7 @@ repository:
fullnameOverride: "repository"
image:
pullPolicy: IfNotPresent
tag: "0.6.6"
tag: "0.7.0"
application:
superuser:
username: "admin"
Expand Down
14 changes: 7 additions & 7 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Full docs can be found at https://qiskit-extensions.github.io/quantum-serverless

## Usage

### Step 1: write program
### Step 1: write pattern

```python
from quantum_serverless import distribute_task, get, get_arguments, save_result
Expand Down Expand Up @@ -67,22 +67,22 @@ Full docs can be found at https://qiskit-extensions.github.io/quantum-serverless
```


### Step 2: run program
### Step 2: run pattern

```python
from quantum_serverless import QuantumServerless, GatewayProvider
from quantum_serverless import ServerlessProvider, QiskitPattern
from qiskit.circuit.random import random_circuit

serverless = QuantumServerless(GatewayProvider(
serverless = ServerlessProvider(
username="<USERNAME>",
password="<PASSWORD>",
host="<GATEWAY_ADDRESS>",
))
)

# create program
program = Program(
program = QiskitPattern(
title="Quickstart",
entrypoint="program.py",
entrypoint="pattern.py",
working_dir="./src"
)

Expand Down
2 changes: 1 addition & 1 deletion client/quantum_serverless/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.6
0.7.0
5 changes: 3 additions & 2 deletions client/quantum_serverless/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,23 @@
from .core import (
BaseProvider,
distribute_task,
distribute_program,
distribute_qiskit_pattern,
get,
put,
get_refs_by_status,
Provider,
ServerlessProvider,
IBMServerlessProvider,
RayProvider,
LocalProvider,
save_result,
)
from .quantum_serverless import (
QuantumServerless,
get_auto_discovered_provider,
QuantumServerlessException,
)
from .core.program import Program
from .core.pattern import QiskitPattern
from .serializers import get_arguments

try:
Expand Down
19 changes: 16 additions & 3 deletions client/quantum_serverless/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@
IBMServerlessProvider
BaseProvider
RayProvider
LocalProvider
ComputeResource
Job
GatewayJobClient
BaseJobClient
RayJobClient
save_result
Program
QiskitPattern
ProgramStorage
ProgramRepository
download_and_unpack_artifact
Expand All @@ -46,6 +47,7 @@
fetch_execution_meta
distribute_task
distribute_program
distribute_qiskit_pattern
get
put
get_refs_by_status
Expand All @@ -58,10 +60,20 @@
Provider,
ServerlessProvider,
IBMServerlessProvider,
LocalProvider,
RayProvider,
)
from .job import BaseJobClient, RayJobClient, GatewayJobClient, Job, save_result
from .program import (

from .job import (
BaseJobClient,
RayJobClient,
GatewayJobClient,
LocalJobClient,
Job,
save_result,
)
from .pattern import (
QiskitPattern,
Program,
ProgramStorage,
ProgramRepository,
Expand All @@ -74,6 +86,7 @@
get_refs_by_status,
fetch_execution_meta,
distribute_task,
distribute_qiskit_pattern,
distribute_program,
Target,
CircuitMeta,
Expand Down
27 changes: 21 additions & 6 deletions client/quantum_serverless/core/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import inspect
import os
import shutil
import warnings
from dataclasses import dataclass
from typing import Optional, Dict, Any, Union, List, Callable, Sequence
from uuid import uuid4
Expand Down Expand Up @@ -332,15 +333,15 @@ def wrapper(*args, **kwargs):
"""


def distribute_program(
def distribute_qiskit_pattern(
provider: Optional[Any] = None,
dependencies: Optional[List[str]] = None,
working_dir: Optional[str] = None,
):
"""[Experimental] Program decorator to turn function into remotely executable program.
"""[Experimental] QiskitPattern decorator to turn function into remotely executable program.
Example:
>>> @distribute_program(provider=ServerlessProvider(...), dependencies=[...])
>>> @distribute_qiskit_pattern(provider=ServerlessProvider(...), dependencies=[...])
>>> def my_program():
>>> print("Hola!")
>>>
Expand All @@ -356,7 +357,7 @@ def distribute_program(
"""
# pylint: disable=import-outside-toplevel,cyclic-import
from quantum_serverless import QuantumServerlessException
from quantum_serverless.core.program import Program
from quantum_serverless.core.pattern import QiskitPattern
from quantum_serverless.core.provider import ServerlessProvider

# create provider
Expand Down Expand Up @@ -411,12 +412,12 @@ def wrapper(*args, **kwargs):
file.write(ENTRYPOINT_CONTENT.format(file_name=pickle_file_name))

# create program
wrapped_program = Program(
wrapped_program = QiskitPattern(
title=function.__name__,
entrypoint=entrypoint_file_name,
working_dir=working_directory,
dependencies=dependencies,
description="Program execution using @distribute_program decorator.",
description="QiskitPattern execution using @distribute_program decorator.",
)

# run program
Expand All @@ -434,3 +435,17 @@ def wrapper(*args, **kwargs):
return wrapper

return decorator


def distribute_program(
provider: Optional[Any] = None,
dependencies: Optional[List[str]] = None,
working_dir: Optional[str] = None,
):
"""Decorator for distributed program."""
warnings.warn(
"`distribute_program` has been deprecated "
"and will be removed in future releases. "
"Please, use `distribute_qiskit_pattern` instead."
)
return distribute_qiskit_pattern(provider, dependencies, working_dir)
Loading

0 comments on commit 25b78e5

Please sign in to comment.