Giter Site home page Giter Site logo

gem-spass's Introduction

GEM-SPASS coding challenge

Setup

# Clone the repository
git clone https://github.com/flyingbot91/gem-spass.git
# Prepare the virtual environment
cd gem-spass
python3 -m venv env
source env/bin/activate
env/bin/python -m pip install --upgrade pip
env/bin/python -m pip install -r requirements.txt
# Run server
python3 gem/manage.py runserver 0.0.0.0:8888

How to test

I have included a few JSON test files in the ./data folder.

In order to test the application you can use curl. For example:

curl -v --header "Content-Type: application/json" -d @./data/payload1.json http://localhost:8888/productionplan/
* processing: http://localhost:8888/productionplan/
*   Trying [::1]:8888...
* connect to ::1 port 8888 failed: Conexión rehusada
*   Trying 127.0.0.1:8888...
* Connected to localhost (127.0.0.1) port 8888
> POST /productionplan/ HTTP/1.1
> Host: localhost:8888
> User-Agent: curl/8.2.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 887
> 
< HTTP/1.1 200 OK
< Date: Mon, 20 Nov 2023 00:01:59 GMT
< Server: WSGIServer/0.2 CPython/3.11.6
< Content-Type: application/json
< X-Frame-Options: DENY
< Content-Length: 212
< X-Content-Type-Options: nosniff
< Referrer-Policy: same-origin
< Cross-Origin-Opener-Policy: same-origin
< 
* Connection #0 to host localhost left intact
[{"name": "windpark1", "p": 90.0}, {"name": "windpark2", "p": 21.6}, {"name": "gasfiredbig1", "p": 368.4}, {"name": "gasfiredbig2", "p": 0}, {"name": "gasfiredsomewhatsmaller", "p": 0}, {"name": "tj1", "p": 0.0}]hans@hans-desktop:~/proyectos/github/gem$ 

How to dockerize it

# Build the image
docker build -t gem-spass .
# Run it
docker run --name gem-spass -d -it -p 8888:8888 gem-spass

Logging

Logs can be found at /tmp/gem.log.

gem-spass's People

Contributors

flyingbot91 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.