Skip to content

RafaAguilar/job-dispatcher

Repository files navigation

Flask Job Dispatcher Simulator

This is a small project to learn how to use Flask with two new libraries I just found:

  • flask_restful¹
  • flask_sqlalchemy²
  • flask_migrate³

The main goal is to build a generic and reusable task synchronizer that allows to manage jobs, tasks, storages, clients, and related stuff.

In the first uploaded version (0.1) it will have the most abstract concepts, almost not usable in a real scenario, but my (could be ours..) goal to reach V1.0 is to simulate a Coffee spending machine, that have flavors, cups, time to serve, a witdrawal window and such only configuring the application, through API, without specifying (hopefully) new Coffee classes.

Which technologies will we use?

It includes much more techonlogies, but these are the interesting ones Technoglies of interest

Which is the proposed Workflow?

note: It will need another diagrams for sure. Proposed Workflow

Do you have any Classes Diagram?

note: The Classes Diagram still lacks of labour, it is constanly changing now, and actually does not correspond with code in a 100% but almost. Classes Diagram

Do it has any documentation?

It have all the needed to be documented, thanks to OpenAPI and swagger.io, after you run the application enter to: http://localhost:5000/api/spec.html#!/spec you should be able to see this:

API Spec

Where can I interact with a demo?

It will be soon someday in a Heroku Test Instance

Steps to deploy?

I suggest you to use virtualenv to play with it, here is what I did:

#install python3.5 and virtualenv according with your distribution / OS
#this steps are for a unix-like system

git clone https://github.com/RafaAguilar/job-dispatcher.git

cd job-dispatcher/
virtualenv venv
source venv/bin/activate

pip install -r requirements.txt

#change dispatcher with your PostgreSQL proper data
export APP_SETTINGS="config.DevelopmentConfig" #check config.py to see the options 
export DATABASE_URL="postgresql://dispatcher:dispatcher@localhost/dispatcher"

#python manage.py migrate #this only will be needed when you make changes
                          #and warning, flask_migrate isn't behaving  
                          #if you have any issues read the "KnowN issues" subject.
python manage.py upgrade

#If everything goes well, just type:
python app.py

Known Issues

  • After changing models it won't upgrade DB:
    • alembic, as part of flask_migrate doesn't recognize a bunch of outsider models, like the custom ones or the ones from sqlalchemy_utils for example, so you just need to add the proper updates on the generated migration. It also has a problem with JSON fields, so you have to manually add sa. in the migrations where there is only a Text(). This is while they fix this issue :P

About

A reusable Job Dispatcher/Synchronizer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published