-
Notifications
You must be signed in to change notification settings - Fork 63
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 docker based submission fix #379
Changes from all commits
beb8ece
cc74e20
a652d0f
da2aa42
7142815
5d88b52
ce433be
b7254f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
display_submission_details, | ||
display_submission_result, | ||
convert_bytes_to, | ||
get_submission_meta_attributes, | ||
) | ||
from evalai.utils.urls import URLS | ||
from evalai.utils.config import ( | ||
|
@@ -126,6 +127,147 @@ def push(image, phase, url, public, private): | |
max_docker_image_size = response.get("max_docker_image_size") | ||
|
||
docker_image_size = docker_image.__dict__.get("attrs").get("VirtualSize") | ||
# Prompt for submission details | ||
if click.confirm("Do you want to include the Submission Details?"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this based on the submit method? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No |
||
submission_metadata["method_name"] = click.prompt( | ||
style("Method Name", fg="yellow"), type=str, default="" | ||
) | ||
submission_metadata["method_description"] = click.prompt( | ||
style("Method Description", fg="yellow"), | ||
type=str, | ||
default="", | ||
) | ||
submission_metadata["project_url"] = click.prompt( | ||
style("Project URL", fg="yellow"), type=str, default="" | ||
) | ||
submission_metadata["publication_url"] = click.prompt( | ||
style("Publication URL", fg="yellow"), type=str, default="" | ||
) | ||
|
||
submission_meta_attributes = get_submission_meta_attributes( | ||
challenge_pk, phase_pk | ||
) | ||
|
||
submission_attribute_metadata = [] | ||
|
||
if (submission_meta_attributes and len(submission_meta_attributes) > 0): | ||
if click.confirm( | ||
"Do you want to include the Submission Metadata?" | ||
): | ||
for attribute in submission_meta_attributes: | ||
attribute_type = attribute["type"] | ||
attribute_name = attribute["name"] | ||
attribute_description = attribute["description"] | ||
attribute_required = attribute.get("required") | ||
attribute_data = { | ||
'name': attribute_name, | ||
'type': attribute_type, | ||
'description': attribute_description, | ||
'required': attribute_required, | ||
} | ||
if attribute_required: | ||
attribute_name = attribute_name + '*' | ||
value = None | ||
message = "{} ({})".format( | ||
attribute_name, attribute_description | ||
) | ||
if attribute_type == "text": | ||
while True: | ||
value = click.prompt( | ||
style(message, fg="yellow"), | ||
type=str, | ||
default="", | ||
) | ||
if not attribute_required or value != "": | ||
break | ||
echo( | ||
"Error: {} is a required field".format( | ||
attribute["name"] | ||
) | ||
) | ||
attribute_data['value'] = value | ||
if attribute_type == "boolean": | ||
while True: | ||
value = click.prompt( | ||
style(message, fg="yellow"), type=bool, default="" | ||
) | ||
if not attribute_required or value != "": | ||
break | ||
echo( | ||
"Error: {} is a required field".format( | ||
attribute["name"] | ||
) | ||
) | ||
attribute_data['value'] = value | ||
if attribute_type == "radio": | ||
while True: | ||
value = click.prompt( | ||
style( | ||
"{}:\nChoices:{}".format( | ||
message, attribute["options"] | ||
), | ||
fg="yellow", | ||
), | ||
type=click.Choice(attribute["options"]), | ||
default="" | ||
) | ||
if not attribute_required or value != "": | ||
break | ||
echo( | ||
"Error: {} is a required field".format( | ||
attribute["name"] | ||
) | ||
) | ||
attribute_data['options'] = attribute['options'] | ||
attribute_data['value'] = value | ||
if attribute_type == "checkbox": | ||
option_chosen = True | ||
while option_chosen: | ||
value = [] | ||
choices = click.prompt( | ||
style( | ||
"{}:\nChoices(separated by comma):{}".format( | ||
message, attribute["options"] | ||
), | ||
fg="yellow", | ||
), | ||
type=str, | ||
show_default=False, | ||
default="" | ||
) | ||
if choices != "": | ||
choices = [ | ||
choice.strip(" ") | ||
for choice in choices.split(",") | ||
] | ||
else: | ||
choices = [] | ||
option_chosen = False | ||
if attribute_required and len(choices) == 0: | ||
echo( | ||
"Error: {} is a required field. Please select atleast one option".format( | ||
attribute["name"] | ||
) | ||
) | ||
option_chosen = True | ||
for choice in choices: | ||
if choice in attribute["options"]: | ||
value.append(choice) | ||
option_chosen = False | ||
else: | ||
echo( | ||
"Error: Choose correct value(s) from the given options only" | ||
) | ||
option_chosen = True | ||
break | ||
attribute_data['options'] = attribute['options'] | ||
attribute_data['values'] = value | ||
submission_attribute_metadata.append(attribute_data) | ||
|
||
# After collecting submission_attribute_metadata | ||
if submission_attribute_metadata: | ||
submission_metadata["submission_meta_attributes"] = submission_attribute_metadata | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this submission metadata pushed to EvalAI? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see it on line 352. Nvm. |
||
|
||
if docker_image_size > max_docker_image_size: | ||
max_docker_image_size = convert_bytes_to(max_docker_image_size, "gb") | ||
message = "\nError: Image is too large. The maximum image size allowed is {} GB".format( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -442,7 +442,7 @@ def pretty_print_challenge_phase_data(phase): | |
|
||
title = "{} {} {}".format(phase_title, challenge_id, phase_id) | ||
|
||
cleaned_desc = BeautifulSoup(phase["description"], "lxml").text | ||
cleaned_desc = BeautifulSoup(phase["description"], "html.parser").text | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we making this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I tried to run CLI and fetch the challenge by id, it showed a parsing error, so I used this to fix it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure it doesn't break any of the old functionality? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gchhablani I think this I don't see this breaking any functionality. |
||
description = "{}\n".format(cleaned_desc) | ||
|
||
start_date = "Start Date : {}".format( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,7 +135,7 @@ def clean_data(data): | |
""" | ||
Strip HTML and clean spaces | ||
""" | ||
data = BeautifulSoup(data, "lxml").text.strip() | ||
data = BeautifulSoup(data, "html.parser").text.strip() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, why this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This Fix Parsing error on CLI |
||
data = " ".join(data.split()).encode("utf-8") | ||
return data | ||
|
||
|
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.
Remove comment