Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
Update 02-local-development.ipynb
Browse files Browse the repository at this point in the history
fix: split the example notebook file into separate sections
  • Loading branch information
radufalcusanStoneone authored Apr 16, 2024
1 parent 3c0c52c commit e443b98
Showing 1 changed file with 91 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,97 @@
"\n"
]
},
{
"cell_type": "markdown",
"id": "c8357df8-2375-4e7a-b005-2648a3a3c06d",
"metadata": {},
"source": [
"Below is a code snippet demonstrating how to create an instance of the PlanqkServiceClient."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e94dd115-e792-4974-8edb-161331249143",
"metadata": {},
"outputs": [],
"source": [
"from planqk.service.client import PlanqkServiceClient\n",
"\n",
"# Your consumer key and secret\n",
"consumer_key = \"your_consumer_key\"\n",
"consumer_secret = \"your_secret_key\"\n",
"\n",
"service_endpoint = \"http://localhost:8081/\"\n",
"\n",
"client = PlanqkServiceClient(service_endpoint, consumer_key, consumer_secret)"
]
},
{
"cell_type": "markdown",
"id": "e9c3c40a-44dd-4727-bdc1-f68594734ca0",
"metadata": {},
"source": [
"The following code prepares input data and parameters **data** and **params**, then starts an execution using a method **start_execution** with these data and parameters passed as arguments."
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "24afa15c-52eb-4c2a-8a1a-9378a75cbaed",
"metadata": {},
"outputs": [],
"source": [
"data = {\"dataValue\" : [\"abc\", \"dce\"]}\n",
"params = {\"paramsValue\" : [\"abc\", \"dce\"]}\n",
"\n",
"job = client.start_execution(data=data, params=params)"
]
},
{
"cell_type": "markdown",
"id": "081dbdb8-6cb7-4cc8-9993-fcca36f2701b",
"metadata": {},
"source": [
"The following snippet utilizes the **get_status** method to retrieve the execution status based on a given ID."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "956ea044-2c83-4d8d-9a6c-fa2fc149f74b",
"metadata": {},
"outputs": [],
"source": [
"job = client.get_status(job.id)"
]
},
{
"cell_type": "markdown",
"id": "ae5752c4-df03-422d-9e8f-050637e353dc",
"metadata": {},
"source": [
"The following line fetches the result of an execution for a given ID using the **get_result** method."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c6ca5cb1-2d95-4d01-b010-42b55699e325",
"metadata": {},
"outputs": [],
"source": [
"result = client.get_result(job.id)"
]
},
{
"cell_type": "markdown",
"id": "5f1c63ac-a4e9-4594-8f2b-14ef180709b1",
"metadata": {},
"source": [
"Here is the full code to utilize the PlanQK Service for local development using PlanQK CLI:"
]
},
{
"cell_type": "code",
"execution_count": 17,
Expand Down

0 comments on commit e443b98

Please sign in to comment.