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

feat: add portal challenge #252

Merged
merged 26 commits into from
Nov 22, 2023
Merged
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
49 changes: 49 additions & 0 deletions challengeutils/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from . import (
annotations,
createchallenge,
create_portal_challenge,
challenge,
cheat_detection,
evaluation_queue,
Expand Down Expand Up @@ -81,6 +82,33 @@ def command_createchallenge(syn, args):
return challenge_components


def command_create_portal_challenge(syn, args):
"""Creates a challenge on the Sage Challenge Portal.

>>> challengeutils create-portal-challenge "Challenge Name Here" [-n <int>]
"""
challenge_components = create_portal_challenge.main(
syn, args.challenge_name, args.tasks_count, args.livesiteid
)
# component: project or team
# componentid: project id or teamid
urls = {}
for component, componentid in challenge_components.items():
if component.endswith("projectid"):
urls[component] = f"https://www.synapse.org/#!Synapse:{componentid}"
elif component.endswith("teamid"):
urls[component] = f"https://www.synapse.org/#!Team:{componentid}"
urls["name"] = args.challenge_name
text = (
"{name} (Production site): {live_projectid}",
"{name} (Staging site): {staging_projectid}",
"{name} (Participant team): {organizer_teamid}",
"{name} (Organizer team): {participant_teamid}",
)
print("\n" + "\n".join(text).format(**urls))
return challenge_components


def command_query(syn, args):
"""Command line convenience function to call evaluation queue query
Evaluation queues offer a separate query service from the rest of Synapse.
Expand Down Expand Up @@ -439,6 +467,27 @@ def build_parser():
)
parser_createchallenge.set_defaults(func=command_createchallenge)

parser_create_portal_challenge = subparsers.add_parser(
"create-portal-challenge",
help="Create a Sage Challenge Portal challenge from template"
)
parser_create_portal_challenge.add_argument("challenge_name", help="Challenge name")
parser_create_portal_challenge.add_argument(
"-t",
"--tasks_count",
type=int, default=1,
help=(
"Number of challenge tasks (default: 1)"
),
)
parser_create_portal_challenge.add_argument(
"--livesiteid",
help=(
"Option to specify the live site synapse Id" " there is already a live site"
),
)
parser_create_portal_challenge.set_defaults(func=command_create_portal_challenge)

parser_mirrorwiki = subparsers.add_parser(
"mirror-wiki",
help="Mirrors (sync) wiki pages by using the wikipage titles between "
Expand Down
Loading
Loading