Skip to content

Commit

Permalink
Raised the max runtime to 24 hours
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelRobidas committed Jan 19, 2024
1 parent 24f8609 commit 12d6acd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion calcus/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
},
"subscriber": {
"nproc": 8,
"time": 6 * 60,
"time": 24 * 60,
},
}

Expand Down
29 changes: 29 additions & 0 deletions frontend/management/commands/add_resources.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import os
from django.core.management.base import BaseCommand

from frontend.models import *
from frontend.environment_variables import *
from frontend.tasks import run_calc
from frontend.helpers import get_random_string


class Command(BaseCommand):
help = "Runs a calculation"

def add_arguments(self, parser):
parser.add_argument("email", type=str)
parser.add_argument("time", type=int)

def handle(self, *args, **options):
email = options["email"]
time = options["time"]
try:
u = User.objects.get(email=email)
except User.DoesNotExist:
raise Exception(f"Could not find user with email {email}")
random_code = get_random_string(64)

res = ResourceAllocation.objects.create(
code=random_code, note=ResourceAllocation.MANUAL, allocation_seconds=time
)
res.redeem(u)

0 comments on commit 12d6acd

Please sign in to comment.