# SWAN Spawner
Spawner for JupyterHub that enables configuring a session with CVMFS/LCG stacks, support for GPU, oAuth tokens, etc.
If Binder is used to configure the Docker image used, it reverts to the default upstream configuration.
Works with both Docker and Kubernetes.
## Installation
```bash
pip3 install swanspawner
```
## Usage
Add to your JupyterHub config file
```python
c.JupyterHub.spawner_class = 'swanspawner.SwanDockerSpawner'
```
If you deploy with Docker, or
```python
c.JupyterHub.spawner_class = 'swanspawner.SwanKubeSpawner'
```
If you deploy with Kubernetes.
## Jupyter Notebook environment variables set during spawn
| env |
| --- |
| ROOT_LCG_VIEW_NAME |
| ROOT_LCG_VIEW_PLATFORM |
| USER_ENV_SCRIPT |
| ROOT_LCG_VIEW_PATH |
| USER |
| USER_ID |
| USER_GID |
| HOME |
| EOS_PATH_FORMAT |
| SERVER_HOSTNAME |
| MAX_MEMORY |
| JPY_USER |
| JPY_COOKIE_NAME |
| JPY_BASE_URL |
| JPY_HUB_PREFIX |
| JPY_HUB_API_URL |
| ACCESS_TOKEN |
| OAUTH_INSPECTION_ENDPOINT |
## Spawn Form configuration
To configure custom form, please set path to config file as below
```python
c.SwanSpawner.options_form_config = '<path>'
```
High level objects
```json
{
"header": <options header text>,
"options": <array of options objects>
...
}
```
Options type label
```json
{
"options": [
{
"type": "label",
"label": {
"value": <id of label>,
"text": <displayed text of label>
}
},
...
]
...
}
```
Options type selection
```json
{
"options": [
{
"type": "selection",
"lcg": {
"value": <id of lcg>,
"text": <displayed text of lcg>
},
"platforms": [
{
"value": <id of platform>,
"text": <displayed text of platform>
}
...
],
"cores": [
{
"value": <id of cores selection>,
"text": <displayed text of cores selection>
}
...
],
"memory": [
{
"value": <id of memory selection>,
"text": <displayed text of memory selection>
}
...
],
"clusters": [
{
"value": <id of cluster>,
"text": <displayed text of cluster>
}
...
]
},
...
]
...
}
```
An example json file can be seen in [options_form_config.json]()
## Mount options
To mount EOS or CVMFS with SwanDockerSpawner (which requires a mount with propagation "shared"), a new configuration was introduced by upstream:
```python
c.SwanSpawner.mounts = [
{
'source': '/eos',
'target': '/eos',
'type': 'bind',
'propagation': 'shared'
},
{
'source': '/cvmfs',
'target': '/cvmfs',
'type': 'bind',
'propagation': 'shared'
}
]
```
Raw data
{
"_id": null,
"home_page": "https://github.com/swan-cern/jupyterhub-extensions",
"name": "swanspawner",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "JupyterHub, Spawner, SWAN, CERN",
"author": "SWAN Admins",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/8f/7c/45f9029935ca67901602c46e6511016f7bc21c2d16c587c0e9d7b808a51c/swanspawner-1.2.9.tar.gz",
"platform": "Linux",
"description": "# SWAN Spawner\n\nSpawner for JupyterHub that enables configuring a session with CVMFS/LCG stacks, support for GPU, oAuth tokens, etc. \nIf Binder is used to configure the Docker image used, it reverts to the default upstream configuration.\nWorks with both Docker and Kubernetes.\n\n## Installation\n\n```bash\npip3 install swanspawner\n```\n\n## Usage\n\nAdd to your JupyterHub config file\n\n```python\nc.JupyterHub.spawner_class = 'swanspawner.SwanDockerSpawner'\n```\n\nIf you deploy with Docker, or\n\n```python\nc.JupyterHub.spawner_class = 'swanspawner.SwanKubeSpawner'\n```\n\nIf you deploy with Kubernetes.\n\n## Jupyter Notebook environment variables set during spawn\n\n| env |\n| --- | \n| ROOT_LCG_VIEW_NAME |\n| ROOT_LCG_VIEW_PLATFORM |\n| USER_ENV_SCRIPT |\n| ROOT_LCG_VIEW_PATH |\n| USER |\n| USER_ID |\n| USER_GID |\n| HOME |\n| EOS_PATH_FORMAT |\n| SERVER_HOSTNAME |\n| MAX_MEMORY |\n| JPY_USER |\n| JPY_COOKIE_NAME |\n| JPY_BASE_URL |\n| JPY_HUB_PREFIX |\n| JPY_HUB_API_URL |\n| ACCESS_TOKEN |\n| OAUTH_INSPECTION_ENDPOINT |\n\n## Spawn Form configuration\n\nTo configure custom form, please set path to config file as below\n\n```python\nc.SwanSpawner.options_form_config = '<path>'\n```\n\nHigh level objects \n\n```json\n{\n \"header\": <options header text>,\n \"options\": <array of options objects>\n...\n}\n```\n\nOptions type label\n\n```json\n{\n \"options\": [\n {\n \"type\": \"label\",\n \"label\": {\n \"value\": <id of label>,\n \"text\": <displayed text of label>\n }\n },\n ...\n]\n...\n}\n```\n\nOptions type selection\n\n```json\n{\n \"options\": [\n {\n \"type\": \"selection\",\n \"lcg\": {\n \"value\": <id of lcg>,\n \"text\": <displayed text of lcg>\n },\n \"platforms\": [\n {\n \"value\": <id of platform>,\n \"text\": <displayed text of platform>\n }\n ...\n ],\n \"cores\": [\n {\n \"value\": <id of cores selection>,\n \"text\": <displayed text of cores selection>\n }\n ...\n ],\n \"memory\": [\n {\n \"value\": <id of memory selection>,\n \"text\": <displayed text of memory selection>\n }\n ...\n ],\n \"clusters\": [\n {\n \"value\": <id of cluster>,\n \"text\": <displayed text of cluster>\n }\n ...\n ]\n },\n ...\n]\n...\n}\n```\nAn example json file can be seen in [options_form_config.json]()\n\n## Mount options\n\nTo mount EOS or CVMFS with SwanDockerSpawner (which requires a mount with propagation \"shared\"), a new configuration was introduced by upstream:\n\n```python\nc.SwanSpawner.mounts = [\n {\n 'source': '/eos',\n 'target': '/eos',\n 'type': 'bind',\n 'propagation': 'shared'\n },\n {\n 'source': '/cvmfs',\n 'target': '/cvmfs',\n 'type': 'bind',\n 'propagation': 'shared'\n }\n]\n```\n",
"bugtrack_url": null,
"license": "AGPL-3.0",
"summary": "SWAN JupyterHub spawner",
"version": "1.2.9",
"project_urls": {
"Homepage": "https://github.com/swan-cern/jupyterhub-extensions"
},
"split_keywords": [
"jupyterhub",
" spawner",
" swan",
" cern"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "83a71715ca92f38f5927c806f1028a57e3d6d55616eaefca75b69c839b48710c",
"md5": "6ef8d902a2d55627db891b9011b31027",
"sha256": "4144a89719c49078b5c917c0adbb9bb8cc6f5cf47611fdb9689816022a00e119"
},
"downloads": -1,
"filename": "swanspawner-1.2.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6ef8d902a2d55627db891b9011b31027",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 14950,
"upload_time": "2024-10-01T08:40:03",
"upload_time_iso_8601": "2024-10-01T08:40:03.079566Z",
"url": "https://files.pythonhosted.org/packages/83/a7/1715ca92f38f5927c806f1028a57e3d6d55616eaefca75b69c839b48710c/swanspawner-1.2.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8f7c45f9029935ca67901602c46e6511016f7bc21c2d16c587c0e9d7b808a51c",
"md5": "8655d9f64e177aba919df580264454a2",
"sha256": "54edd61291b2759281fc270c3d712beabb26d4354c16fd02c5830a871bbfe119"
},
"downloads": -1,
"filename": "swanspawner-1.2.9.tar.gz",
"has_sig": false,
"md5_digest": "8655d9f64e177aba919df580264454a2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14585,
"upload_time": "2024-10-01T08:40:05",
"upload_time_iso_8601": "2024-10-01T08:40:05.101334Z",
"url": "https://files.pythonhosted.org/packages/8f/7c/45f9029935ca67901602c46e6511016f7bc21c2d16c587c0e9d7b808a51c/swanspawner-1.2.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-01 08:40:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "swan-cern",
"github_project": "jupyterhub-extensions",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "swanspawner"
}