Grader Service#
REST API Documentation#
Contents#
Main#
- class GraderService(**kwargs: Any)[source]#
Bases:
traitlets.config.application.Application- aliases: Dict[str, str] = {'config': 'GraderService.config_file', 'f': 'GraderService.config_file', 'log-level': 'Application.log_level'}#
the alias map for configurables Keys might strings or tuples for additional options; single-letter alias accessed like -v. Values might be like “Class.trait” strings of two-tuples: (Class.trait, help-text).
- base_url_path#
A trait for unicode strings.
- config_file#
A trait for unicode strings.
- db_url#
A trait for unicode strings.
- description = 'Starts the grader service, which can be used to create and distribute assignments,\n collect submissions and grade them.\n '#
- examples = '\n generate default config file:\n grader-service --generate-config -f /etc/grader/grader_service_config.py\n spawn the grader service:\n grader-service -f /etc/grader/grader_service_config.py\n '#
- flags: Dict[str, Any] = {'debug': ({'Application': {'log_level': 10}}, 'Set log-level to debug, for the most verbose logging.'), 'show-config': ({'Application': {'show_config': True}}, "Show the application's configuration (human-readable format)"), 'show-config-json': ({'Application': {'show_config_json': True}}, "Show the application's configuration (json format)")}#
- grader_service_dir#
A trait for unicode strings.
- initialize(argv, *args, **kwargs)[source]#
Do the basic steps to configure me.
Override in subclasses.
- classmethod launch_instance(argv=None)[source]#
Launch a global instance of this Application
If a global instance already exists, this reinitializes and starts it
- log_level#
An enum whose value must be in a given sequence.
- name = 'grader-service'#
- reuse_port#
A boolean (True, False) trait.
- service_git_email#
A trait for unicode strings.
- service_git_username#
A trait for unicode strings.
- service_host#
A trait for unicode strings.
- service_port#
An int trait.
- setup_loggers(log_level: str)[source]#
Handles application, Tornado, and SQLAlchemy logging configuration.
- async shutdown_cancel_tasks(sig)[source]#
Cancel all other tasks of the event loop and initiate cleanup
- version = '0.1.2'#
- main(argv=None)#
Launch a global instance of this Application
If a global instance already exists, this reinitializes and starts it
Registery#
- class HandlerPathRegistry(*args, **kwargs)[source]#
Bases:
object- static handler_list(base_url: str = '/services/grader') List[Tuple[str, tornado.web.RequestHandler]][source]#
- registry = {<class 'grader_service.handlers.base_handler.VersionHandler'>: '\\/', <class 'grader_service.handlers.base_handler.VersionHandlerV1'>: '\\/v1\\/', <class 'grader_service.handlers.assignment.AssignmentBaseHandler'>: '(?:\\/v[1])?\\/lectures\\/(?P<lecture_id>\\d*)\\/assignments\\/?', <class 'grader_service.handlers.assignment.AssignmentObjectHandler'>: '(?:\\/v[1])?\\/lectures\\/(?P<lecture_id>\\d*)\\/assignments\\/(?P<assignment_id>\\d*)\\/?', <class 'grader_service.handlers.assignment.AssignmentResetHandler'>: '(?:\\/v[1])?\\/lectures\\/(?P<lecture_id>\\d*)\\/assignments\\/(?P<assignment_id>\\d*)\\/reset\\/?', <class 'grader_service.handlers.assignment.AssignmentPropertiesHandler'>: '(?:\\/v[1])?\\/lectures\\/(?P<lecture_id>\\d*)\\/assignments\\/(?P<assignment_id>\\d*)\\/properties\\/?', <class 'grader_service.handlers.grading.GradingAutoHandler'>: '(?:\\/v[1])?\\/lectures\\/(?P<lecture_id>\\d*)\\/assignments\\/(?P<assignment_id>\\d*)\\/grading\\/(?P<sub_id>\\d*)\\/auto\\/?', <class 'grader_service.handlers.grading.GenerateFeedbackHandler'>: '(?:\\/v[1])?\\/lectures\\/(?P<lecture_id>\\d*)\\/assignments\\/(?P<assignment_id>\\d*)\\/grading\\/(?P<sub_id>\\d*)\\/feedback\\/?', <class 'grader_service.handlers.lectures.LectureBaseHandler'>: '(?:\\/v[1])?\\/lectures\\/?', <class 'grader_service.handlers.lectures.LectureObjectHandler'>: '(?:\\/v[1])?\\/lectures\\/(?P<lecture_id>\\d*)\\/?', <class 'grader_service.handlers.lectures.LectureStudentsHandler'>: '(?:\\/v[1])?\\/lectures\\/(?P<lecture_id>\\d*)\\/users\\/?', <class 'grader_service.handlers.submissions.SubmissionHandler'>: '(?:\\/v[1])?\\/lectures\\/(?P<lecture_id>\\d*)\\/assignments\\/(?P<assignment_id>\\d*)\\/submissions\\/?', <class 'grader_service.handlers.submissions.SubmissionObjectHandler'>: '(?:\\/v[1])?\\/lectures\\/(?P<lecture_id>\\d*)\\/assignments\\/(?P<assignment_id>\\d*)\\/submissions\\/(?P<submission_id>\\d*)\\/?', <class 'grader_service.handlers.submissions.SubmissionPropertiesHandler'>: '(?:\\/v[1])?\\/lectures\\/(?P<lecture_id>\\d*)\\/assignments\\/(?P<assignment_id>\\d*)\\/submissions\\/(?P<submission_id>\\d*)\\/properties\\/?', <class 'grader_service.handlers.git.server.RPCHandler'>: '/.*/git-(.*)', <class 'grader_service.handlers.git.server.InfoRefsHandler'>: '/.*/info/refs', <class 'grader_service.handlers.permission.PermissionHandler'>: '(?:\\/v[1])?\\/permissions\\/?'}#
- class VersionSpecifier(value)[source]#
Bases:
enum.EnumAn enumeration.
- ALL = 'all'#
- NONE = 'none'#
- V1 = '1'#
- register_handler(path: str, version_specifier: grader_service.registry.VersionSpecifier = VersionSpecifier.NONE)[source]#
Request#
- class RequestService(**kwargs: Any)[source]#
Bases:
traitlets.config.configurable.LoggingConfigurable- host#
A trait for unicode strings.
- port#
An int trait.
- async request(method: str, endpoint: str, body: Optional[dict] = None, header: Optional[Dict[str, str]] = None) Union[dict, list][source]#
- scheme#
A trait for unicode strings.
- property url#
Server#
- class GraderServer(**kwargs: Any)[source]#
Bases:
traitlets.config.configurable.LoggingConfigurable,tornado.web.Application- hub_api_token#
A trait for unicode strings.
- hub_api_url#
A trait for unicode strings.
- hub_base_url#
A trait for unicode strings.
- hub_service_name#
A trait for unicode strings.
- hub_service_prefix#
A trait for unicode strings.
- hub_service_url#
A trait for unicode strings.
- property max_token_cookie_age_days#
- max_token_cookie_age_minutes#
An int trait.
- max_user_cookie_age_days#
An int trait.