Skip to content

Commit

Permalink
Refactor client and fix tests (#1513)
Browse files Browse the repository at this point in the history
* refactor client and fix tests

* remove client/arguments.serverless

* remove unused TIMEOUTs

* functions deprecation warnings

* added get_job_by_id with deprecation warning

* added __init__.py

* deprecated list function correction

* replace deleted _token with token

* **kwargs

* add duplicate code exception

* fixed run function

* fixed code quality

* fix linter

* delete file management from client. Use it only in serverless

* fix docs

* skip file download and manage data directory tests

* change docker build

* change docker build

* fix from_dict

* move _upload_with_artifact changes

* rename get_XXXX methods as XXXX

* rename get_XXXX methods as XXXX on local client

* fix upload return on serverless

* fix upload return on local client
  • Loading branch information
korgan00 authored Oct 22, 2024
1 parent 0d09fcb commit a297ef1
Show file tree
Hide file tree
Showing 17 changed files with 1,159 additions and 1,364 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ jobs:
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- name: Build the function
run: docker build -t test_function:latest --build-arg TARGETARCH="amd64" -f ./tests/basic/function/Sample-Docker ./tests/basic
- name: Build the containers
run: docker compose -f docker-compose-dev.yaml build
- name: Run the jupyter profile
Expand All @@ -29,6 +27,7 @@ jobs:
shell: bash
run: |
cd tests/basic
rm ./06_function.py
for f in *.py; do echo "$f" && python "$f" &>> basic.log; done
done=$(cat basic.log | grep -c "DONE")
if [[ $done == 4 ]]
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/notebook-local-verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
for f in tests/basic/*.py; do sed -i "s/import ServerlessClient/import LocalClient/;s/= ServerlessClient(/= LocalClient(/;/token=os\.environ\.get/d;/host=os\.environ\.get/d" "$f"; done
for f in tests/experimental/*.py; do sed -i "s/import ServerlessClient/import LocalClient/;s/= ServerlessClient(/= LocalClient(/;/token=os\.environ\.get/d;/host=os\.environ\.get/d" "$f"; done
rm tests/basic/06_function.py
rm tests/experimental/file_download.py
rm tests/experimental/manage_data_directory.py
- name: install dependencies
shell: bash
run: pip install client/
Expand Down
5 changes: 0 additions & 5 deletions client/qiskit_serverless/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,15 @@
from importlib_metadata import version as metadata_version, PackageNotFoundError

from .core import (
BaseProvider,
BaseClient,
distribute_task,
distribute_qiskit_function,
get,
put,
get_refs_by_status,
ServerlessProvider,
ServerlessClient,
IBMServerlessProvider,
IBMServerlessClient,
RayProvider,
RayClient,
LocalProvider,
LocalClient,
save_result,
Configuration,
Expand Down
26 changes: 5 additions & 21 deletions client/qiskit_serverless/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@
BaseClient
RayClient
LocalClient
ComputeResource
Job
GatewayJobClient
BaseJobClient
RayJobClient
save_result
QiskitPattern
QiskitFunction
Expand All @@ -51,25 +47,13 @@
"""

from .client import (
BaseProvider,
BaseClient,
ComputeResource,
ServerlessProvider,
ServerlessClient,
IBMServerlessProvider,
IBMServerlessClient,
LocalProvider,
LocalClient,
RayProvider,
RayClient,
)
from .client import BaseClient

from .clients.local_client import LocalClient
from .clients.ray_client import RayClient
from .clients.serverless_client import ServerlessClient, IBMServerlessClient

from .job import (
BaseJobClient,
RayJobClient,
GatewayJobClient,
LocalJobClient,
Job,
save_result,
Configuration,
Expand Down
Loading

0 comments on commit a297ef1

Please sign in to comment.