common.rpc

This is our custom RPC implementation, used by all of our apps to communicate securely with each other.

Utilities

Auth

exception common.rpc.auth_utils.OKException[source]

Base exception class for Bacon/OK integration.

exception common.rpc.auth_utils.OAuthException(error='', error_description='')[source]

OAuth related exception

class common.rpc.auth_utils.OAuthSession(access_token='', refresh_token='', expires_at=- 1, session=None)[source]

Represents OK OAuth state

refresh()[source]

Refreshes a token

auth(force_reauth=False, no_browser=False)[source]

Returns OAuth access token which can be passed to the server for identification. If force_reauth is specified then will force re-authenticate the user; else tries to reuse or refresh previous token

Miscellaneous

common.rpc.utils.cached(ttl: int = 1800)[source]

Caches the return value of this RPC method for ttl seconds (defaults to 1800s)

Autograder

common.rpc.ag_master.trigger_jobs(*, assignment_id: str, jobs: List[str])[source]

Given a list of job IDs, queues autograder workers to begin grading.

Parameters
  • assignment_id (str) – the assignment secret key, used as an identifier

  • jobs (list[str]) – the list of job IDs to queue

Bound in create_okpy_endpoints()

common.rpc.ag_master.get_submission(*, job_id: str) → Dict[source]

Given a job ID, gets submission information from Okpy and forwards it to the requesting worker.

Parameters

job_id (str) – the job ID associated with the requested backup

Returns

a dictionary containing backup information, specifically the data value here

Bound in create_worker_endpoints()

common.rpc.ag_master.handle_output(*, output: str, job_id: str)[source]

Given output and a job ID, parses the output for scores and uploads them to Okpy. See worker for helper functions used.

Parameters
  • output (str) – the autograder worker output

  • job_id (str) – the job ID associated with the output

Bound in create_worker_endpoints()

common.rpc.ag_master.set_failure(*, job_id: str, result: str)[source]

Given a job ID and some output result, set the job to failed and report the failure to Okpy.

Parameters
  • job_id (str) – the job ID associated with the output

  • result (str) – the autograder worker output

Bound in create_worker_endpoints()

common.rpc.ag_master.upload_zip(*, course: str, name: str, file: str)[source]

Given a course, a filename, and base64-encoded zip file contents, upload the file to a cloud storage bucket. This method is meant to be accessed using the SICP command-line tool.

Parameters
  • course (str) – the course code

  • name (str) – the filename

  • file (str) – base64-encoded zip-file contexts

Bound in create_admin_endpoints()

common.rpc.ag_master.create_assignment(*, course: str, name: str, file: str, command: str, batch_size: int, grading_base: str)str[source]

Given some information about an assignment, register it into the autograder database so that it may be graded using the autograder. This method is meant to be accessed using the SICP command-line tool.

Parameters
  • course (str) – the course code

  • name (str) – the assignment shortname

  • file (str) – the assignment filename (should be the same as name in upload_zip())

  • command (str) – the command the worker should run to grade a backup for this assignment

  • batch_size (int) – how many backups should be graded by one worker

  • grading_base (str) – the grading server associated with the assignment (by default, https://okpy.org)

Bound in create_admin_endpoints()

61A Auth

Buildserver

61A Domains

Hosted Apps

Howamidoing

CS 162 Mailserver

Office Hours Queue

Paste

Sandbox + IDE

Secrets Tool

Sections/Tutorials

Slackbot