-
Notifications
You must be signed in to change notification settings - Fork 803
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
Added requirements file to config zip and GUI view of requirements #3593
Merged
RishabhJain2018
merged 10 commits into
Cloud-CV:master
from
vinceli1004:vinceRequirementsTask
Sep 20, 2021
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
97e75c1
completed requirements task
vinceli1004 80e404f
make default for requirements empty
vinceli1004 4ee2013
made requirements.txt part of the evaluation_script folder
vinceli1004 c6a6121
style changes
vinceli1004 4547f5b
responding to comments
vinceli1004 22559ad
added fixes for missed comments
vinceli1004 0164a59
removed unused variable
vinceli1004 3769ec9
frontend changes removed
vinceli1004 39c13d7
removed requirements api, clarified worker error message
vinceli1004 3f528b8
Merge branch 'master' into vinceRequirementsTask
RishabhJain2018 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2603,6 +2603,60 @@ def get_challenge_phases_by_challenge_pk(request, challenge_pk): | |
return Response(response_data, status=status.HTTP_200_OK) | ||
|
||
|
||
@api_view(["GET"]) | ||
@throttle_classes([AnonRateThrottle]) | ||
def get_challenge_requirements_by_challenge_pk(request, challenge_pk): | ||
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. @vinceli1004 can we remove this API |
||
""" | ||
API endpoint to fetch all the requirements corresponding to a challenge using challenge pk | ||
Arguments: | ||
challenge_pk -- Challenge Id for which the requirements are to be fetched | ||
Returns: | ||
Response Object -- An object containing all requirements | ||
""" | ||
requirement_data = [] | ||
|
||
challenge = get_challenge_model(challenge_pk) | ||
base_location = tempfile.mkdtemp() | ||
zip_location = join( | ||
base_location, "{}.zip".format(challenge_pk) | ||
) | ||
extract_location = join( | ||
base_location, "data{}".format(challenge_pk) | ||
) | ||
|
||
zip_ref = zipfile.ZipFile(challenge.evaluation_script, "r") | ||
zip_ref.extractall(extract_location) | ||
zip_ref.close() | ||
try: | ||
os.remove(zip_location) | ||
except Exception as e: | ||
logger.exception( | ||
"Temporary directory {} for challenge {} not removed. Error: {}".format( | ||
zip_location, challenge_pk, e | ||
) | ||
) | ||
|
||
requirements_location = join(extract_location, "requirements.txt") | ||
|
||
if os.path.isfile(requirements_location): | ||
f = open(requirements_location, "r") | ||
requirement_data = f.read() | ||
requirement_data = requirement_data.splitlines() | ||
f.close() | ||
|
||
try: | ||
shutil.rmtree(base_location) | ||
except Exception as e: | ||
logger.exception( | ||
"Temporary directory {} for challenge {} not removed. Error: {}".format( | ||
base_location, challenge_pk, e | ||
) | ||
) | ||
|
||
response_data = {"requirements": requirement_data} | ||
return Response(response_data, status=status.HTTP_200_OK) | ||
|
||
|
||
@api_view(["GET"]) | ||
@throttle_classes([AnonRateThrottle]) | ||
def get_challenge_phase_by_pk(request, pk): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@vinceli1004 can we remove this API