Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Commit

Permalink
Merge pull request #77 from NERSC/20-03a
Browse files Browse the repository at this point in the history
20 03a
  • Loading branch information
rcthomas authored Jul 16, 2020
2 parents 554e40c + bc1f7ea commit 25adb11
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 47 deletions.
34 changes: 10 additions & 24 deletions jupyter-nersc/web-jupyterhub/jupyterhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,7 @@ def comma_split(string):
#
# .. versionadded: 0.9
#c.Authenticator.blacklist = set()
c.Authenticator.blacklist = set(comma_split(os.environ.get("BLACKLIST")))

## Enable persisting auth_state (if available).
#
Expand Down Expand Up @@ -1014,7 +1015,6 @@ def comma_split(string):
{ "name": "gerty-shared-node-cpu" },
{ "name": "gerty-exclusive-node-cpu" },
{ "name": "cori-shared-node-cpu" },
{ "name": "cori2-shared-node-cpu" },
{ "name": "cori-shared-node-gpu" },
{ "name": "cori-exclusive-node-cpu" },
{ "name": "cori-configurable-gpu" },
Expand Down Expand Up @@ -1074,10 +1074,6 @@ def comma_split(string):
"name": "cori",
"roles": []
},
{
"name": "cori2",
"roles": []
},
{
"name": "spin",
"roles": []
Expand Down Expand Up @@ -1117,19 +1113,6 @@ def comma_split(string):
}
),
"cori-shared-node-cpu": (
"sshspawner.sshspawner.SSHSpawner", {
"cmd": ["/global/common/cori/das/jupyterhub/jupyter-launcher.sh",
"/usr/common/software/jupyter/19-11/bin/jupyter-labhub"],
"args": ["--transport=ipc"],
"environment": {"OMP_NUM_THREADS" : "2", "PYTHONFAULTHANDLER": "1"},
"remote_hosts": ["corijupyter.nersc.gov"],
"remote_port_command": "/usr/bin/python /global/common/cori/das/jupyterhub/new-get-port.py --ip",
"hub_api_url": f"https://{nersc_jupyterhub_subdomain}.nersc.gov/hub/api",
"path": "/usr/common/software/jupyter/19-11/bin:/global/common/cori/das/jupyterhub:/usr/common/usg/bin:/usr/bin:/bin",
"ssh_keyfile": '/certs/{username}.key'
}
),
"cori2-shared-node-cpu": (
"sshspawner.sshspawner.SSHSpawner", {
"cmd": ["/global/common/cori/das/jupyterhub/jupyter-launcher.sh",
"/global/common/cori_cle7/software/jupyter/20-06/bin/jupyterhub-singleuser"],
Expand Down Expand Up @@ -1178,8 +1161,7 @@ def comma_split(string):
),
"cori-configurable-gpu": (
"nerscslurmspawner.NERSCConfigurableGPUSlurmSpawner", {
"cmd": ["/global/common/cori/das/jupyterhub/jupyter-launcher.sh",
"/usr/common/software/jupyter/19-11/bin/jupyter-labhub"],
"cmd": ["/global/common/cori_cle7/software/jupyter/20-06/bin/jupyterhub-singleuser"],
"args": ["--transport=ipc"],
"exec_prefix": "/usr/bin/ssh -q -o StrictHostKeyChecking=no -o preferredauthentications=publickey -l {username} -i /certs/{username}.key {remote_host}",
"startup_poll_interval": 30.0,
Expand All @@ -1188,19 +1170,23 @@ def comma_split(string):
"req_ngpus": "1",
"req_runtime": "240",
"hub_api_url": f"https://{nersc_jupyterhub_subdomain}.nersc.gov/hub/api",
"path": "/usr/common/software/jupyter/19-11/bin:/global/common/cori/das/jupyterhub:/usr/common/usg/bin:/usr/bin:/bin",
"path": "/usr/common/software/jupyter/20-06/bin:/global/common/cori/das/jupyterhub:/usr/common/usg/bin:/usr/bin:/bin",
"batchspawner_singleuser_cmd" : " ".join([
"/global/common/cori/das/jupyterhub/jupyter-launcher.sh",
"/global/common/cori_cle7/software/jupyter/20-06/bin/batchspawner-singleuser",
])
}
),
"spin-shared-node-cpu": (
"sshspawner.sshspawner.SSHSpawner", {
"cmd": ["/global/common/cori/das/jupyterhub/jupyter-launcher.sh",
"/global/common/cori_cle7/software/jupyter/19-11/bin/jupyter-labhub"],
"cmd": ["/global/common/cori/das/jupyterhub/jupyter-launcher.sh",
"/global/common/cori_cle7/software/jupyter/20-06/bin/jupyterhub-singleuser"],
"args": ["--transport=ipc"],
"environment": {"OMP_NUM_THREADS" : "2"},
"remote_hosts": ["app-notebooks"],
"remote_port_command": "/usr/bin/python /global/common/cori/das/jupyterhub/new-get-port.py --ip",
"hub_api_url": f"https://{nersc_jupyterhub_subdomain}.nersc.gov/hub/api",
"path": "/global/common/cori_cle7/software/jupyter/19-11/bin:/global/common/cori/das/jupyterhub:/usr/common/usg/bin:/usr/bin:/bin",
"path": "/global/common/cori_cle7/software/jupyter/20-06/bin:/global/common/cori/das/jupyterhub:/usr/common/usg/bin:/usr/bin:/bin",
"ssh_keyfile": '/certs/{username}.key'
}
)
Expand Down
20 changes: 10 additions & 10 deletions jupyter-nersc/web-jupyterhub/nerscspawner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

import os

from jupyterhub.spawner import LocalProcessSpawner

from tornado import httpclient, web
Expand Down Expand Up @@ -44,15 +42,18 @@ def check_role(self, auth_state, role):
if role == "staff":
return self.check_role_staff(auth_state)
if role == "cori-exclusive-node-cpu":
return self.check_role_cori_exclusive_node_cpu()
return self.check_role_cori_exclusive_node_cpu(auth_state)
return False

def check_role_cori_exclusive_node_cpu(self):
users = os.environ.get("CORI_EXCLUSIVE_NODE_CPU_USERS")
if users:
return self.user.name in users.split(",")
else:
return True
def check_role_cori_exclusive_node_cpu(self, auth_state):
return self.default_jupyter_repo(auth_state) is not None

def default_jupyter_repo(self, auth_state):
for allocation in self.user_allocations(auth_state):
for qos in allocation["userAllocationQos"]:
if qos["qos"]["qos"] in ["jupyter"]:
return allocation["computeAllocation"]["repoName"]
return None

def check_role_gpu(self, auth_state):
return self.default_gpu_repo(auth_state) is not None
Expand All @@ -63,7 +64,6 @@ def check_role_staff(self, auth_state):
return False

def default_gpu_repo(self, auth_state):
# for allocation in self.user_allocations(auth_state, ["nstaff", "m1759", "dasrepo", "gpu4sci"]):
for allocation in self.user_allocations(auth_state):
for qos in allocation["userAllocationQos"]:
if qos["qos"]["qos"] in ["gpu", "gpu_special_m1759"]:
Expand Down
13 changes: 0 additions & 13 deletions jupyter-nersc/web-jupyterhub/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,6 @@
<td colspan="{{ counter | length }}" class="small">{{ setup.use_cases }}</td>
{% endif %}
{% endfor %}
</tr><tr>
<br />
<td colspan="42">
<b>What is the "Cori2" option?</b><br/>
<ul class="small">
<li>Click the "Cori2" button if you are willing to give JupyterLab 2.1 a test drive on the Cori shared CPU nodes.</li>
<li>JupyterLab 1.2 is still the default for Cori shared CPU nodes.</li>
<li>At the July maintenance, JupyterLab 2 will replace JupyterLab 1.</li>
<li>If you have any issues with JupyterLab 2, please let us know by ticket at <a href="https://help.nersc.gov">https://help.nersc.gov</a></li>
</ul>
</td>
</tr></tfoot>
{%- endmacro %}

Expand All @@ -113,8 +102,6 @@
{{ spawner_table() }}
{% endif %}



</div>

{% endblock %}
Expand Down

0 comments on commit 25adb11

Please sign in to comment.