User-based request prioritizing with flask

Suppose we have a Service or Function ( limited_f ) that can respond to each call in 1 second. I want to develop an intermediary service that take ( user_id, x ) as input and prioritize the requests in order to fairly allocate the limited service to users and call limited_f(x) . The problem is that user A might send thousands of requests in a row so user B can’t access the service until the server responds to all of the user A’s request.

How should I implement the mentioned intermediary service in Flask framework?

P.S: I took take flask course in Codecademy… and I applied for a flask job… they sent me this task to qualify for the interview… I have no idea where should I begin… because there were no subjects about this matter… can you point me in the right direction … ?

Hi,

As you mentioned, the syllabus currently for flask doesn’t cover these topics. It’s more of an intro course to flask.

It’s great that you’re proactive though and interested in flask!

Some things I would look into (to beef up more flask skills)

  • designing RESTful APIs
  • deployment onto a linux server which includes more skills i’ll list below
  • moderately decent linux knowledge for the topic (permissions, ssh, file transferring, characteristics of certain ditributions)
  • nginx/apache
  • gunicorn/wsgi
  • docker
  • fundamentals of networking
  • fundamentals of cybersecurity
  • sqlalchemy, database fundamentals
  • unit testing

If you haven’t already, you should really look into Miguel Grinberg’s blog and his flask book. Corey Schafer also has a good video on a basic deployment process in linux.

1 Like