GithubHelp home page GithubHelp logo

tapasstandards's Introduction

Tapas Engineering Task Force 👀

This documents defines common Tapas APIs.

Interaction Scheme

⬅️➡️ denotes a JSON Object and its direction of sending.

Auction

AuctionHouse (offering) AuctionHouse (bidding)
Auction ➡️ (over AuctionStartedEvent via Message Queue*) HTTP POST @ /auction
HTTP POST @ /bid ⬅️ Bid
Task ➡️ HTTP POST @ /taskwinner

* The message queue is offered either by MQTT or PubSubHub.

Task Execution

TaskList (offering) Bidding party (undefined endpoint)
HTTP PATCH @ /tasks/<task-UUID> ⬅️ TaskPatch (State.ASSIGNED)
(Executes task)
HTTP PATCH @ /tasks/ ⬅️ TaskPatch (State.EXECUTED, OutputData)

Uniform HTTP API

Auction House

URL: tapas-auction-house.<publicIP>.nio.io

Port: 8085

HTTP POST /auction

Media-Type application/auction+json

Body:

{
  "auctionId": "1",
  "auctionHouseUri": "https://127.0.0.1:8085/",
  "taskUri":"http://example.org/tasks/cef2fa9d-367b-4e7f-bf06-3b1fea35f354",
  "taskType":"COMPUTATION",
  "deadline":"2021-12-24 12:00:00"
}
  • Note that deadline is produced by using Java's default toString() method of the java.sql.Timestamp class
  • The taskUri should not only contain the server, but also the /tasks/<task-UUID>, s.t. the original Task can be fetched

Response Codes

No codes defined as messages are sent by queue

No response body

HTTP POST /bid

Media-Type application/bid+json

Body:

{
  "auctionId":"1",
  "bidderName":"Group1",
  "bidderAuctionHouseUri":"http://example.com/",
  "bidderTaskListUri":"http://example.com/tasks/"
}

Response Codes

  • 204 (No content) Bid was received and accepted
  • 404 (Not found) There never was an auction with that <auctionID>
  • 410 (Gone) The Auction that was requested has already expired

No response body

HTTP POST /taskwinner

Media-Type application/task+json

Body (Identical to Task):

{
  "taskId":"cef2fa9d-367b-4e7f-bf06-3b1fea35f354",
  "taskName":"task1",
  "taskType":"COMPUTATION",
  "taskStatus":"ASSIGNED",
  "originalTaskUri":"http://example.org/tasks/cef2fa9d-367b-4e7f-bf06-3b1fea35f354",
  "serviceProvider":"tapas-group1",
  "inputData":"1+1",
  "outputData":"2"
}

Response Codes

  • 202 (Accepted) The won task is accepted and can be done
  • 406 (Not Acceptable) The winning Auction House cannot execute the won task anymore

No response body

HTTP POST /tasks/<taskId> (on tapas-tasks)

Media-Type application/json-patch+json

Body: See tapas-tasks documentation

Response Codes

  • 200 (Accepted) The patch was applied to the Task
  • 404 (Not Found) The Task requested to patch wasn't found
  • 406 (Not acceptable) An invalid patch request was made

Response Body For debugging purposes, the patched Task is returned.

HTTP GET /discovery/ (on tapas-auction-house)

Notes

  • There is no request body
  • The response's task types are the ones that are sought, i.e. that cannot be executed locally (this way, the crawling auction house should subscribe to the discovered auction house if it can offer that service)

Media-Type application/auctionhousediscovery+json

Response Codes

  • 200 (Accepted) The request was received.

Response Body

  {
  "auctionHouseInfo": [
    {
      "auctionHouseUri":"http://example.org",
      "webSubUri":"http://example.org",
      "taskTypes":["COMPUTATION", "RANDOMTEXT"],
      "timeStamp":"2021-12-24 12:00:00",
      "groupName":"Group3"
    },
    {
      "auctionHouseUri":"http://facemash.com",
      "webSubUri":"http://facemash.com",
      "taskTypes":["BIGROBOT"],
      "timeStamp":"2021-12-24 12:00:00",
      "groupName":"Group2"
    }
  ]
  }

Task Types (with in- and outputs)

BIGROBOT

(Cherrybot or PretendABot)

Input: None

Output: None

SMALLROBOT

(Leubot)

Input: None

Output: None

COMPUTATION

Input: <OPERAND> <OPERATOR> <OPERAND>

Output: Integer result of computation

Valid Operands: All integers

Valid Operators: +, -, *

RANDOMTEXT

Input: None

Output: Randomly generated sentence

HUMIDITY

Input: None

Output: The measured humidity in percent

TEMPERATURE

Input: None

Output: The measured temperature in degrees celsius

tapasstandards's People

Contributors

macemoth avatar jo9x avatar reynisson avatar

Stargazers

Andrei Ciortea avatar

Watchers

 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.