-
Notifications
You must be signed in to change notification settings - Fork 786
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
Add backend for GitHub challenges #2965
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2965 +/- ##
==========================================
+ Coverage 72.93% 74.03% +1.09%
==========================================
Files 83 20 -63
Lines 5368 3019 -2349
==========================================
- Hits 3915 2235 -1680
+ Misses 1453 784 -669
Continue to review full report at Codecov.
|
else: | ||
message = (" ERROR: There is no html file present for key" | ||
" {} in phase {}.".format(key, yaml_file_data["name"])) | ||
is_valid = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KhalidRmb why is this check removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the validation inside the challenge create API is such that it allows an invalid value for the file. It just replaces it with null before moving on. Validation fails if the entire key is missing. @Ram81 (I'd discussed this with you when working on this, and we decided to keep it this way)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't get the reason for the removal of this check. Can we please discuss about this on slack channel.
|
||
|
||
def get_value_from_field(data, base_location, field_name): | ||
file_path = join(base_location, data.get(field_name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about exception handling for missing values for a field name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the value is missing, this function will return None. In accordance with the validation. (This is also what happens in the create challenge API)
else: | ||
message = (" ERROR: There is no html file present for key" | ||
" {} in phase {}.".format(key, yaml_file_data["name"])) | ||
is_valid = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't get the reason for the removal of this check. Can we please discuss about this on slack channel.
@@ -196,6 +200,7 @@ def create_eks_cluster_for_challenge(sender, instance, created, **kwargs): | |||
class DatasetSplit(TimeStampedModel): | |||
name = models.CharField(max_length=100) | |||
codename = models.CharField(max_length=100) | |||
config_id = models.IntegerField(default=None, blank=True, null=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please add comments for these fields answering why are they needed.
@@ -263,6 +268,7 @@ def __init__(self, *args, **kwargs): | |||
is_partial_submission_evaluation_enabled = models.BooleanField( | |||
default=False | |||
) | |||
config_id = models.IntegerField(default=None, blank=True, null=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
@@ -317,6 +323,7 @@ def save(self, *args, **kwargs): | |||
class Leaderboard(TimeStampedModel): | |||
|
|||
schema = JSONField() | |||
config_id = models.IntegerField(default=None, blank=True, null=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail)) | ||
@authentication_classes((ExpiringTokenAuthentication,)) | ||
def create_or_update_github_challenge(request, challenge_host_team_pk): | ||
challenge_queryset = Challenge.objects.filter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please add check to verify who can use this API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be accessed by hosts only.
challenge_phases_data, | ||
files["challenge_test_annotation_files"], | ||
): | ||
data["slug"] = "{}-{}-{}".format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't there a util method to get slug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's different. That just replaces empty spaces with '-', and is used only for challenge. I can use it here only to modify the codename.
@RishabhJain2018 |
@KhalidRmb Can you please resolve the conflicts here? |
@RishabhJain2018 Done |
This PR includes the backend changes to enable GitHub based challenges.
Changes: