Skip to content

Commit

Permalink
Merge branch 'master' into if-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamjajoo authored Aug 16, 2021
2 parents b8c095e + c9b05b5 commit c6ece7b
Show file tree
Hide file tree
Showing 73 changed files with 1,554 additions and 1,319 deletions.
1 change: 1 addition & 0 deletions apps/challenges/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class Meta:
"cli_version",
"remote_evaluation",
"workers",
"created_at",
)


Expand Down
12 changes: 11 additions & 1 deletion apps/challenges/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
)

from .aws_utils import (
delete_workers,
start_workers,
stop_workers,
restart_workers,
Expand Down Expand Up @@ -2822,12 +2823,19 @@ def manage_worker(request, challenge_pk, action):
return Response(response_data, status=status.HTTP_400_BAD_REQUEST)

# make sure that the action is valid.
if action not in ("start", "stop", "restart"):
if action not in ("start", "stop", "restart", "delete"):
response_data = {
"error": "The action {} is invalid for worker".format(action)
}
return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)

# Only allow EvalAI admins to delete workers
if action == "delete" and not request.user.is_staff:
response_data = {
"error": "Sorry, you are not authorized for access worker operations."
}
return Response(response_data, status=status.HTTP_400_BAD_REQUEST)

challenge = get_challenge_model(challenge_pk)

response_data = {}
Expand All @@ -2838,6 +2846,8 @@ def manage_worker(request, challenge_pk, action):
response = stop_workers([challenge])
elif action == "restart":
response = restart_workers([challenge])
elif action == "delete":
response = delete_workers([challenge])

if response:
count, failures = response["count"], response["failures"]
Expand Down
6 changes: 6 additions & 0 deletions apps/jobs/sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from base.utils import send_slack_notification
from challenges.models import Challenge
from .utils import get_submission_model
from monitoring.statsd.metrics import NUM_SUBMISSIONS_IN_QUEUE, increment_statsd_counter

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -83,6 +84,11 @@ def publish_submission_message(message):
queue_name = challenge.queue
slack_url = challenge.slack_webhook_url
queue = get_or_create_sqs_queue(queue_name)
# increase counter for submission pushed into queue
submission_metric_tags = [
"queue_name:%s" % queue_name,
]
increment_statsd_counter(NUM_SUBMISSIONS_IN_QUEUE, submission_metric_tags, 1)
response = queue.send_message(MessageBody=json.dumps(message))
# send slack notification
if slack_url:
Expand Down
37 changes: 33 additions & 4 deletions apps/jobs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
get_challenge_model,
get_challenge_phase_model,
get_challenge_phase_split_model,
get_participant_model,
)
from hosts.models import ChallengeHost
from hosts.utils import is_user_a_host_of_challenge
Expand Down Expand Up @@ -2824,7 +2825,35 @@ def update_submission_meta(request, challenge_pk, submission_pk):
serializer.errors, status=status.HTTP_400_BAD_REQUEST
)
else:
response_data = {
"error": "Sorry, you are not authorized to make this request"
}
return Response(response_data, status=status.HTTP_403_FORBIDDEN)
participant_team_pk = get_participant_team_id_of_user_for_a_challenge(
request.user, challenge_pk
)

participant_team = get_participant_model(participant_team_pk)

try:
submission = Submission.objects.get(
id=submission_pk,
participant_team=participant_team,
)
except Submission.DoesNotExist:
response_data = {
"error": "Submission {} does not exist".format(submission_pk)
}
return Response(response_data, status=status.HTTP_404_NOT_FOUND)

serializer = SubmissionSerializer(
submission,
data=request.data,
context={"request": request},
partial=True,
)

if serializer.is_valid():
serializer.save()
response_data = serializer.data
return Response(response_data, status=status.HTTP_200_OK)
else:
return Response(
serializer.errors, status=status.HTTP_400_BAD_REQUEST
)
4 changes: 3 additions & 1 deletion docker-compose-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ services:
- '--log.level=info'
- '--web.telemetry-path=/statsd/metrics'
ports:
- '9125:9125'
- '9125:9125/udp'
- '9125:9125/tcp'
- '9102:9102'

node_exporter:
Expand All @@ -149,6 +150,7 @@ services:
depends_on:
- prometheus
- grafana
- statsd-exporter
ports:
- '80:80'
- '443:443'
2 changes: 1 addition & 1 deletion docker/prod/docker_staging.env
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ GF_SECURITY_ADMIN_PASSWORD=x
GF_SERVER_ROOT_URL=http://localhost:3000/grafana
GF_SERVER_SERVE_FROM_SUB_PATH=true

STATSD_ENDPOINT=statsd
STATSD_ENDPOINT=x
STATSD_PORT=9125
14 changes: 12 additions & 2 deletions docker/prod/nginx-ingress/nginx_staging.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ upstream grafana {
server grafana:3000 fail_timeout=0;
}

upstream statsd_exporter {
server statsd:9102 fail_timeout=0;
}

server {
server_name monitoring-staging.eval.ai;
listen 80;
Expand Down Expand Up @@ -34,14 +38,20 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass https://prometheus;
proxy_pass http://prometheus;
}

location /grafana {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass https://grafana;
proxy_pass http://grafana;
}

location /statsd {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://statsd_exporter;
}
}
11 changes: 0 additions & 11 deletions docker/prod/nodejs/nginx_staging.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ upstream django_app {
server django:8000 fail_timeout=0;
}

upstream statsd_exporter {
server statsd:9102 fail_timeout=0;
}

upstream node_exporter {
server node_exporter:9100 fail_timeout=0;
}
Expand Down Expand Up @@ -61,13 +57,6 @@ server {
proxy_pass http://django_app;
}

location /statsd {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://statsd_exporter;
}

location /node_exporter {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
Expand Down
11 changes: 0 additions & 11 deletions docker/prod/nodejs_v2/nginx_staging.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ upstream django_app {
server django:8000 fail_timeout=0;
}

upstream statsd_exporter {
server statsd:9102 fail_timeout=0;
}

upstream node_exporter {
server node_exporter:9100 fail_timeout=0;
}
Expand Down Expand Up @@ -52,13 +48,6 @@ server {
proxy_pass http://django_app;
}

location /statsd {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://statsd_exporter;
}

location /node_exporter {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
Expand Down
80 changes: 51 additions & 29 deletions frontend/src/css/modules/leaderboard.scss
Original file line number Diff line number Diff line change
@@ -1,60 +1,61 @@
/* Styles for leaderboard page */

.horizontal-scroll {
overflow-x: auto;
overflow-x: auto;
}


#baseline-badge {
font-weight: 300;
min-width: 0rem;
font-size: 16px;
float: right;
margin-left: 5px;
font-weight: 300;
min-width: 0rem;
font-size: 16px;
float: right;
margin-left: 5px;
}

#baseline-badge-desc {
font-weight: 300;
min-width: 0rem;
font-size: 16px;
margin-left: 0px;
float: none;
font-weight: 300;
min-width: 0rem;
font-size: 16px;
margin-left: 0px;
float: none;

}

#verified-badge {
font-weight: 300;
min-width: 0rem;
font-size: 16px;
float: right;
margin-left: 5px;
font-weight: 300;
min-width: 0rem;
font-size: 16px;
float: right;
margin-left: 5px;
}

#verified-badge-desc {
font-weight: 300;
min-width: 0rem;
font-size: 16px;
margin-left: 0px;
float: none;
font-weight: 300;
min-width: 0rem;
font-size: 16px;
margin-left: 0px;
float: none;
}

.highlightLeaderboard {
border-color: #fff3e0;
box-shadow: 0 0 0 0.2em #ffcc80 !important;
border: 1px solid #d1d5da;
border-radius: 3px;
border-color: #fff3e0;
box-shadow: 0 0 0 0.2em #ffcc80 !important;
border: 1px solid #d1d5da;
border-radius: 3px;
background-color: #f2f2f2;
}

.sort-leaderboard-switch {
vertical-align: middle;
display: inline-block;
vertical-align: middle;
display: inline-block;
}

.baseline-tag {
margin-right: 4%;
margin-right: 4%;
}
.complete-leaderboard {
vertical-align:top;
vertical-align:top;
}

span.badge.partial-evaluation {
Expand All @@ -66,3 +67,24 @@ span.badge.partial-evaluation {
float: left;
box-sizing: border-box;
}

.leaderboard-label .description {
visibility: hidden;
width: auto;
max-width: 250px;
height: auto;
background-color: #f2f2f2;
color: #000000;
text-align: center;
border-radius: 6px;
padding: 10px 10px 10px 10px;
font-size: 1.05rem;

/* Position the tooltip */
position: absolute;
z-index: 1;
}

.leaderboard-label:hover .description {
visibility: visible;
}
Loading

0 comments on commit c6ece7b

Please sign in to comment.