SACGF / variantgrid

VariantGrid public repo
Other
23 stars 2 forks source link

Consider moving upgrader into VG code as app #1073

Open davmlaw opened 5 months ago

davmlaw commented 5 months ago

Consider moving the upgrade script / migrator into an app - I would say either a new "upgrade" app or potentially move it into "manual"

Advantages would be:

For instance, the following takes 22 secs on my machine:

python3 manage.py migrate;python3 manage.py collectstatic_js_reverse;python3 manage.py collectstatic -v 0 --noinput

While this takes less than 7 secs:

for argv in [["migrate"], ["collectstatic_js_reverse"], ["collectstatic", "-v", "0", "--noinput"]]:
    utility = ManagementUtility(["manage.py"] + argv)
    utility.execute()

James says:

So the only problem with that is the upgrader also triggers a git pull and then runs the code post git pull. But the existing upgrade.sh could easily call git pull, and then invoke an app, and as you say, that would save the "upgrader" from having to startup VariantGrid several times for one deploy.

davmlaw commented 3 months ago

There is also call_command - see https://docs.djangoproject.com/en/5.0/ref/django-admin/#running-management-commands-from-your-code