Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac os working #4316

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions apps/challenges/challenge_config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ def get_value_from_field(data, base_location, field_name):
"duplicate_rank": "ERROR: Duplicate rank {} found in YAML data.",
"prize_amount_wrong": "ERROR: Invalid amount value {}. Amount should be in decimal format with three-letter currency code (e.g. 100.00USD, 500EUR, 1000INR).",
"prize_rank_wrong": "ERROR: Invalid rank value {}. Rank should be an integer.",
"challenge_metadata_schema_errors": "ERROR: Unable to serialize the challenge because of the following errors: {}.",
"evaluation_script_not_zip": "ERROR: Please pass in a zip file as evaluation script. If using the `evaluation_script` directory (recommended), it should be `evaluation_script.zip`.",
}


Expand Down Expand Up @@ -503,24 +505,30 @@ def validate_submission_guidelines_file(self):
def validate_evaluation_script_file(self):
evaluation_script = self.yaml_file_data.get("evaluation_script")
if evaluation_script:
evaluation_script_path = join(
self.challenge_config_location, evaluation_script
)
# Check for evaluation script file in extracted zip folder
if isfile(evaluation_script_path):
self.challenge_evaluation_script_file = (
read_file_data_as_content_file(
evaluation_script_path, "rb", evaluation_script_path
)
)
self.files[
"challenge_evaluation_script_file"
] = self.challenge_evaluation_script_file
else:
if not evaluation_script.endswith('.zip'):
message = self.error_messages_dict.get(
"missing_evaluation_script"
"evaluation_script_not_zip"
)
self.error_messages.append(message)
else:
evaluation_script_path = join(
self.challenge_config_location, evaluation_script
)
# Check for evaluation script file in extracted zip folder
if isfile(evaluation_script_path):
self.challenge_evaluation_script_file = (
read_file_data_as_content_file(
evaluation_script_path, "rb", evaluation_script_path
)
)
self.files[
"challenge_evaluation_script_file"
] = self.challenge_evaluation_script_file
else:
message = self.error_messages_dict.get(
"missing_evaluation_script"
)
self.error_messages.append(message)
else:
message = self.error_messages_dict.get(
"missing_evaluation_script_key"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.20 on 2023-12-01 15:46

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('challenges', '0110_challenge_ephemeral_storage'),
]

operations = [
migrations.AlterField(
model_name='challenge',
name='ephemeral_storage',
field=models.PositiveIntegerField(default=21, verbose_name='Ephemeral Storage (GB)'),
),
]
2 changes: 1 addition & 1 deletion apps/challenges/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def __init__(self, *args, **kwargs):
default=8, verbose_name="EC2 storage (GB)"
)
ephemeral_storage = models.PositiveIntegerField(
default=20, verbose_name="Ephemeral Storage (GB)"
default=21, verbose_name="Ephemeral Storage (GB)"
)
featured = models.BooleanField(
default=False, verbose_name="Featured", db_index=True
Expand Down
5 changes: 5 additions & 0 deletions apps/challenges/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@
views.update_challenge_approval,
name="update_challenge_approval",
),
url(
r"^challenge/update_challenge_attributes/$",
views.update_challenge_attributes,
name="update_challenge_attributes",
),
url(
r"^challenge/(?P<challenge_pk>[0-9]+)/prizes/$",
views.get_prizes_by_challenge,
Expand Down
74 changes: 63 additions & 11 deletions apps/challenges/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3940,7 +3940,7 @@ def create_or_update_github_challenge(request, challenge_host_team_pk):
if serializer.is_valid():
serializer.save()
else:
error_messages = serializer.errors
error_messages = f"leaderboard {data['id']} :{str(serializer.errors)}"
raise RuntimeError()
leaderboard_ids[
str(data["id"])
Expand Down Expand Up @@ -3980,7 +3980,7 @@ def create_or_update_github_challenge(request, challenge_host_team_pk):
if serializer.is_valid():
serializer.save()
else:
error_messages = serializer.errors
error_messages = f"challenge phase {data['id']} :{str(serializer.errors)}"
raise RuntimeError()
challenge_phase_ids[
str(data["id"])
Expand All @@ -3998,7 +3998,7 @@ def create_or_update_github_challenge(request, challenge_host_team_pk):
if serializer.is_valid():
serializer.save()
else:
error_messages = serializer.errors
error_messages = f"dataset split {data['id']} :{str(serializer.errors)}"
raise RuntimeError()
dataset_split_ids[
str(data["id"])
Expand Down Expand Up @@ -4055,7 +4055,7 @@ def create_or_update_github_challenge(request, challenge_host_team_pk):
if serializer.is_valid():
serializer.save()
else:
error_messages = serializer.errors
error_messages = f"challenge phase split (phase:{data['challenge_phase_id']}, leaderboard:{data['leaderboard_id']}, dataset split: {data['dataset_split_id']}):{str(serializer.errors)}"
raise RuntimeError()

zip_config = ChallengeConfiguration.objects.get(
Expand Down Expand Up @@ -4118,7 +4118,7 @@ def create_or_update_github_challenge(request, challenge_host_team_pk):

except: # noqa: E722
response_data = {
"error": "Error in creating challenge. Please check the yaml configuration!"
"error": f"Error in creating challenge: {error_messages}. Please check the yaml configuration!"
}
if error_messages:
response_data["error_message"] = json.dumps(error_messages)
Expand Down Expand Up @@ -4167,7 +4167,7 @@ def create_or_update_github_challenge(request, challenge_host_team_pk):
if serializer.is_valid():
serializer.save()
else:
error_messages = serializer.errors
error_messages = f"challenge :{str(serializer.errors)}"
raise RuntimeError()
challenge = serializer.instance

Expand Down Expand Up @@ -4213,7 +4213,7 @@ def create_or_update_github_challenge(request, challenge_host_team_pk):
serializer.save()
leaderboard_ids[str(data["id"])] = serializer.instance.pk
else:
error_messages = serializer.errors
error_messages = f"leaderboard update {(data['id'])} :{str(serializer.errors)}"
raise RuntimeError()

# Updating ChallengePhase objects
Expand Down Expand Up @@ -4278,7 +4278,7 @@ def create_or_update_github_challenge(request, challenge_host_team_pk):
str(data["id"])
] = serializer.instance.pk
else:
error_messages = serializer.errors
error_messages = f"challenge phase update {(data['id'])} :{str(serializer.errors)}"
raise RuntimeError()

# Updating DatasetSplit objects
Expand All @@ -4305,7 +4305,7 @@ def create_or_update_github_challenge(request, challenge_host_team_pk):
serializer.save()
dataset_split_ids[str(data["id"])] = serializer.instance.pk
else:
error_messages = serializer.errors
error_messages = f"dataset split update {(data['id'])} :{str(serializer.errors)}"
raise RuntimeError()

# Update ChallengePhaseSplit objects
Expand Down Expand Up @@ -4366,7 +4366,7 @@ def create_or_update_github_challenge(request, challenge_host_team_pk):
if serializer.is_valid():
serializer.save()
else:
error_messages = serializer.errors
error_messages = f"challenge phase split update (phase:{data['challenge_phase_id']}, leaderboard:{data['leaderboard_id']}, dataset split: {data['dataset_split_id']}):{str(serializer.errors)}"
raise RuntimeError()

response_data = {
Expand All @@ -4377,7 +4377,7 @@ def create_or_update_github_challenge(request, challenge_host_team_pk):
return Response(response_data, status=status.HTTP_200_OK)
except: # noqa: E722
response_data = {
"error": "Error in creating challenge. Please check the yaml configuration!"
"error": f"Error in creating challenge: {error_messages}. Please check the yaml configuration!"
}
if error_messages:
response_data["error_message"] = json.dumps(error_messages)
Expand Down Expand Up @@ -4767,6 +4767,58 @@ def update_challenge_approval(request):
return Response(response_data, status=status.HTTP_200_OK)


@api_view(["POST"])
@throttle_classes([UserRateThrottle])
@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))
@authentication_classes((JWTAuthentication, ExpiringTokenAuthentication))
def update_challenge_attributes(request):
"""
API to update attributes of the Challenge model
Arguments:
request {dict} -- Request object

Query Parameters:
challenge_pk {int} -- Challenge primary key
**kwargs {any} -- Key-value pairs representing attributes and their new values
"""
if not request.user.is_staff:
response_data = {
"error": "Sorry, you are not authorized to access this resource!"
}
return Response(response_data, status=status.HTTP_401_UNAUTHORIZED)

challenge_pk = request.data.get("challenge_pk")

if not challenge_pk:
response_data = {
"error": "Challenge primary key is missing!"
}
return Response(response_data, status=status.HTTP_400_BAD_REQUEST)

try:
challenge = Challenge.objects.get(pk=challenge_pk)
except Challenge.DoesNotExist:
response_data = {
"error": f"Challenge with primary key {challenge_pk} not found!"
}
return Response(response_data, status=status.HTTP_404_NOT_FOUND)

# Update attributes based on the request data
for key, value in request.data.items():
if key != "challenge_pk" and hasattr(challenge, key):
setattr(challenge, key, value)

try:
challenge.save()
except Exception as e:
return Response({"error": str(e)}, status=status.HTTP_400_BAD_REQUEST)

response_data = {
"message": f"Challenge attributes updated successfully for challenge with primary key {challenge_pk}!"
}
return Response(response_data, status=status.HTTP_200_OK)


@api_view(["PUT"])
@throttle_classes([UserRateThrottle])
@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))
Expand Down
20 changes: 10 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ services:
volumes:
- .:/code

worker_py3_8:
env_file:
- docker/dev/docker.env
build:
context: ./
dockerfile: docker/dev/worker_py3.8/Dockerfile
depends_on:
- django
volumes:
- .:/code
# worker_py3_8:
# env_file:
# - docker/dev/docker.env
# build:
# context: ./
# dockerfile: docker/dev/worker_py3.8/Dockerfile
# depends_on:
# - django
# volumes:
# - .:/code

nodejs:
hostname: nodejs
Expand Down
2 changes: 1 addition & 1 deletion docker/dev/celery/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7.5
FROM python:3.8

ENV PYTHONUNBUFFERED 1

Expand Down
2 changes: 1 addition & 1 deletion docker/dev/django/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7.5
FROM python:3.8

ENV PYTHONUNBUFFERED 1

Expand Down
2 changes: 1 addition & 1 deletion docker/dev/nodejs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.20.0
FROM --platform=linux/amd64 node:14.20.1

# install chrome for protractor tests
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
Expand Down
2 changes: 1 addition & 1 deletion docker/dev/nodejs_v2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:12.2.0
FROM --platform=linux/amd64 node:14.20.1

RUN npm install -g @angular/[email protected]
WORKDIR /code
Expand Down
2 changes: 1 addition & 1 deletion docker/dev/worker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7.5
FROM python:3.8

ENV PYTHONUNBUFFERED 1

Expand Down
2 changes: 1 addition & 1 deletion requirements/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Pillow==7.1.0
psycopg2==2.8.4
pycurl==7.43.0.6
PyJWT==2.1.0
PyYaml==5.1
PyYaml>=5.4
proc==1.0
rstr==2.2.6
sendgrid==6.4.8
Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
-r common.txt

autopep8==1.5.4
black==20.8b1
coverage==5.3
coveralls==2.2.0
cfn-lint==0.60.0
django-autofixture==0.12.1
django-debug-toolbar==3.2.1
django-extensions==3.1.0
Expand Down
5 changes: 3 additions & 2 deletions requirements/worker.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
setuptools==59.2
matplotlib==3.3.3
networkx==2.5
numpy==1.21.0
numpy==1.20.0
pandas==1.1.4
pycocotools==2.0.2
scipy==1.5.4
scikit-learn==0.23.2
scikit-learn==0.24.0
tqdm==4.54.0
30 changes: 4 additions & 26 deletions scripts/monitoring/auto_scale_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,6 @@
warnings.filterwarnings("ignore")

utc = pytz.UTC
PROD_EXCLUDED_CHALLENGE_QUEUES = [
"textvqa-challenge-2021-874-production-41966973-4d99-4326-a402-b749b1d89aad",
"vqa-challenge-2021-830-production-6343db53-af82-4618-8c51-0e294611315a",
"ego4d-state-change-object-detection-challenge-1632",
"argoverse-3d-tracking-competition-52b36364-110d-47f1-8fa7-8873aa2d9965",
"argoverse-motion-forecasting-competition-81d1a3c6-f7b3-4830-9dcf-3ccc9f29d3a6",
"argoverse-3d-detection-competition-725-71837a72-afb0-4403-9cfc-bb3e80d733ab",
"argoverse-stereo-competition-917-production-884becea-a882-43bd-8ac7-0561bd705c4e",
"nuscenes-prediction-challenge-448a7b5e-6b08-4587-9293-ac07a530b426",
"nuscenes-detection-challenge-510c8c6d-a0d2-40bd-95dd-b7c8ea593d03",
"gqa-real-world-visual-reasoning-challenge-2019-2e1c901b-5d86-4516-b82d-8d98",
"nocaps-xd-9f4bead9-b3d6-4207-8e68-a6807d786c3c",
"nocaps-18b403b5-8946-4319-9fc1-758981f7f724",
"nuscenes-tracking-challenge-b1ea8e46-cee9-4591-856a-7c31947d74ed",
"ego4d-poc-your-challenge-name--1637-production-bfb81565-71fd-4b7b-949d-2560dd523",
"ego4d-poc-your-challenge-name--1624-production-6e1419b9-f909-4428-951d-6e927676f",
"dialoglue-708-d2225333-1ade-41c5-bb0c-c02c15d43e05",
"vizwiz-caption-challenge-2021-739-production-a6420029-bf1c-4339-9c55-36a8913cca8",
"textcaps-challenge-2020-906-production-fcc74455-ce3e-4622-b6fe-0340bcc3d228",
"vizwiz-vqa-challenge-2021-743-production-862e0cf8-0611-4aa5-a05a-14e07576a513",
"cvpr2023-bdd100k-multiple-object-tracking-challeng-1989-production-cdba4595-fb13",
]

ENV = os.environ.get("ENV", "dev")

Expand Down Expand Up @@ -113,11 +91,11 @@ def scale_up_or_down_workers(challenge, challenge_metrics):
def scale_up_or_down_workers_for_challenges(response, metrics):
for challenge in response["results"]:
if ENV == "prod":
if challenge["queue"] not in PROD_EXCLUDED_CHALLENGE_QUEUES:
try:
try:
if challenge["remote_evaluation"] is False:
scale_up_or_down_workers(challenge, metrics[str(challenge["id"])])
except Exception as e:
print(e)
except Exception as e:
print(e)
else:
try:
scale_up_or_down_workers(challenge, metrics[str(challenge["id"])])
Expand Down
Loading