-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs: guide on serverless configuration (#63)
* Docs: guide on serverless configuration
- Loading branch information
Showing
1 changed file
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"# Guide: configuring quantum serverless\n", | ||
"\n", | ||
"In order to use `QuantumServerless` with non-local resources, you need to configure `QuantumServerless` to work with them.\n", | ||
"It is easy to do with constructor arguments.\n", | ||
"\n", | ||
"Let's see how to do that." | ||
], | ||
"metadata": { | ||
"collapsed": false | ||
} | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"First option is to pass configuration to constructor of `QuantumServerless`\n", | ||
"\n", | ||
"```python\n", | ||
"serverless = QuantumServerless({\n", | ||
"\t\"providers\": [{\n", | ||
"\t\t\"name\": \"my_provider\", # name of provider\n", | ||
"\t\t\"cluster\": { # main computational resource\n", | ||
"\t\t\t\"name\": \"my_cluster\", # name of cluster\n", | ||
"\t\t\t\"host\": \"HOST_ADDRESS_OF_CLUSTER_HEAD_NODE\", # host address of cluster, if you are using helm it will be DEPLOYMENT_NAME-kuberay-head-svc\n", | ||
"\t\t\t\"port\": 10001 # port to connect\n", | ||
"\t\t}\n", | ||
"\t}]\n", | ||
"})\n", | ||
"```" | ||
], | ||
"metadata": { | ||
"collapsed": false | ||
} | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"Other option will be creating instance from configuration file, which has exactly the same structure as example above\n", | ||
"\n", | ||
"Example of `config.json`\n", | ||
"```json\n", | ||
"{\n", | ||
"\t\"providers\": [{\n", | ||
"\t\t\"name\": \"my_provider\",\n", | ||
"\t\t\"cluster\": {\n", | ||
"\t\t\t\"name\": \"my_cluster\",\n", | ||
"\t\t\t\"host\": \"HOST_ADDRESS_OF_CLUSTER_HEAD_NODE\",\n", | ||
"\t\t\t\"port\": 10001\n", | ||
"\t\t}\n", | ||
"\t}]\n", | ||
"}\n", | ||
"```\n", | ||
"\n", | ||
"Then load this file\n", | ||
"\n", | ||
"```python\n", | ||
"serverless = QuantumServerless.load_configuration(\"./config.json\")\n", | ||
"```" | ||
], | ||
"metadata": { | ||
"collapsed": false | ||
} | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"source": [ | ||
"You can use it now\n", | ||
"\n", | ||
"```python\n", | ||
"with serverless.provider(\"my_provider\"):\n", | ||
" ...\n", | ||
"```" | ||
], | ||
"metadata": { | ||
"collapsed": false | ||
} | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 2 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython2", | ||
"version": "2.7.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |