Code Monkey home page Code Monkey logo

mimuw-irio-distributed-linters's Introduction

Runing the project

Pull linter images:

docker pull ghcr.io/mpiekutowski/linter:1.0 
docker pull ghcr.io/mpiekutowski/linter:1.1 
docker pull ghcr.io/mpiekutowski/linter:1.2 
docker pull ghcr.io/mpiekutowski/linter:2.0

Start the containers:

docker compose up

Distributed Linters API:

Machine Manager:

Creating new linter:

POST / create
Body
key type description
lang String Language for which to create a linter
Response 200, JSON:
key type description
status String Result of operation, ok for successful creation
ip String IP address of the created linter
Response 400, JSON:
key type description
status String Result of operation, error for invalid request parameter
message String Detailed explanation of error
Response 500, JSON:
key type description
status String Result of operation, error for internal server error
message String Detailed explanation of error

Deleting linter:

POST / delete
Body
key type description
ip String IP address of the linter to delete
Response 200, JSON:
key type description
status String Result of operation, ok for successful deletion
Response 400, JSON:
key type description
status String Result of operation, error for invalid request parameter
message String Detailed explanation of the error
Response 500, JSON:
key type description
status String Result of operation, error for internal server error
message String Detailed explanation of the error

Initializing update to new version:

POST / init-update
Body
key type description
lang String Language for which to initiate the update
version String Target version to update to
Response 200, JSON:
key type description
status String Result of operation, ok for successful initiation of update
Response 400, JSON:
key type description
status String Result of operation, error for invalid request parameters
message String Detailed explanation of the error
Response 500, JSON:
key type description
status String Result of operation, error for internal server error
message String Detailed explanation of the error

Progressing to next update step:

POST / update
Body
key type description
lang String Language for which to perform the update
Response 200, JSON:
key type description
status String Result of operation, ok for successful update
Response 400, JSON:
key type description
status String Result of operation, error for invalid request parameters
message String Detailed explanation of the error
Response 500, JSON:
key type description
status String Result of operation, error for internal server error
message String Detailed explanation of the error

Rolling back to previous update step:

POST / rollback
Body
key type description
lang String Language for which to perform the rollback
Response 200, JSON:
key type description
status String Result of operation, ok for successful rollback
Response 400, JSON:
key type description
status String Result of operation, error for invalid request parameters
message String Detailed explanation of the error
Response 500, JSON:
key type description
status String Result of operation, error for internal server error
message String Detailed explanation of the error

Getting status of currently running linters

GET / status
Body

Request body is empty for that request.

Response 200, JSON
key type description
linters JSON[] Array of JSON objects describing currently running linters

Each JSON object has one key of type String - the IP of the linter. Value for that key is another JSON object with the following fields:

key type description
is_healthy Boolean Health status of the linter
version String Version of the linter
lang String Language that can be linted
request_count Integer Number of requests that were served by the linter
Example response
{
    "linters": [
        {
            "127.0.0.1": {
                "is_healthy": true,
                "version": "2.0",
                "lang": "java",
                "request_count": 5
            },
            "127.0.0.2": {
                "is_healthy": false,
                "version": "1.0",
                "lang": "python",
                "request_count": 1
            }
        }
    ]
}

Load Balancer:


Forwarding request to linter chosen by load balancing algorithm:

POST / lint
Body
key type description
code String Code to be linted
Responses
http code description
200 There is linter to handle the request
503 No available linters

Adding linter to load balancing queue:

POST / add
Body
key type description
lang String Language of linter to add
version String Version of linter to add
uri String URI of linter to add
secretKey String Key for authorization
Responses
http code description
200 Addition comleted
400 Language not supported or invalid URI
403 Auth failed

Removing linter from load balancing queue:

POST / remove
Body
key type description
uri String URI of linter to remove
secretKey String Key for authorization
Responses
http code description
200 Removal copmpleted
400 Invalid URI
403 Auth failed

Updating load balancing ratio between version:

POST / ratio
Body
key type description
lang String Lang of linters
versionRatio Dict {"v1": Int, "v2":Int, ...} Any number of keys as long as their values sum up to arbitrary total ratio
secretKey String Key for authorization
Responses
http code description
200 Ratio updated
400 Wrong total ratio or language not supported
403 Auth failed

Checking load balancer status:

GET / health
Response 200

Linters:


Linting code:

POST / lint
Request body:
key type description
code String URI of linter to remove
Response 200, JSON:
key type description
result Boolean Linting passed or failed
details String Message for user

Checking linter status:

GET / health
Response 200, JSON:
key type description
version String Version of linter
language String Language of linter
requestCount Int Number of requests served by linter

mimuw-irio-distributed-linters's People

Contributors

pzurakowski avatar mpiekutowski avatar edokimok avatar

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.