| | | |
Offset 997, 678 lines modified | Offset 997, 14 lines modified |
997 | #·· | 997 | #·· |
998 | #··It·should·return·the·new·URL·to·redirect·to,·or·None·to·preserve·current | 998 | #··It·should·return·the·new·URL·to·redirect·to,·or·None·to·preserve·current |
999 | #··behavior. | 999 | #··behavior. |
1000 | #··Default:·None | 1000 | #··Default:·None |
1001 | #·c.JupyterHub.user_redirect_hook·=·None | 1001 | #·c.JupyterHub.user_redirect_hook·=·None |
| |
1002 | #------------------------------------------------------------------------------ | 1002 | #------------------------------------------------------------------------------ |
1003 | #·Spawner(LoggingConfigurable)·configuration | |
1004 | #------------------------------------------------------------------------------ | |
1005 | ##·Base·class·for·spawning·single-user·notebook·servers. | |
1006 | #·· | |
1007 | #··Subclass·this,·and·override·the·following·methods: | |
1008 | #·· | |
1009 | #··-·load_state·-·get_state·-·start·-·stop·-·poll | |
1010 | #·· | |
1011 | #··As·JupyterHub·supports·multiple·users,·an·instance·of·the·Spawner·subclass·is | |
1012 | #··created·for·each·user.·If·there·are·20·JupyterHub·users,·there·will·be·20 | |
1013 | #··instances·of·the·subclass. | |
| |
1014 | ##·Extra·arguments·to·be·passed·to·the·single-user·server. | |
1015 | #·· | |
1016 | #··Some·spawners·allow·shell-style·expansion·here,·allowing·you·to·use | |
1017 | #··environment·variables·here.·Most,·including·the·default,·do·not.·Consult·the | |
1018 | #··documentation·for·your·spawner·to·verify! | |
1019 | #··Default:·[] | |
1020 | #·c.Spawner.args·=·[] | |
| |
1021 | ##·An·optional·hook·function·that·you·can·implement·to·pass·`auth_state`·to·the | |
1022 | #··spawner·after·it·has·been·initialized·but·before·it·starts.·The·`auth_state` | |
1023 | #··dictionary·may·be·set·by·the·`.authenticate()`·method·of·the·authenticator. | |
1024 | #··This·hook·enables·you·to·pass·some·or·all·of·that·information·to·your·spawner. | |
1025 | #·· | |
1026 | #··Example:: | |
1027 | #·· | |
1028 | #······def·userdata_hook(spawner,·auth_state): | |
1029 | #··········spawner.userdata·=·auth_state["userdata"] | |
1030 | #·· | |
1031 | #······c.Spawner.auth_state_hook·=·userdata_hook | |
1032 | #··Default:·None | |
1033 | #·c.Spawner.auth_state_hook·=·None | |
| |
1034 | ##·The·command·used·for·starting·the·single-user·server. | |
1035 | #·· | |
1036 | #··Provide·either·a·string·or·a·list·containing·the·path·to·the·startup·script | |
1037 | #··command.·Extra·arguments,·other·than·this·path,·should·be·provided·via·`args`. | |
1038 | #·· | |
1039 | #··This·is·usually·set·if·you·want·to·start·the·single-user·server·in·a·different | |
1040 | #··python·environment·(with·virtualenv/conda)·than·JupyterHub·itself. | |
1041 | #·· | |
1042 | #··Some·spawners·allow·shell-style·expansion·here,·allowing·you·to·use | |
1043 | #··environment·variables.·Most,·including·the·default,·do·not.·Consult·the | |
1044 | #··documentation·for·your·spawner·to·verify! | |
1045 | #··Default:·['jupyterhub-singleuser'] | |
1046 | #·c.Spawner.cmd·=·['jupyterhub-singleuser'] | |
| |
1047 | ##·Maximum·number·of·consecutive·failures·to·allow·before·shutting·down | |
1048 | #··JupyterHub. | |
1049 | #·· | |
1050 | #··This·helps·JupyterHub·recover·from·a·certain·class·of·problem·preventing | |
1051 | #··launch·in·contexts·where·the·Hub·is·automatically·restarted·(e.g.·systemd, | |
1052 | #··docker,·kubernetes). | |
1053 | #·· | |
1054 | #··A·limit·of·0·means·no·limit·and·consecutive·failures·will·not·be·tracked. | |
1055 | #··Default:·0 | |
1056 | #·c.Spawner.consecutive_failure_limit·=·0 | |
| |
1057 | ##·Minimum·number·of·cpu-cores·a·single-user·notebook·server·is·guaranteed·to | |
1058 | #··have·available. | |
1059 | #·· | |
1060 | #··If·this·value·is·set·to·0.5,·allows·use·of·50%·of·one·CPU.·If·this·value·is | |
1061 | #··set·to·2,·allows·use·of·up·to·2·CPUs. | |
1062 | #·· | |
1063 | #··**This·is·a·configuration·setting.·Your·spawner·must·implement·support·for·the | |
1064 | #··limit·to·work.**·The·default·spawner,·`LocalProcessSpawner`,·does·**not** | |
1065 | #··implement·this·support.·A·custom·spawner·**must**·add·support·for·this·setting | |
1066 | #··for·it·to·be·enforced. | |
1067 | #··Default:·None | |
1068 | #·c.Spawner.cpu_guarantee·=·None | |
| |
1069 | ##·Maximum·number·of·cpu-cores·a·single-user·notebook·server·is·allowed·to·use. | |
1070 | #·· | |
1071 | #··If·this·value·is·set·to·0.5,·allows·use·of·50%·of·one·CPU.·If·this·value·is | |
1072 | #··set·to·2,·allows·use·of·up·to·2·CPUs. | |
1073 | #·· | |
1074 | #··The·single-user·notebook·server·will·never·be·scheduled·by·the·kernel·to·use | |
1075 | #··more·cpu-cores·than·this.·There·is·no·guarantee·that·it·can·access·this·many | |
1076 | #··cpu-cores. | |
1077 | #·· | |
1078 | #··**This·is·a·configuration·setting.·Your·spawner·must·implement·support·for·the | |
1079 | #··limit·to·work.**·The·default·spawner,·`LocalProcessSpawner`,·does·**not** | |
1080 | #··implement·this·support.·A·custom·spawner·**must**·add·support·for·this·setting | |
1081 | #··for·it·to·be·enforced. | |
1082 | #··Default:·None | |
1083 | #·c.Spawner.cpu_limit·=·None | |
| |
1084 | ##·Enable·debug-logging·of·the·single-user·server | |
1085 | #··Default:·False | |
1086 | #·c.Spawner.debug·=·False | |
| |
1087 | ##·The·URL·the·single-user·server·should·start·in. | |
1088 | #·· | |
1089 | #··`{username}`·will·be·expanded·to·the·user's·username | |
1090 | #·· | |
1091 | #··Example·uses: | |
1092 | #·· | |
1093 | #··-·You·can·set·`notebook_dir`·to·`/`·and·`default_url`·to·`/tree/home/{username}`·to·allow·people·to | |
1094 | #····navigate·the·whole·filesystem·from·their·notebook·server,·but·still·start·in·their·home·directory. | |
1095 | #··-·Start·with·`/notebooks`·instead·of·`/tree`·if·`default_url`·points·to·a·notebook·instead·of·a·directory. | |
1096 | #··-·You·can·set·this·to·`/lab`·to·have·JupyterLab·start·by·default,·rather·than·Jupyter·Notebook. | |
1097 | #··Default:·'' | |
1098 | #·c.Spawner.default_url·=·'' | |
| |
1099 | ##·Disable·per-user·configuration·of·single-user·servers. | |
1100 | #·· | |
1101 | #··When·starting·the·user's·single-user·server,·any·config·file·found·in·the | |
1102 | #··user's·$HOME·directory·will·be·ignored. | |
1103 | #·· | |
1104 | #··Note:·a·user·could·circumvent·this·if·the·user·modifies·their·Python | |
1105 | #··environment,·such·as·when·they·have·their·own·conda·environments·/·virtualenvs | |
1106 | #··/·containers. | |
1107 | #··Default:·False | |
1108 | #·c.Spawner.disable_user_config·=·False | |
| |
1109 | ##·List·of·environment·variables·for·the·single-user·server·to·inherit·from·the | |
1110 | #··JupyterHub·process. | |
1111 | #·· | |
1112 | #··This·list·is·used·to·ensure·that·sensitive·information·in·the·JupyterHub | |
Max diff block lines reached; 41881/67332 bytes (62.20%) of diff not shown.
|