Git Product home page Git Product logo

judge-api's Introduction

JUDGE API SERVER

Greenkeeper badge

CircleCI Build Status codecov

apidocs

Testing

To run mocha-based tests

npm run test

To get coverage report

npm run cover

NOTES

If using a fresh db, seed the languages before testing

npm run build
npm run seedlangs

Requirements

Database (Postgres)

We need a PostgreSQL database to run. Please configure the following env variables -

    DB_NAME='judgeapi',
    DB_USER='judgeapi',
    DB_PASS='judgeapi',
    DB_HOST='localhost'

Queue (RabbitMQ)

brew install rabbitmq
brew services start rabbitmq
rabbitmqctl add_user codingblocks codingblocks
rabbitmqctl set_user_tags codingblocks administrator
rabbitmqctl set_permissions -p / codingblocks conf write read

judge-api's People

Contributors

abhishek97 avatar championswimmer avatar greenkeeper[bot] avatar jatinkatyal13 avatar prabalsingh24 avatar siddharth25pandey avatar tathagat2006 avatar vdvibhu20 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

judge-api's Issues

Add polling endpoint

We need to create an endpoint where user can poll for the submissions that were made using polling mode. All the jobs are stored in the src/models/Submission model which has a result key. While polling the user will give us the submission id and we'll return the submission object

  • create a new folder src/routes/api/submissions
    • create an index.ts file which'll act as the url map
    • create an controller.ts file which'll export an object containing the handler
    • mount /api/submissions/:id endpoint to the polling controller
  • write test for the api
    • Test if the API fives 403 if the api key is not provided or incorrect
    • Test if the API gives 404 if submission id not found
    • Test if the API gives returns the serialized submission model
    • update the test here and here

An in-range update of pg is breaking the build 🚨

The dependency pg was updated from 7.12.0 to 7.12.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

pg is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 2 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of rimraf is breaking the build 🚨

The devDependency rimraf was updated from 2.6.2 to 2.6.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

rimraf is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 6 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of amqplib is breaking the build 🚨

The dependency amqplib was updated from 0.5.3 to 0.5.4.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

amqplib is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build is in progress (Details).
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

Commits

The new version differs by 13 commits.

  • 524e707 Correct spelling of tags condition in travis conf
  • dbcdaa1 Merge pull request #533 from squaremo/release-v0.5.4
  • 3181ee5 Release notes and version bump for 0.5.4
  • 12a830c Merge pull request #532 from squaremo/publish-from-ci
  • fc6e749 Deploy in separate stage
  • 58ad7db Add deploy stanza to .travis.yml
  • 7adaea0 Merge pull request #525 from tingwai/update-engines
  • 160b793 Update package.json to reflect supported node versions
  • bb426eb Merge pull request #526 from squaremo/travis-xenial
  • 6a05907 Install RabbitMQ as prereq of CI
  • 773eb92 Merge pull request #498 from johanneswuerbach/error-unacked-on-close
  • 16439ea Error pending confirmation callbacks on channel close
  • 099673e Generate defs on prepare

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of ts-node is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye πŸ‘‹ and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The devDependency ts-node was updated from 8.8.2 to 8.9.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

ts-node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: build: Your tests failed on CircleCI (Details).

Release Notes for v8.9.0

Fixed

Fix failing tests caused by recent changes to @types/node (#1016)
Fix #945: Bump source-map-support dependency to include upstream fix for worker threads error handling (#1015) @addaleax
Fix #1004: in --scriptMode, resolve config file relative to realpath of entrypoint script (#1009)
Normalized filenames in cache to fix performance issues on Windows (#997) @sylc

Added

Add timestamps to debug logging (#994) @sylc

Docs

Improve coverage of the README (#1000) @KasparEtter
Change order of install commands in README (#993) @jacobdcastro
Mention ts-node -vv flag in issue template (#1001)
Run GHActions tests on pull requests (#1017)

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/sequelize is breaking the build 🚨

The devDependency @types/sequelize was updated from 4.27.27 to 4.27.28.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/sequelize is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).
  • ❌ continuous-integration/travis-ci/push: The Travis CI build is in progress (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/chai is breaking the build 🚨

The devDependency @types/chai was updated from 4.1.7 to 4.2.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/chai is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of minio is breaking the build 🚨

The dependency minio was updated from 7.0.11 to 7.0.12.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

minio is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build is in progress (Details).
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

Commits

The new version differs by 3 commits.

  • 64d0a7f Fix multipart fPutObject (#789)
  • ae77338 Ensure that tests are run on CI Platforms (#790)
  • 472da9f Update version to next release

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of uuid is breaking the build 🚨

The dependency uuid was updated from 3.3.2 to 3.3.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

uuid is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 3 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/request is breaking the build 🚨

The devDependency @types/request was updated from 2.48.2 to 2.48.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/request is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build is in progress (Details).
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/express is breaking the build 🚨

The devDependency @types/express was updated from 4.17.0 to 4.17.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/express is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: CircleCI is running your tests (Details).
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

create polling mode

for POST /api/run an extra body parameter called mode

Possible values of mode are -

  • sync
  • poll
  • callback

For sync mode

  • current mode of operation
  • request is held till judgement is over, and then response is sent

Poll mode

  • on request, we create a new job id
  • send the job id in the response
  • when judgement is over, in db, update the job status to done
  • client can continuosly request status of job via job id
  • GET /api/run/:jobid
    • responds status: running till it is incomplete
    • responses status: success or status: error with output and error base64 when done

callback mode (or webhook mode)

  • request body will contain a callbackUrl param also
  • when job is done, judge will make a POST request to callbackUrl

add support for Project Submissions

Add support to run project submissions in frameworks like react, node, django etc.

Check this issue on judge-taskmaster

  • Create a new API endpoint /api/project
    • Create routes/api/project directory
    • Write validator to support following request payload
    {
      "problem": <problem zip url>,
      "submission": <submission zip url>,
      "lang": <language>,
      "submissionDirs": <directories that can be editted>,
      "timelimit" <timelimit in seconds>,
      "mode": "sync" | "poll" | "callback",
      "callback": <if mode is callback then url>
    }
    
    • Send job to queue required by judge-taskmaster
    • Implement onSuccess listener on the controller

Write tests

Since we have added more features to the application we need to update our tests as well

  • Add E2E API tests
    For writing these tests we will be using https://www.chaijs.com/plugins/chai-http/

    • Create test/e2e directory
    • For each of scenario we will have a separate file e.g. run scenario will have RunScenario.spec.ts
    • Write tests for run scenario
      Since there will be no consumers on the other end of the queue, we will have to call onSuccess method on the controllers manually using setTimeout function with the mock result and assert it with the response from the API
      • Run Code in Sync Mode and check if the response is correct
      • Run Code in Poll Mode
        • Check if the response is returning job id
        • Check if the job runs successfully after calling onSuccess method
      • Run Code in Callback Mode
        • Check if the response is returning job id
        • Setup another mock server or echo-server and assert the result
    • Write test for submit scenario
      • Run Code in Sync Mode and check if the response is correct
      • Run Code in Poll Mode
        • Check if the response is returning job id
        • Check if the job runs successfully after calling onSuccess method
      • Run Code in Callback Mode
        • Check if the response is returning job id
        • Setup another mock server or echo-server and assert the result
  • Add Unit tests

    • Create test/unit directory
    • Create test for Validators in each of the scenario
    • Write exhaustive set of test requests and assert the result

An in-range update of @types/minio is breaking the build 🚨

The devDependency @types/minio was updated from 7.0.2 to 7.0.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/minio is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ continuous-integration/travis-ci/push: The Travis CI build is in progress (Details).
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of request is breaking the build 🚨

The devDependency request was updated from 2.88.0 to 2.88.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

request is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).
  • ❌ continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml
  • Replaced the old Node.js version in your .nvmrc with the new one
  • The engines config in 1 of your package.json files was updated to the new Node.js version

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected πŸ€–


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Refactor unstructured codebase and integrate linting checks

Since the judege-taskmaster and ** judge-api** codebases are used in production applications, the code needs to follow particular standards and guidelines, which can greatly increase its maintainability as a community project.

Therefore linters should be set as would be done under coding-blocks/judge-taskmaster#41 up to force standard code guidelines on the repository.


Working on it, would send PR as soon as the issue acknowledged.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.