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

adding service to profile-list #7

Open
bpfrd opened this issue Jan 12, 2024 · 0 comments
Open

adding service to profile-list #7

bpfrd opened this issue Jan 12, 2024 · 0 comments

Comments

@bpfrd
Copy link

bpfrd commented Jan 12, 2024

Hi,

I added the below code to choose the appropriate image when a student/teacher is registered in multiple courses and each course has a different image:

        async def dynamic_options_form(spawner):
          profile_list = []
          username = spawner.user.name
          groups = [group.name for group in spawner.user.groups]
          courses = [group.split('-', 1) for group in groups if group.startswith("formgrade-") or group.startswith("nbgrader-")]

          # getting profiles for username
          for idx, (g,course) in enumerate(courses):
            if g == 'formgrade':
              profile_list.extend([COURSES[course]['instructorsProfile']])
            else:
              profile_list.extend([COURSES[course]['studentsProfile']])
            if idx == 0:
              profile_list[idx]['default'] = True
          spawner.profile_list = profile_list
          return spawner._options_form_default()

        c.KubeSpawner.options_form = dynamic_options_form

How is it possible to set the service in the same function so that the instructors don't need to choose/switch services?
in the current version of the code, the services are running on hub and the instructors must choose a service (which changes their container from instructors-image to hub) before they can create assignments.

best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant