You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using nbgrader together with z2jh for multiple courses where each course has its own configuration (GPU, CPU, RAM, docker image, etc.). Each user (students & instructors) may be registered in multiple courses, therefore to spawn the correct course & its configuration, before spawning their pod I ask them within options_form to choose their course. then in the pre_spawn_hook I use user_options to spawn the correct course. But within the nbgrader assignment list (as shown in the attached picture) they have still the possibility to change the course (while spawner is spun for another course!).
I was wondering how I can avoid this. how can I override the function in nbgrader that generates this dropdown courselist menu? how can I pass the correct courses to this menu?
the picture shows that two courses (pyf1 & pyf2) are visible in the course list menu while only pyf1 (which the user has chosen in the options_form) should be visible.
the function you defined in /etc/jupyter/nbgrader-config.py .
nbgrader_config.py: |
import os
from nbgrader.server_extensions.assignment_list.handlers import AssignmentList
from nbgrader.auth import Authenticator, JupyterHubAuthPlugin
c = get_config()
c.Exchange.path_includes_course = True
c.Exchange.root = "/mnt/exchange"
c.Authenticator.plugin_class = JupyterHubAuthPlugin
# Use the custom k8s exchange
c.ExchangeFactory.collect = 'nbgrader_k8s_exchange.plugin.ExchangeCollect'
c.ExchangeFactory.exchange = 'nbgrader_k8s_exchange.plugin.Exchange'
c.ExchangeFactory.fetch_assignment = 'nbgrader_k8s_exchange.plugin.ExchangeFetchAssignment'
c.ExchangeFactory.fetch_feedback = 'nbgrader_k8s_exchange.plugin.ExchangeFetchFeedback'
c.ExchangeFactory.list = 'nbgrader_k8s_exchange.plugin.ExchangeList'
c.ExchangeFactory.release_assignment = 'nbgrader_k8s_exchange.plugin.ExchangeReleaseAssignment'
c.ExchangeFactory.release_feedback = 'nbgrader_k8s_exchange.plugin.ExchangeReleaseFeedback'
c.ExchangeFactory.submit = 'nbgrader_k8s_exchange.plugin.ExchangeSubmit'
# List courses for the student even if there are no assignments
def list_courses(self):
auth = Authenticator(config=c)
with open('/home/jovyan/msg.txt', 'w') as f:
f.write(f'########## inside list_courses: {auth} {dir(auth)} ############')
return {
"success": True,
"value": auth.get_student_courses(os.environ['JUPYTERHUB_USER'])
}
AssignmentList.list_courses = list_courses
would you have any idea to use information from user to filter courses in the dropdown course list menu?
best
The text was updated successfully, but these errors were encountered:
Hello,
I am using nbgrader together with z2jh for multiple courses where each course has its own configuration (GPU, CPU, RAM, docker image, etc.). Each user (students & instructors) may be registered in multiple courses, therefore to spawn the correct course & its configuration, before spawning their pod I ask them within
options_form
to choose their course. then in thepre_spawn_hook
I useuser_options
to spawn the correct course. But within the nbgrader assignment list (as shown in the attached picture) they have still the possibility to change the course (while spawner is spun for another course!).I was wondering how I can avoid this. how can I override the function in nbgrader that generates this dropdown courselist menu? how can I pass the correct courses to this menu?
the picture shows that two courses (pyf1 & pyf2) are visible in the course list menu while only pyf1 (which the user has chosen in the options_form) should be visible.
the function you defined in
/etc/jupyter/nbgrader-config.py
.would you have any idea to use information from user to filter courses in the dropdown course list menu?
best
The text was updated successfully, but these errors were encountered: