forked from codalab/codalab-competitions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/codalab/codalab
- Loading branch information
Showing
12 changed files
with
175 additions
and
73 deletions.
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 |
---|---|---|
@@ -0,0 +1,88 @@ | ||
from django.core.management.base import BaseCommand, CommandError | ||
from apps.web.models import Competition,CompetitionPhase,CompetitionParticipant,CompetitionSubmission | ||
from django.contrib.auth import get_user_model | ||
User = get_user_model() | ||
from optparse import make_option | ||
|
||
from django.core.files.base import File | ||
|
||
class Command(BaseCommand): | ||
help = "Creates a submission for a participant" | ||
|
||
option_list = BaseCommand.option_list + ( | ||
make_option('--email', | ||
dest='email', | ||
help="Email of the user"), | ||
make_option('--competition', | ||
dest='competition', | ||
default=None, | ||
help="ID of the submission"), | ||
make_option('--phase', | ||
dest='phase', | ||
default=None, | ||
help="ID of the competition phase"), | ||
make_option('--submission', | ||
dest='submission', | ||
default=None, | ||
help="Path to the submission file"), | ||
|
||
) | ||
|
||
def handle(self, *args, **options): | ||
competition_id = options['competition'] | ||
phase_id = options['phase'] | ||
submission = options['submission'] | ||
competition = None | ||
phase = None | ||
if not options['email']: | ||
print " ERROR ... Email Required ... " | ||
exit(1) | ||
if not submission: | ||
print " ERROR ... Submission File Required ... " | ||
exit(1) | ||
|
||
user = User.objects.get(email=options['email']) | ||
while not competition and not phase: | ||
if competition_id and phase_id: | ||
try: | ||
phase = CompetitionPhase.objects.get(pk=phase_id, competition__pk=competition_id) | ||
break | ||
except Competition.DoesNotExist: | ||
pass | ||
else: | ||
print "Competition/Phase not specified or not valid:\n" | ||
|
||
clist = CompetitionPhase.objects.order_by('competition__pk').all() | ||
if not clist: | ||
print " ... There are no competitions ..." | ||
exit(1) | ||
sel = [] | ||
i = 0 | ||
for c in clist: | ||
sel.append((c.competition,c)) | ||
print " %d) %s - %s" % (i+1,c.competition.title,c.label) | ||
i = i + 1 | ||
try: | ||
inp = int(raw_input("\n Enter number --> ")) | ||
idx = inp - 1 | ||
competition = sel[idx][0] | ||
phase = sel[idx][1] | ||
except ValueError: | ||
print " ... Bad Input ... " | ||
competition_id = None | ||
continue | ||
except Exception as e: | ||
print e | ||
|
||
part = CompetitionParticipant.objects.get(user=user, | ||
competition=competition | ||
) | ||
submission_file = File(open(options['submission'],'rb')) | ||
|
||
s = CompetitionSubmission.objects.create(participant=part,phase=phase,file=submission_file) | ||
|
||
print "OK. Submission Created" | ||
|
||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,32 @@ | ||
from __future__ import absolute_import | ||
|
||
from celery import Celery | ||
from celery import task | ||
|
||
celery = Celery('tasks', backend='amqp', ) | ||
celery.config_from_object('celeryconfig') | ||
|
||
# Optional configuration, see the application user guide. | ||
celery.conf.update( | ||
CELERY_TASK_RESULT_EXPIRES=3600, | ||
) | ||
|
||
|
||
# Tasks for competitions | ||
# Currently stubs to test functionality | ||
@task | ||
def evaluate_submission(location): | ||
# evaluate(inputdir,standard,outputdir) | ||
|
||
def validate_submission(url): | ||
""" | ||
Will validate the format of a submission. | ||
""" | ||
return url | ||
|
||
@task | ||
def evaluate_submission(url): | ||
# evaluate(inputdir, standard, outputdir) | ||
return url | ||
|
||
|
||
# For starting the process | ||
if __name__ == '__main__': | ||
celery.start() |
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
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
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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[ODBC] | ||
Trace = Yes | ||
Trace = No | ||
TraceFile = /tmp/odbc-{{DB_NAME}}.log | ||
|
||
[FreeTDS] | ||
|
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
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,7 @@ | ||
#!/bin/bash | ||
|
||
source ./config/generated/startup_env.sh | ||
echo " .... " | ||
echo "$DJANGO_CONFIGURATION Configuration" | ||
echo " .... " | ||
python manage.py "$@" |
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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
#!/bin/bash | ||
|
||
THIS_DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
pushd `pwd` > /dev/null | ||
cd $THIS_DIR | ||
|
||
source ./config/generated/startup_env.sh | ||
echo " .... " | ||
echo "$DJANGO_CONFIGURATION Configuration" | ||
echo " .... " | ||
python manage.py runserver $1 $2 | ||
/bin/bash manage runserver "$@" | ||
popd |
This file was deleted.
Oops, something went wrong.
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