Skip to content

UST-QuAntiL/braket-hybrid-jobs-handler

Repository files navigation

License

amazon-braket-hybrid-jobs-handler

This service takes a workflow fragment realizing a hybrid algorithm as input and generates a Amazon Braket Hybrid Jobs program to benefit from speedups and reduced queuing times. Additionally, an agent is generated which handles the transfer of input/output parameters between the Amazon Braket Hybrid Jobs program and a workflow. The implementation from the qiskit-runtime-handler is adapted but the main difference is how the program is uploaded to AWS and how input/output parameters are handled.

The amazon-braket-hybrid-jobs-handler can be used in conjunction with the QuantME Transformation Framework. Please have a look at the corresponding documentation. Furthermore, a use case showing the rewrite of quantum workflows using the amazon-braket-hybrid-jobs-handler is available here.

Docker Setup

  • Clone the repository:
git clone https://github.com/UST-QuAntiL/amazon-braket-hybrid-jobs-handler.git
docker-compose pull
docker-compose up

Now the amazon-braket-hybrid-jobs-handler is available on http://localhost:8890/.

Local Setup

Start Redis

Start Redis, e.g., using Docker:

docker run -p 5045:5045 redis --port 5045

Configure the Amazon-Braket-Hybrid-Jobs-Handler

Before starting the amazon-braket-hybrid-jobs-handler, define the following environment variables:

FLASK_RUN_PORT=8890
REDIS_URL=redis://$DOCKER_ENGINE_IP:5045

Thereby, please replace $DOCKER_ENGINE_IP with the actual IP of the Docker engine you started the Redis container.

Configure the Database

  • Install SQLite DB, e.g., as described here
  • Create a data folder in the app folder
  • Setup the results table with the following commands:
flask db migrate -m "results table"
flask db upgrade

Start the Application

Start a worker for the request queue:

rq worker --url redis://$DOCKER_ENGINE_IP:5045 amazon-braket-hybrid-jobs-handler

Finally, start the Flask application, e.g., using PyCharm or the command line.