Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Subdomain/path flask apps which can be individually restarted

Hi,

I'm working on Flask app which serves as a frontend for submitting jobs. Jobs are quite general here - of different kinds.


The API would look something like this:

* server.com/jobs_of_type_A/submit
* server.com/jobs_of_type_B/submit
* server.com/jobs_of_type_C/submit

after a submission, a job gets queued and it is eventually send for processing elsewhere. The types A, B, C, .. are rather different, and Flask apps serving them need to be configured differently. And, of course, there is more to it than just the submit endpoint.

What I'm wondering about is how to make this frontend very flexible. The server.com administrator should be able to create/restart/cancel different endpoints just like this on the command line:

* $ job_app --config=type_D.json --prefix=jobs_of_type_D create #creates a new endpoint and starts its processing machinery
* $ job_app --config=type_B2.json --prefix=jobs_of_type_B restart #restart the Flask part with a different configuration
* $ job_app --prefix=jobs_of_type_C delete #delete endpoint and teardown processing machinery

Will I be better off with a design which basically for *each* job type handles its own full processing line:

> nginx:portA --- gunicorn --- flask app(configA) --- reddis --- jobA_executor


Or is it better to approach it as:

> nginx --- gunicorn --- flask dispatcher --- flask app (configA) --- reddis ---

/r/flask
https://redd.it/esahm6