Skip to content

Commit

Permalink
Merge branch 'develop-ui' into develop-backend-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchellAV committed Aug 1, 2024
2 parents f3a9453 + 0d09e9a commit 0dd0665
Show file tree
Hide file tree
Showing 16 changed files with 172 additions and 240 deletions.
7 changes: 6 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
djangosk=django-insecure-y&pp1if&0y)pxtmqf_@o1br(&-6mrxv**f5%&73d@d51kscvg!
POSTGRES_PASSWORD=valhub
POSTGRES_USER=valhub
POSTGRES_USER=valhub
admin_username=admin
admin_password=admin
admin_email=[email protected]
DOCKER_HOST_VOLUME_DATA_DIR="<path-to-repository>/<repo-name>/workers/current_evaluation/data"
DOCKER_HOST_VOLUME_RESULTS_DIR="<path-to-repository>/<repo-name>/workers/current_evaluation/results"
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ services:
- ./workers/tmp:/tmp
- ./workers/requirements.txt:/root/worker/requirements.txt
- ./workers/src:/root/worker/src
- type: bind
source: ~/.aws
target: /root/.aws
# - type: bind
# source: ~/.aws
# target: /root/.aws
restart: unless-stopped
develop:
watch:
Expand Down
2 changes: 1 addition & 1 deletion ec2/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"category_name": "Time Shift Analysis",
"category_name": "Quick Dev TS",
"function_name": "detect_time_shifts",
"comparison_type": "time_series",
"performance_metrics": [
Expand Down
2 changes: 1 addition & 1 deletion pv-validation-hub-client
Submodule pv-validation-hub-client updated 38 files
+ public/static/assets/1/cardCover.png
+ public/static/assets/2/banner.png
+ public/static/assets/2/cardCover.png
+0 −0 public/static/assets/3/SubmissionInstructions.md
+ public/static/assets/3/absolute_error_az_dist.png
+ public/static/assets/3/absolute_error_tilt_dist.png
+ public/static/assets/3/banner.png
+ public/static/assets/3/cardCover.png
+0 −0 public/static/assets/3/dataset.md
+0 −0 public/static/assets/3/description.md
+ public/static/assets/3/run_time_dist.png
+ public/static/assets/3/run_time_number_days.png
+0 −0 public/static/assets/3/shortdesc.md
+ public/static/assets/3/time_series_data.PNG
+ public/static/assets/resources/1/cardCover.png
+3 −0 public/static/assets/resources/1/shortdesc.md
+ public/static/assets/resources/2/cardCover.png
+3 −0 public/static/assets/resources/2/shortdesc.md
+ public/static/assets/resources/3/cardCover.png
+3 −0 public/static/assets/resources/3/shortdesc.md
+ public/static/assets/resources/4/cardCover.png
+3 −0 public/static/assets/resources/4/shortdesc.md
+64 −15 src/app/(analyses)/analyses/analysis/page.tsx
+6 −2 src/app/(mysubmissions)/mysubmissions/private_report/page.tsx
+60 −5 src/app/(resources)/resources/page.tsx
+10 −1 src/app/globals.css
+9 −5 src/app/modules/analyses/customcard.tsx
+13 −17 src/app/modules/analyses/leaderboard/leaderboard.tsx
+0 −4 src/app/modules/analyses/upload/uploader.tsx
+7 −4 src/app/modules/elink/elink.tsx
+30 −9 src/app/modules/header/header.tsx
+1 −1 src/app/modules/homepage/demoTable.tsx
+15 −0 src/app/modules/modulecss/header.module.css
+0 −1 src/app/modules/mysubmissions/marimo/marimoprocessor.tsx
+11 −7 src/app/modules/mysubmissions/reportItem.tsx
+85 −0 src/app/modules/resources/resourcecard.tsx
+1 −8 src/services/dashboard_service.tsx
+0 −3 src/services/submission_service.tsx

This file was deleted.

This file was deleted.

28 changes: 28 additions & 0 deletions valhub/submissions/migrations/0008_auto_20240730_1750.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 3.2.16 on 2024-07-30 17:50

import django.contrib.postgres.fields
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("submissions", "0007_alter_submission_result"),
]

operations = [
migrations.RemoveField(
model_name="submission",
name="mae",
),
migrations.AlterField(
model_name="submission",
name="data_requirements",
field=django.contrib.postgres.fields.ArrayField(
base_field=models.CharField(max_length=100),
blank=True,
default=list,
size=None,
),
),
]
5 changes: 4 additions & 1 deletion valhub/submissions/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.db import models
from django.contrib.postgres.fields import ArrayField

from analyses.models import Analysis
from base.utils import RandomFileName
Expand Down Expand Up @@ -47,7 +48,9 @@ class Submission(models.Model):
alt_name = models.TextField(null=True, blank=True, default="")
# mrt - mean run time
mrt = models.FloatField(null=True, blank=True)
data_requirements = models.TextField(null=True, blank=True)
data_requirements = ArrayField(
models.CharField(max_length=100), blank=True, default=list
)
archived = models.BooleanField(default=False)
python_version = models.DecimalField(
max_digits=4,
Expand Down
49 changes: 31 additions & 18 deletions valhub/submissions/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,22 +135,35 @@ def to_representation(self, instance):
"username": instance.created_by.username,
}

# Attempt to load the stringified array from the text field
try:
data_requirements = json.loads(instance.data_requirements)
# Ensure that the loaded object is a list
if not isinstance(data_requirements, list):
raise ValueError(
"Loaded object is not a list"
) # Include a message with the ValueError
except (ValueError, TypeError) as e:
logger.error(
f"Failed to parse data_requirements for submission {instance.submission_id}: {e}"
)
logger.error(f"With a value of {instance.data_requirements}")
data_requirements = (
[]
) # Default to an empty list if any error occurs

data["data_requirements"] = data_requirements
return data


class SubmissionPrivateReportSerializer(serializers.ModelSerializer):
"""
Serialize the private report of Submission Model.
"""

class Meta:
model = Submission
fields = (
"submission_id",
"result",
"mrt",
"data_requirements",
"submitted_at",
"alt_name",
"archived",
"python_version",
"worker_version",
)

def to_representation(self, instance):
data = super(
SubmissionPrivateReportSerializer, self
).to_representation(instance)
data["created_by"] = {
"uuid": instance.created_by.uuid,
"username": instance.created_by.username,
}

return data
17 changes: 16 additions & 1 deletion valhub/submissions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
from .models import Submission
from urllib.parse import urljoin

from .serializers import SubmissionSerializer, SubmissionDetailSerializer
from .serializers import (
SubmissionSerializer,
SubmissionDetailSerializer,
SubmissionPrivateReportSerializer,
)
from .models import Submission


Expand Down Expand Up @@ -273,6 +277,11 @@ def update_submission_result(request: Request, submission_id: str):
response_data = {"error": f"{field} is required"}
return Response(response_data, status=status.HTTP_400_BAD_REQUEST)

# Validate that function_parameters is a list
if not isinstance(results["function_parameters"], list):
response_data = {"error": "function_parameters must be a list"}
return Response(response_data, status=status.HTTP_400_BAD_REQUEST)

logging.info(f"results = {results}")
submission.mrt = float(results["mean_run_time"])
submission.data_requirements = results["function_parameters"]
Expand Down Expand Up @@ -375,6 +384,9 @@ def leaderboard_update(request: Request):
submission.mrt = float(mrt)

if data_requirements is not None:
if isinstance(data_requirements, str):
# Convert the string to a list of strings
data_requirements = [data_requirements]
submission.data_requirements = data_requirements

submission.save()
Expand Down Expand Up @@ -543,6 +555,9 @@ def get_submission_results(request: Request, submission_id: str):
# set returns
logging.info(f"setting returns")
ret["marimo_url"] = file_urls
ret["submission_details"] = SubmissionPrivateReportSerializer(
submission
).data

return JsonResponse(ret, status=status.HTTP_200_OK)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.16 on 2024-07-30 17:50

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("system_metadata", "0001_initial"),
]

operations = [
migrations.AlterField(
model_name="systemmetadata",
name="dc_capacity",
field=models.FloatField(default=0.0),
),
]
Loading

0 comments on commit 0dd0665

Please sign in to comment.