Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: guide on serverless configuration #63

Merged
merged 3 commits into from
Nov 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions docs/guides/03_configuring-quantum-serverless.ipynb
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",
Copy link
Member

@Tansito Tansito Nov 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker but how do you see to specify a bit more what kind of providers we support? Like:

"\t\t\"name\": \"my_provider\",  # name of provider, currently supporting: ibm, aws\n",

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to have separate tutorial/docs on setting up multicloud deployment, where we can showcase that. For this one I wanted to do something generic.

"\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
}