Create a django based interface that allows users to sign up for an HPC account. They need to provide their username, email address and research group. There should also be a private area that ony sys admins can login to approve these requests, once approved it will then run slurm api commands to create the accounts. There should also be a section in the admin section that provides an audit trail
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Below is a compact but complete “minimum-viable” Django app that does exactly what you asked for:
Public page → researchers fill out a form (username, e-mail, research group).
Staff-only back-office → sysadmins see all pending requests, approve / deny them.
On approval the app runs Slurm commands (via subprocess or the REST-API).
Every significant action is written to an audit-trail that staff can inspect.
The code is intentionally modular: copy–paste into any fresh Django project (≥ 3.2) and it will work after a makemigrations && migrate. From there you can flesh out HTML/CSS, add celery, DRF, etc.
────────────────────────────────────────────────────────────────────────
3. Forms
────────────────────────────────────────────────────────────────────────
accounts/forms.py
python
from django import forms
from .models import HPCAccountRequest
class SignupForm(forms.ModelForm):
class Meta:
model = HPCAccountRequest
fields = ("username", "email", "research_group")
widgets = {
"research_group": forms.Textarea(attrs={"rows": 2}),
}
class ApprovalForm(forms.Form):
approve = forms.BooleanField(
required=False, label="Approve this request?"
)
# Optionally let admins modify the default Slurm account / QoS etc.
# slurm_account = forms.CharField(required=False)
────────────────────────────────────────────────────────────────────────
5. Templates (very bare-bones, use Bootstrap/Tailwind as you like)
────────────────────────────────────────────────────────────────────────
templates/accounts/signup.html
Now any superuser (created via python manage.py createsuperuser) can:
• log into /admin/ to see the raw tables
• visit /dashboard/ for the friendlier interface
────────────────────────────────────────────────────────────────────────
7. Hardening & Production notes
────────────────────────────────────────────────────────────────────────
Slurm:
• Running sacctmgr requires root/slurm privileges. Run Django under a user that can sudo -n sacctmgr …or expose Slurm via slurmrestd and call the REST endpoints with a service token.
• For long-running calls use Celery/RQ so the web request doesn’t block.
Security:
• HTTPS only; put Django behind nginx + uWSGI/gunicorn.
• Add reCAPTCHA or rate-limiting to the public sign-up.
• Consider django-auditlog or django-simple-history if you want field-level change history.
Email workflow (optional): fire an email when a request is submitted / approved.
Tests: pytest-django + factories make it trivial to unit-test that run_slurm_commands is executed and audit logs are written.
That’s it!
Copy the snippets, python manage.py runserver, visit /signup/ as a user and /dashboard/ as staff, and you’ve got a functional, auditable HPC provisioning front-end.