Skip to content

Commit

Permalink
Update dependency ray to v2.5.1 (Qiskit#677)
Browse files Browse the repository at this point in the history
* Update dependency ray to v2.5.1

* Update Dockerfile ray version

* Client: decorators docs

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: david <9059044+Tansito@users.noreply.github.com>
Co-authored-by: Iskandar Sitdikov <iskandar.sitdikov@gmail.com>
  • Loading branch information
3 people authored Jun 30, 2023
1 parent 90dcafa commit a4c7b23
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 9 deletions.
50 changes: 46 additions & 4 deletions client/quantum_serverless/core/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,59 @@
from quantum_serverless.utils import JsonSerializable

remote = ray.remote
get = ray.get
put = ray.put
get_refs_by_status = ray.wait


def put(value: Any, **kwargs):
"""Puts object into shared distributed storage
Args:
value: object to put to object store
**kwargs: other arguments
Returns:
"""
return ray.put(value=value, **kwargs)


def get_refs_by_status(object_refs: List["ray.ObjectRef"], **kwargs):
"""Get references by status.
Args:
object_refs: object references
**kwargs: other arguments
Returns:
A list of refs that are ready and a list of the remaining references.
"""
return ray.wait(object_refs=object_refs, **kwargs)


def get(
object_refs: Union[ray.ObjectRef, Sequence[ray.ObjectRef]],
*,
timeout: Optional[float] = None,
) -> Any:
"""Get results from distributed tasks.
Args:
object_refs: Object ref of the object to get or a list of object refs
to get.
timeout (Optional[float]): The maximum amount of time in seconds to
wait before returning.
Returns:
A object or a list of objects.
"""
return ray.get(object_refs=object_refs, timeout=timeout)


@dataclass
class Target(JsonSerializable):
"""Quantum serverless target.
Example:
>>> @run_qiskit_remote(target=Target(cpu=1))
>>> @distribute_task(target=Target(cpu=1))
>>> def awesome_function():
>>> return 42
"""
Expand Down
2 changes: 1 addition & 1 deletion client/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ray[default,data]>=2.4.0, <3
ray[default,data]>=2.5.1, <3
requests>=2.31.0
importlib-metadata>=5.2.0
qiskit-terra>=0.24.1
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements-doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ reno>=3.5.0
# Black's formatting rules can change between major versions, so we use
# the ~= specifier for it.
black[jupyter]~=22.1
ray==2.1.0
ray==2.5.1
qiskit-terra==0.21.1
qiskit-ibm-runtime==0.7.0rc2
sphinx-copybutton>=0.5.0
Expand Down
2 changes: 1 addition & 1 deletion gateway/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ django-allow-cidr>=0.6
dj-rest-auth>=3.0.0
djangorestframework-simplejwt>=5.2.2
django_prometheus>=2.3.1
ray[default]>=2.4.0
ray[default]>=2.5.1
Django>=4.2.2
gunicorn>=20.1.0
requests>=2.31.0
Expand Down
4 changes: 2 additions & 2 deletions infrastructure/docker/Dockerfile-ray-qiskit
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG IMAGE_PY_VERSION=py39

FROM rayproject/ray:2.4.0-$IMAGE_PY_VERSION AS ray-node-amd64
FROM rayproject/ray:2.5.1-$IMAGE_PY_VERSION AS ray-node-amd64

WORKDIR /
USER 0
Expand All @@ -14,7 +14,7 @@ RUN pip install . --no-cache-dir
WORKDIR /
RUN rm -r ./qs

FROM rayproject/ray:2.4.0-$IMAGE_PY_VERSION-aarch64 AS ray-node-arm64
FROM rayproject/ray:2.5.1-$IMAGE_PY_VERSION-aarch64 AS ray-node-arm64

WORKDIR /
USER 0
Expand Down

0 comments on commit a4c7b23

Please sign in to comment.