-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
24f8609
commit 12d6acd
Showing
2 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -321,7 +321,7 @@ | |
}, | ||
"subscriber": { | ||
"nproc": 8, | ||
"time": 6 * 60, | ||
"time": 24 * 60, | ||
}, | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |