<p dir="auto">In the same vein as <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="579268133" data-permission-text="Title is private" data-url="https://github.com/tiangolo/fastapi/issues/1107" data-hovercard-type="issue" data-hovercard-url="/tiangolo/fastapi/issues/1107/hovercard" href="https://github.com/tiangolo/fastapi/issues/1107">#1107</a>, it would be super useful (at least to me) to have the openapi models be available outside of FastAPI.  I've been working on a Python client generator (built with Typer!) which will hopefully be much cleaner than the openapi-generator version, and I already use FastAPI for some testing.</p>
<p dir="auto">I don't want to ship a copy of FastAPI with my tool just to get the openapi module, but it also feels silly to be rewriting a lot of what you already have when I could just parse a spec into your models and work from there.  So what I'll probably do is extract a copy of the openapi module and use it (with proper attribution of course), but it would be much cleaner to add your module as a pip dependency.</p>
<p dir="auto"><a href="https://github.com/triaxtec/openapi-python-client">https://github.com/triaxtec/openapi-python-client</a> is the project in question, just FYI.</p>
<h3 dir="auto">First Check</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I added a very descriptive title to this issue.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I used the GitHub search to find a similar issue and didn't find it.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I searched the FastAPI documentation, with the integrated search.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already searched in Google "How to X in FastAPI" and didn't find any information.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already read and followed all the tutorial in the docs and didn't find an answer.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already checked if it is not related to FastAPI but to <a href="https://github.com/samuelcolvin/pydantic">Pydantic</a>.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already checked if it is not related to FastAPI but to <a href="https://github.com/swagger-api/swagger-ui">Swagger UI</a>.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I already checked if it is not related to FastAPI but to <a href="https://github.com/Redocly/redoc">ReDoc</a>.</li>
</ul>
<h3 dir="auto">Commit to Help</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I commit to help with one of those options <g-emoji class="g-emoji" alias="point_up_2" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f446.png">👆</g-emoji></li>
</ul>
<h3 dir="auto">Example Code</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="###This API takes id in request , creates temp path in container , searches path for this id in database and copies file from AWS s3b for this id in temp created path, does ML processing and deletes the temp path then returns the predicted data

from datetime import datetime
import uvicorn
from fastapi import Depends, FastAPI, HTTPException, Request
from starlette.middleware.cors import CORSMiddleware
# initializing FastAPI
from fastapi import FastAPI, Response, status
from fastapi.responses import JSONResponse
from pydantic import BaseModel
from fastapi import Security ,HTTPException
from fastapi.security.api_key import APIKeyHeader
import pathlib
temp = pathlib.PosixPath
#pathlib.PosixPath = pathlib.WindowsPath

import torch
# Logging
import logging, logging.config

logging.config.dictConfig(
    {
        'version': 1,
        'disable_existing_loggers': True,
    }
)
global logger
# logging.basicConfig(filename='app.log', filemode='w',format='%(asctime)s:%(levelname)s:%(message)s', level=logging.DEBUG)

app = FastAPI(docs_url=&quot;/&quot;, redoc_url=None,
              title=&quot;First ML API&quot;,
              description=&quot;First ML API&quot;,
              version=&quot;V 1.0&quot;,
              )
# FileDownload()
# SMBConnectionDownload()
config = readconfig()

API_KEY = config.API_KEY
API_KEY_NAME = config.API_KEY_NAME

api_key_header_auth = APIKeyHeader(name=API_KEY_NAME, auto_error=True)

async def get_api_key(api_key_header: str = Security(api_key_header_auth)):
    if api_key_header != API_KEY:
        raise HTTPException(
            status_code=status.HTTP_401_UNAUTHORIZED,
            detail=&quot;Invalid API Key&quot;,
        )


origins = [
    &quot;http://localhost.tiangolo.com&quot;,
    &quot;https://localhost.tiangolo.com&quot;,
    &quot;http://localhost&quot;,
    &quot;http://localhost:8080&quot;,
    &quot;http://localhost:4200&quot;,
]

app.add_middleware(
    CORSMiddleware,
    allow_origins=origins,
    allow_credentials=True,
    allow_methods=[&quot;*&quot;],
    allow_headers=[&quot;*&quot;],
)



class Item(BaseModel):
    id : str



logging.config.dictConfig(
    {
        'version': 1,
        'disable_existing_loggers': True,
    }
)
global logger

logger = logging.getLogger(&quot;main&quot;)
logger.setLevel(logging.INFO)
# create the logging file handler
fh = logging.FileHandler(&quot;app.log&quot;)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
fh.setFormatter(formatter)
ch.setFormatter(formatter)
while logger.handlers:
    logger.handlers.pop()
# add handler to logger object
logger.addHandler(fh)
logger.addHandler(ch)
logger.propagate = False



@app.get(&quot;/&quot;)
async def root():
    return {&quot;message&quot;: &quot;Hello Bigger Applications!&quot;}


@app.get(&quot;/heartbeat&quot;)
def heartbeat():
    return &quot;Success&quot;


@app.get('/predictdata',dependencies=[Security(get_api_key)])
def predictdata(id: str):


    try:
        res = {&quot;id&quot; : id , &quot;prediction&quot;: &quot;&quot; , &quot;StatusCode&quot; : &quot;200&quot;, &quot;Validations&quot; : []}
        
        if not id.isdigit():
            res[&quot;Validations&quot;].append({&quot;Type&quot; : &quot;Validation&quot;, &quot;Description&quot; : &quot;id must be a integer&quot;})
            raise TypeError(&quot;id must be an integer&quot;)
        
        logger.info(&quot;*** ML prediction API started for Id : {} ***&quot;.format(id))
        logger.info(&quot;########################&quot;)
        data = ML_Process(id, res)
        res = data
        logger.info(res)

        return JSONResponse(status_code=int(res[&quot;StatusCode&quot;]), content=res)

    except Exception as ex:


            traceback.print_exc()
            error_trace = traceback.format_exc()
            res[&quot;Validations&quot;].append({&quot;Type&quot; : &quot;Error&quot;,&quot;Description&quot; : error_trace})
            res[&quot;StatusCode&quot;] = str(500)
            logger.exception(&quot;Exception in my ML API&quot;)
            logger.error(ex,exc_info=True)

    return JSONResponse(status_code=500, content=res)

	
def ML_Process(id, res):
    #get docpath from db by id , copy doc to temp path from s3b and run ML model on the doc
    #after processing it deletes temp path and returns predicted data
    # this is a long running process takes avg 25 second but can take sometime 1-2 minutes.
    # Issue is observed only when it's a long running requests e.g Model takes more time to do inference
  


if __name__ == &quot;__main__&quot;:
    uvicorn.run(
        app,
        host=&quot;0.0.0.0&quot;,
        port=8422
    )


-------------------------------------

Dockerfile

FROM python:3

WORKDIR /app

COPY requirements.txt requirements.txt

RUN pip install -r requirements.txt


RUN apt-get update

RUN apt-get install poppler-utils -y &amp;&amp; \
    apt install ghostscript -y &amp;&amp; \
    apt-get install -y tesseract-ocr &amp;&amp; \


COPY . .

WORKDIR /app

CMD uvicorn app:app --host 0.0.0.0 --port 5057 



-------------------------------------------


Kubernetes pod logs of application which shows same request getting processed multiple times

i sent the request of id - 12 only once through the swagger  and nobody else was using it 

log :-

2022-08-11 04:27:22,070 - main - INFO - *** ML prediction API started for id : 12 ***
2022-08-11 04:27:22,071 - main - INFO - ########################
2022-08-11 04:27:22,072 - main - INFO - Temp folder structure created :  /app/12_20220811042722071864
2022-08-11 04:27:22,104 - main - INFO - File existing in this id folder in S3B folder  .
2022-08-11 04:27:22,105 - main - INFO - File existing in this id folder in S3B folder  ..
2022-08-11 04:27:22,105 - main - INFO - File existing in this id folder in S3B folder  278692642.pdf
2022-08-11 04:27:22,591 - main - INFO - &quot;278692642.pdf&quot; file copied in temp directory
2022-08-11 04:27:27,518 - main - INFO - 278692642.pdf
2022-08-11 04:27:27,706 - main - INFO - /app/12_20220811042722071864/278692642.pdf
2022-08-11 04:28:56,711 - main - INFO - prediction  =  done
2022-08-11 04:28:56,711 - main - INFO - -----------------------------------------------------------------------------
2022-08-11 04:28:22,078 - main - INFO - *** ML prediction API started for id : 12 ***
2022-08-11 04:28:22,080 - main - INFO - ########################
2022-08-11 04:28:22,080 - main - INFO - Temp folder structure created :  /app/12_20220811042822080625
2022-08-11 04:28:22,292 - main - INFO - File existing in this id folder in S3B folder  .
2022-08-11 04:28:22,292 - main - INFO - File existing in this id folder in S3B folder  ..
2022-08-11 04:28:22,292 - main - INFO - File existing in this id folder in S3B folder  278692642.pdf
2022-08-11 04:28:24,784 - main - INFO - &quot;278692642.pdf&quot; file copied in temp directory
2022-08-11 04:28:38,689 - main - INFO - 278692642.pdf
2022-08-11 04:28:39,986 - main - INFO - /app/12_20220811042822080625/278692642.pdf
2022-08-11 04:28:56,711 - main - INFO - prediction  =  done
2022-08-11 04:28:56,711 - main - INFO - -----------------------------------------------------------------------------
█

 |----------------------------------------| 0.00% [0/1 00:00&lt;?]

 |████████████████████████████████████████| 100.00% [1/1 00:16&lt;00:00]

                                                                     

                                                                     
█

 |----------------------------------------| 0.00% [0/1 00:00&lt;?]

 |████████████████████████████████████████| 100.00% [1/1 00:14&lt;00:00]

                                                                     

2022-08-11 04:29:22,145 - main - INFO - Deleted Temp folder : /app/12_20220811042722071864
2022-08-11 04:29:22,145 - main - INFO - ML prediction Done!!!
2022-08-11 04:29:22,145 - main - INFO - {&quot;id&quot; : 12,'prediction': 'predicted value here', 'StatusCode': '200', 'Validations': []}       
2022-08-11 04:29:22,077 - main - INFO - *** ML prediction API started for id : 12 ***
2022-08-11 04:29:22,077 - main - INFO - ########################
2022-08-11 04:29:22,077 - main - INFO - Temp folder structure created :  /app/12_20220811042922077785
2022-08-11 04:29:22,100 - main - INFO - File existing in this id folder in S3B folder  .
2022-08-11 04:29:22,101 - main - INFO - File existing in this id folder in S3B folder  ..
2022-08-11 04:29:22,101 - main - INFO - File existing in this id folder in S3B folder  278692642.pdf
2022-08-11 04:29:22,145 - main - INFO - Deleted Temp folder : /app/12_20220811042822080625
2022-08-11 04:29:22,145 - main - INFO - ML prediction Done!!!
2022-08-11 04:29:22,145 - main - INFO - {&quot;id&quot; : 12,'prediction': 'predicted value here', 'StatusCode': '200', 'Validations': []}
2022-08-11 04:28:38,689 - main - INFO - 278692642.pdf
2022-08-11 04:28:39,986 - main - INFO - /app/12_20220811042922077785/278692642.pdf
2022-08-11 04:28:56,711 - main - INFO - prediction  =  done
2022-08-11 04:28:56,711 - main - INFO - -----------------------------------------------------------------------------

----------------------| 0.00% [0/1 00:00&lt;?]

 |████████████████████████████████████████| 100.00% [1/1 00:00&lt;00:00]

                                                                     

2022-08-11 04:29:40,316 - main - INFO - Deleted Temp folder : /app/12_20220811042922077785
2022-08-11 04:29:40,316 - main - INFO - ML prediction Done!!!
2022-08-11 04:29:40,318 - main - INFO - {&quot;id&quot; : 12,'prediction': 'predicted value here', 'StatusCode': '200', 'Validations': []}


---- 

here for first time, it took the request id started processing but before completing i.e before deleting temp path, second process/thread is initiated as i see this log again 
 **ML prediction API started for id : 12 
and a new temp path is also created
2022-08-11 04:28:22,080 - main - INFO - Temp folder structure created :  /app/12_20220811042822080625**
and starts processes same request again before first one is complete then again after few seconds third process/thread is initiated and starts processing on same request. it shouldn't process same request again and again. I don't have any multiprocessing or multithreading concept then why its processing same request again and again. plz guide"><pre class="notranslate"><span class="pl-c">###This API takes id in request , creates temp path in container , searches path for this id in database and copies file from AWS s3b for this id in temp created path, does ML processing and deletes the temp path then returns the predicted data</span>

<span class="pl-k">from</span> <span class="pl-s1">datetime</span> <span class="pl-k">import</span> <span class="pl-s1">datetime</span>
<span class="pl-k">import</span> <span class="pl-s1">uvicorn</span>
<span class="pl-k">from</span> <span class="pl-s1">fastapi</span> <span class="pl-k">import</span> <span class="pl-v">Depends</span>, <span class="pl-v">FastAPI</span>, <span class="pl-v">HTTPException</span>, <span class="pl-v">Request</span>
<span class="pl-k">from</span> <span class="pl-s1">starlette</span>.<span class="pl-s1">middleware</span>.<span class="pl-s1">cors</span> <span class="pl-k">import</span> <span class="pl-v">CORSMiddleware</span>
<span class="pl-c"># initializing FastAPI</span>
<span class="pl-k">from</span> <span class="pl-s1">fastapi</span> <span class="pl-k">import</span> <span class="pl-v">FastAPI</span>, <span class="pl-v">Response</span>, <span class="pl-s1">status</span>
<span class="pl-k">from</span> <span class="pl-s1">fastapi</span>.<span class="pl-s1">responses</span> <span class="pl-k">import</span> <span class="pl-v">JSONResponse</span>
<span class="pl-k">from</span> <span class="pl-s1">pydantic</span> <span class="pl-k">import</span> <span class="pl-v">BaseModel</span>
<span class="pl-k">from</span> <span class="pl-s1">fastapi</span> <span class="pl-k">import</span> <span class="pl-v">Security</span> ,<span class="pl-v">HTTPException</span>
<span class="pl-k">from</span> <span class="pl-s1">fastapi</span>.<span class="pl-s1">security</span>.<span class="pl-s1">api_key</span> <span class="pl-k">import</span> <span class="pl-v">APIKeyHeader</span>
<span class="pl-k">import</span> <span class="pl-s1">pathlib</span>
<span class="pl-s1">temp</span> <span class="pl-c1">=</span> <span class="pl-s1">pathlib</span>.<span class="pl-v">PosixPath</span>
<span class="pl-c">#pathlib.PosixPath = pathlib.WindowsPath</span>

<span class="pl-k">import</span> <span class="pl-s1">torch</span>
<span class="pl-c"># Logging</span>
<span class="pl-k">import</span> <span class="pl-s1">logging</span>, <span class="pl-s1">logging</span>.<span class="pl-s1">config</span>

<span class="pl-s1">logging</span>.<span class="pl-s1">config</span>.<span class="pl-en">dictConfig</span>(
    {
        <span class="pl-s">'version'</span>: <span class="pl-c1">1</span>,
        <span class="pl-s">'disable_existing_loggers'</span>: <span class="pl-c1">True</span>,
    }
)
<span class="pl-k">global</span> <span class="pl-s1">logger</span>
<span class="pl-c"># logging.basicConfig(filename='app.log', filemode='w',format='%(asctime)s:%(levelname)s:%(message)s', level=logging.DEBUG)</span>

<span class="pl-s1">app</span> <span class="pl-c1">=</span> <span class="pl-v">FastAPI</span>(<span class="pl-s1">docs_url</span><span class="pl-c1">=</span><span class="pl-s">"/"</span>, <span class="pl-s1">redoc_url</span><span class="pl-c1">=</span><span class="pl-c1">None</span>,
              <span class="pl-s1">title</span><span class="pl-c1">=</span><span class="pl-s">"First ML API"</span>,
              <span class="pl-s1">description</span><span class="pl-c1">=</span><span class="pl-s">"First ML API"</span>,
              <span class="pl-s1">version</span><span class="pl-c1">=</span><span class="pl-s">"V 1.0"</span>,
              )
<span class="pl-c"># FileDownload()</span>
<span class="pl-c"># SMBConnectionDownload()</span>
<span class="pl-s1">config</span> <span class="pl-c1">=</span> <span class="pl-en">readconfig</span>()

<span class="pl-v">API_KEY</span> <span class="pl-c1">=</span> <span class="pl-s1">config</span>.<span class="pl-v">API_KEY</span>
<span class="pl-v">API_KEY_NAME</span> <span class="pl-c1">=</span> <span class="pl-s1">config</span>.<span class="pl-v">API_KEY_NAME</span>

<span class="pl-s1">api_key_header_auth</span> <span class="pl-c1">=</span> <span class="pl-v">APIKeyHeader</span>(<span class="pl-s1">name</span><span class="pl-c1">=</span><span class="pl-v">API_KEY_NAME</span>, <span class="pl-s1">auto_error</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)

<span class="pl-k">async</span> <span class="pl-k">def</span> <span class="pl-en">get_api_key</span>(<span class="pl-s1">api_key_header</span>: <span class="pl-s1">str</span> <span class="pl-c1">=</span> <span class="pl-v">Security</span>(<span class="pl-s1">api_key_header_auth</span>)):
    <span class="pl-k">if</span> <span class="pl-s1">api_key_header</span> <span class="pl-c1">!=</span> <span class="pl-v">API_KEY</span>:
        <span class="pl-k">raise</span> <span class="pl-v">HTTPException</span>(
            <span class="pl-s1">status_code</span><span class="pl-c1">=</span><span class="pl-s1">status</span>.<span class="pl-v">HTTP_401_UNAUTHORIZED</span>,
            <span class="pl-s1">detail</span><span class="pl-c1">=</span><span class="pl-s">"Invalid API Key"</span>,
        )


<span class="pl-s1">origins</span> <span class="pl-c1">=</span> [
    <span class="pl-s">"http://localhost.tiangolo.com"</span>,
    <span class="pl-s">"https://localhost.tiangolo.com"</span>,
    <span class="pl-s">"http://localhost"</span>,
    <span class="pl-s">"http://localhost:8080"</span>,
    <span class="pl-s">"http://localhost:4200"</span>,
]

<span class="pl-s1">app</span>.<span class="pl-en">add_middleware</span>(
    <span class="pl-v">CORSMiddleware</span>,
    <span class="pl-s1">allow_origins</span><span class="pl-c1">=</span><span class="pl-s1">origins</span>,
    <span class="pl-s1">allow_credentials</span><span class="pl-c1">=</span><span class="pl-c1">True</span>,
    <span class="pl-s1">allow_methods</span><span class="pl-c1">=</span>[<span class="pl-s">"*"</span>],
    <span class="pl-s1">allow_headers</span><span class="pl-c1">=</span>[<span class="pl-s">"*"</span>],
)



<span class="pl-k">class</span> <span class="pl-v">Item</span>(<span class="pl-v">BaseModel</span>):
    <span class="pl-s1">id</span> : <span class="pl-s1">str</span>



<span class="pl-s1">logging</span>.<span class="pl-s1">config</span>.<span class="pl-en">dictConfig</span>(
    {
        <span class="pl-s">'version'</span>: <span class="pl-c1">1</span>,
        <span class="pl-s">'disable_existing_loggers'</span>: <span class="pl-c1">True</span>,
    }
)
<span class="pl-k">global</span> <span class="pl-s1">logger</span>

<span class="pl-s1">logger</span> <span class="pl-c1">=</span> <span class="pl-s1">logging</span>.<span class="pl-en">getLogger</span>(<span class="pl-s">"main"</span>)
<span class="pl-s1">logger</span>.<span class="pl-en">setLevel</span>(<span class="pl-s1">logging</span>.<span class="pl-v">INFO</span>)
<span class="pl-c"># create the logging file handler</span>
<span class="pl-s1">fh</span> <span class="pl-c1">=</span> <span class="pl-s1">logging</span>.<span class="pl-v">FileHandler</span>(<span class="pl-s">"app.log"</span>)
<span class="pl-s1">ch</span> <span class="pl-c1">=</span> <span class="pl-s1">logging</span>.<span class="pl-v">StreamHandler</span>()
<span class="pl-s1">ch</span>.<span class="pl-en">setLevel</span>(<span class="pl-s1">logging</span>.<span class="pl-v">DEBUG</span>)
<span class="pl-s1">formatter</span> <span class="pl-c1">=</span> <span class="pl-s1">logging</span>.<span class="pl-v">Formatter</span>(<span class="pl-s">'%(asctime)s - %(name)s - %(levelname)s - %(message)s'</span>)
<span class="pl-s1">fh</span>.<span class="pl-en">setFormatter</span>(<span class="pl-s1">formatter</span>)
<span class="pl-s1">ch</span>.<span class="pl-en">setFormatter</span>(<span class="pl-s1">formatter</span>)
<span class="pl-k">while</span> <span class="pl-s1">logger</span>.<span class="pl-s1">handlers</span>:
    <span class="pl-s1">logger</span>.<span class="pl-s1">handlers</span>.<span class="pl-en">pop</span>()
<span class="pl-c"># add handler to logger object</span>
<span class="pl-s1">logger</span>.<span class="pl-en">addHandler</span>(<span class="pl-s1">fh</span>)
<span class="pl-s1">logger</span>.<span class="pl-en">addHandler</span>(<span class="pl-s1">ch</span>)
<span class="pl-s1">logger</span>.<span class="pl-s1">propagate</span> <span class="pl-c1">=</span> <span class="pl-c1">False</span>



<span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-en">get</span>(<span class="pl-s">"/"</span>)</span>
<span class="pl-k">async</span> <span class="pl-k">def</span> <span class="pl-en">root</span>():
    <span class="pl-k">return</span> {<span class="pl-s">"message"</span>: <span class="pl-s">"Hello Bigger Applications!"</span>}


<span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-en">get</span>(<span class="pl-s">"/heartbeat"</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">heartbeat</span>():
    <span class="pl-k">return</span> <span class="pl-s">"Success"</span>


<span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-en">get</span>(<span class="pl-s">'/predictdata'</span>,<span class="pl-s1">dependencies</span><span class="pl-c1">=</span>[<span class="pl-v">Security</span>(<span class="pl-s1">get_api_key</span>)])</span>
<span class="pl-k">def</span> <span class="pl-en">predictdata</span>(<span class="pl-s1">id</span>: <span class="pl-s1">str</span>):


    <span class="pl-k">try</span>:
        <span class="pl-s1">res</span> <span class="pl-c1">=</span> {<span class="pl-s">"id"</span> : <span class="pl-s1">id</span> , <span class="pl-s">"prediction"</span>: <span class="pl-s">""</span> , <span class="pl-s">"StatusCode"</span> : <span class="pl-s">"200"</span>, <span class="pl-s">"Validations"</span> : []}
        
        <span class="pl-k">if</span> <span class="pl-c1">not</span> <span class="pl-s1">id</span>.<span class="pl-en">isdigit</span>():
            <span class="pl-s1">res</span>[<span class="pl-s">"Validations"</span>].<span class="pl-en">append</span>({<span class="pl-s">"Type"</span> : <span class="pl-s">"Validation"</span>, <span class="pl-s">"Description"</span> : <span class="pl-s">"id must be a integer"</span>})
            <span class="pl-k">raise</span> <span class="pl-v">TypeError</span>(<span class="pl-s">"id must be an integer"</span>)
        
        <span class="pl-s1">logger</span>.<span class="pl-en">info</span>(<span class="pl-s">"*** ML prediction API started for Id : {} ***"</span>.<span class="pl-en">format</span>(<span class="pl-s1">id</span>))
        <span class="pl-s1">logger</span>.<span class="pl-en">info</span>(<span class="pl-s">"########################"</span>)
        <span class="pl-s1">data</span> <span class="pl-c1">=</span> <span class="pl-v">ML_Process</span>(<span class="pl-s1">id</span>, <span class="pl-s1">res</span>)
        <span class="pl-s1">res</span> <span class="pl-c1">=</span> <span class="pl-s1">data</span>
        <span class="pl-s1">logger</span>.<span class="pl-en">info</span>(<span class="pl-s1">res</span>)

        <span class="pl-k">return</span> <span class="pl-v">JSONResponse</span>(<span class="pl-s1">status_code</span><span class="pl-c1">=</span><span class="pl-en">int</span>(<span class="pl-s1">res</span>[<span class="pl-s">"StatusCode"</span>]), <span class="pl-s1">content</span><span class="pl-c1">=</span><span class="pl-s1">res</span>)

    <span class="pl-k">except</span> <span class="pl-v">Exception</span> <span class="pl-k">as</span> <span class="pl-s1">ex</span>:


            <span class="pl-s1">traceback</span>.<span class="pl-en">print_exc</span>()
            <span class="pl-s1">error_trace</span> <span class="pl-c1">=</span> <span class="pl-s1">traceback</span>.<span class="pl-en">format_exc</span>()
            <span class="pl-s1">res</span>[<span class="pl-s">"Validations"</span>].<span class="pl-en">append</span>({<span class="pl-s">"Type"</span> : <span class="pl-s">"Error"</span>,<span class="pl-s">"Description"</span> : <span class="pl-s1">error_trace</span>})
            <span class="pl-s1">res</span>[<span class="pl-s">"StatusCode"</span>] <span class="pl-c1">=</span> <span class="pl-en">str</span>(<span class="pl-c1">500</span>)
            <span class="pl-s1">logger</span>.<span class="pl-en">exception</span>(<span class="pl-s">"Exception in my ML API"</span>)
            <span class="pl-s1">logger</span>.<span class="pl-en">error</span>(<span class="pl-s1">ex</span>,<span class="pl-s1">exc_info</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)

    <span class="pl-k">return</span> <span class="pl-v">JSONResponse</span>(<span class="pl-s1">status_code</span><span class="pl-c1">=</span><span class="pl-c1">500</span>, <span class="pl-s1">content</span><span class="pl-c1">=</span><span class="pl-s1">res</span>)

	
<span class="pl-k">def</span> <span class="pl-v">ML_Process</span>(<span class="pl-s1">id</span>, <span class="pl-s1">res</span>):
    <span class="pl-c">#get docpath from db by id , copy doc to temp path from s3b and run ML model on the doc</span>
    <span class="pl-c">#after processing it deletes temp path and returns predicted data</span>
    <span class="pl-c"># this is a long running process takes avg 25 second but can take sometime 1-2 minutes.</span>
    <span class="pl-c"># Issue is observed only when it's a long running requests e.g Model takes more time to do inference</span>
  


<span class="pl-k">if</span> <span class="pl-s1">__name__</span> <span class="pl-c1">==</span> <span class="pl-s">"__main__"</span>:
    <span class="pl-s1">uvicorn</span>.<span class="pl-en">run</span>(
        <span class="pl-s1">app</span>,
        <span class="pl-s1">host</span><span class="pl-c1">=</span><span class="pl-s">"0.0.0.0"</span>,
        <span class="pl-s1">port</span><span class="pl-c1">=</span><span class="pl-c1">8422</span>
    )


<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span>

<span class="pl-v">Dockerfile</span>

<span class="pl-v">FROM</span> <span class="pl-s1">python</span>:<span class="pl-c1">3</span>

<span class="pl-v">WORKDIR</span> <span class="pl-c1">/</span><span class="pl-s1">app</span>

<span class="pl-v">COPY</span> <span class="pl-s1">requirements</span>.<span class="pl-s1">txt</span> <span class="pl-s1">requirements</span>.<span class="pl-s1">txt</span>

<span class="pl-v">RUN</span> <span class="pl-s1">pip</span> <span class="pl-s1">install</span> <span class="pl-c1">-</span><span class="pl-s1">r</span> <span class="pl-s1">requirements</span>.<span class="pl-s1">txt</span>


<span class="pl-v">RUN</span> <span class="pl-s1">apt</span><span class="pl-c1">-</span><span class="pl-s1">get</span> <span class="pl-s1">update</span>

<span class="pl-v">RUN</span> <span class="pl-s1">apt</span><span class="pl-c1">-</span><span class="pl-s1">get</span> <span class="pl-s1">install</span> <span class="pl-s1">poppler</span><span class="pl-c1">-</span><span class="pl-s1">utils</span> <span class="pl-c1">-</span><span class="pl-s1">y</span> <span class="pl-c1">&amp;</span><span class="pl-c1">&amp;</span> \
    <span class="pl-s1">apt</span> <span class="pl-s1">install</span> <span class="pl-s1">ghostscript</span> <span class="pl-c1">-</span><span class="pl-s1">y</span> <span class="pl-c1">&amp;</span><span class="pl-c1">&amp;</span> \
    <span class="pl-s1">apt</span><span class="pl-c1">-</span><span class="pl-s1">get</span> <span class="pl-s1">install</span> <span class="pl-c1">-</span><span class="pl-s1">y</span> <span class="pl-s1">tesseract</span><span class="pl-c1">-</span><span class="pl-s1">ocr</span> <span class="pl-c1">&amp;</span><span class="pl-c1">&amp;</span> \


<span class="pl-v">COPY</span> . .

<span class="pl-v">WORKDIR</span> <span class="pl-c1">/</span><span class="pl-s1">app</span>

<span class="pl-v">CMD</span> <span class="pl-s1">uvicorn</span> <span class="pl-s1">app</span>:<span class="pl-s1">app</span> <span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-s1">host</span> <span class="pl-c1">0.0</span><span class="pl-c1">.0</span><span class="pl-c1">.0</span> <span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-s1">port</span> <span class="pl-c1">5057</span> 



<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span>


<span class="pl-v">Kubernetes</span> <span class="pl-s1">pod</span> <span class="pl-s1">logs</span> <span class="pl-s1">of</span> <span class="pl-s1">application</span> <span class="pl-s1">which</span> <span class="pl-s1">shows</span> <span class="pl-s1">same</span> <span class="pl-s1">request</span> <span class="pl-s1">getting</span> <span class="pl-s1">processed</span> <span class="pl-s1">multiple</span> <span class="pl-s1">times</span>

<span class="pl-s1">i</span> <span class="pl-s1">sent</span> <span class="pl-s1">the</span> <span class="pl-s1">request</span> <span class="pl-s1">of</span> <span class="pl-s1">id</span> <span class="pl-c1">-</span> <span class="pl-c1">12</span> <span class="pl-s1">only</span> <span class="pl-s1">once</span> <span class="pl-s1">through</span> <span class="pl-s1">the</span> <span class="pl-s1">swagger</span>  <span class="pl-c1">and</span> <span class="pl-s1">nobody</span> <span class="pl-s1">else</span> <span class="pl-s1">was</span> <span class="pl-s1">using</span> <span class="pl-s1">it</span> 

<span class="pl-s1">log</span> :<span class="pl-c1">-</span>

<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">27</span>:<span class="pl-c1">22</span>,<span class="pl-c1">070</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-c1">**</span><span class="pl-c1">*</span> <span class="pl-v">ML</span> <span class="pl-s1">prediction</span> <span class="pl-v">API</span> <span class="pl-s1">started</span> <span class="pl-k">for</span> <span class="pl-s1">id</span> : <span class="pl-c1">12</span> <span class="pl-c1">**</span><span class="pl-c1">*</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">27</span>:<span class="pl-c1">22</span>,<span class="pl-c1">071</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-c">########################</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">27</span>:<span class="pl-c1">22</span>,<span class="pl-c1">072</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">Temp</span> <span class="pl-s1">folder</span> <span class="pl-s1">structure</span> <span class="pl-s1">created</span> :  <span class="pl-c1">/</span><span class="pl-s1">app</span><span class="pl-c1">/</span><span class="pl-c1">12_20220811042722071864</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">27</span>:<span class="pl-c1">22</span>,<span class="pl-c1">104</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">File</span> <span class="pl-s1">existing</span> <span class="pl-c1">in</span> <span class="pl-s1">this</span> <span class="pl-s1">id</span> <span class="pl-s1">folder</span> <span class="pl-c1">in</span> <span class="pl-v">S3B</span> <span class="pl-s1">folder</span>  .
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">27</span>:<span class="pl-c1">22</span>,<span class="pl-c1">105</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">File</span> <span class="pl-s1">existing</span> <span class="pl-c1">in</span> <span class="pl-s1">this</span> <span class="pl-s1">id</span> <span class="pl-s1">folder</span> <span class="pl-c1">in</span> <span class="pl-v">S3B</span> <span class="pl-s1">folder</span>  ..
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">27</span>:<span class="pl-c1">22</span>,<span class="pl-c1">105</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">File</span> <span class="pl-s1">existing</span> <span class="pl-c1">in</span> <span class="pl-s1">this</span> <span class="pl-s1">id</span> <span class="pl-s1">folder</span> <span class="pl-c1">in</span> <span class="pl-v">S3B</span> <span class="pl-s1">folder</span>  <span class="pl-c1">278692642.</span><span class="pl-s1">pdf</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">27</span>:<span class="pl-c1">22</span>,<span class="pl-c1">591</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-s">"278692642.pdf"</span> <span class="pl-s1">file</span> <span class="pl-s1">copied</span> <span class="pl-c1">in</span> <span class="pl-s1">temp</span> <span class="pl-s1">directory</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">27</span>:<span class="pl-c1">27</span>,<span class="pl-c1">518</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-c1">278692642.</span><span class="pl-s1">pdf</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">27</span>:<span class="pl-c1">27</span>,<span class="pl-c1">706</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-c1">/</span><span class="pl-s1">app</span><span class="pl-c1">/</span><span class="pl-c1">12_20220811042722071864</span><span class="pl-c1">/</span><span class="pl-c1">278692642.</span><span class="pl-s1">pdf</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">56</span>,<span class="pl-c1">711</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-s1">prediction</span>  <span class="pl-c1">=</span>  <span class="pl-s1">done</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">56</span>,<span class="pl-c1">711</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">22</span>,<span class="pl-c1">078</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-c1">**</span><span class="pl-c1">*</span> <span class="pl-v">ML</span> <span class="pl-s1">prediction</span> <span class="pl-v">API</span> <span class="pl-s1">started</span> <span class="pl-k">for</span> <span class="pl-s1">id</span> : <span class="pl-c1">12</span> <span class="pl-c1">**</span><span class="pl-c1">*</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">22</span>,<span class="pl-c1">080</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-c">########################</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">22</span>,<span class="pl-c1">080</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">Temp</span> <span class="pl-s1">folder</span> <span class="pl-s1">structure</span> <span class="pl-s1">created</span> :  <span class="pl-c1">/</span><span class="pl-s1">app</span><span class="pl-c1">/</span><span class="pl-c1">12_20220811042822080625</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">22</span>,<span class="pl-c1">292</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">File</span> <span class="pl-s1">existing</span> <span class="pl-c1">in</span> <span class="pl-s1">this</span> <span class="pl-s1">id</span> <span class="pl-s1">folder</span> <span class="pl-c1">in</span> <span class="pl-v">S3B</span> <span class="pl-s1">folder</span>  .
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">22</span>,<span class="pl-c1">292</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">File</span> <span class="pl-s1">existing</span> <span class="pl-c1">in</span> <span class="pl-s1">this</span> <span class="pl-s1">id</span> <span class="pl-s1">folder</span> <span class="pl-c1">in</span> <span class="pl-v">S3B</span> <span class="pl-s1">folder</span>  ..
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">22</span>,<span class="pl-c1">292</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">File</span> <span class="pl-s1">existing</span> <span class="pl-c1">in</span> <span class="pl-s1">this</span> <span class="pl-s1">id</span> <span class="pl-s1">folder</span> <span class="pl-c1">in</span> <span class="pl-v">S3B</span> <span class="pl-s1">folder</span>  <span class="pl-c1">278692642.</span><span class="pl-s1">pdf</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">24</span>,<span class="pl-c1">784</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-s">"278692642.pdf"</span> <span class="pl-s1">file</span> <span class="pl-s1">copied</span> <span class="pl-c1">in</span> <span class="pl-s1">temp</span> <span class="pl-s1">directory</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">38</span>,<span class="pl-c1">689</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-c1">278692642.</span><span class="pl-s1">pdf</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">39</span>,<span class="pl-c1">986</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-c1">/</span><span class="pl-s1">app</span><span class="pl-c1">/</span><span class="pl-c1">12_20220811042822080625</span><span class="pl-c1">/</span><span class="pl-c1">278692642.</span><span class="pl-s1">pdf</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">56</span>,<span class="pl-c1">711</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-s1">prediction</span>  <span class="pl-c1">=</span>  <span class="pl-s1">done</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">56</span>,<span class="pl-c1">711</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span>
█

 <span class="pl-c1">|</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">|</span> <span class="pl-c1">0.00</span><span class="pl-c1">%</span> [<span class="pl-c1">0</span><span class="pl-c1">/</span><span class="pl-c1">1</span> <span class="pl-c1">00</span>:<span class="pl-c1">00</span><span class="pl-c1">&lt;</span>?]

 <span class="pl-c1">|</span>████████████████████████████████████████<span class="pl-c1">|</span> <span class="pl-c1">100.00</span><span class="pl-c1">%</span> [<span class="pl-c1">1</span><span class="pl-c1">/</span><span class="pl-c1">1</span> <span class="pl-c1">00</span>:<span class="pl-c1">16</span><span class="pl-c1">&lt;</span><span class="pl-c1">00</span>:<span class="pl-c1">00</span>]

                                                                     

                                                                     
█

 <span class="pl-c1">|</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">|</span> <span class="pl-c1">0.00</span><span class="pl-c1">%</span> [<span class="pl-c1">0</span><span class="pl-c1">/</span><span class="pl-c1">1</span> <span class="pl-c1">00</span>:<span class="pl-c1">00</span><span class="pl-c1">&lt;</span>?]

 <span class="pl-c1">|</span>████████████████████████████████████████<span class="pl-c1">|</span> <span class="pl-c1">100.00</span><span class="pl-c1">%</span> [<span class="pl-c1">1</span><span class="pl-c1">/</span><span class="pl-c1">1</span> <span class="pl-c1">00</span>:<span class="pl-c1">14</span><span class="pl-c1">&lt;</span><span class="pl-c1">00</span>:<span class="pl-c1">00</span>]

                                                                     

<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">29</span>:<span class="pl-c1">22</span>,<span class="pl-c1">145</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">Deleted</span> <span class="pl-v">Temp</span> <span class="pl-s1">folder</span> : <span class="pl-c1">/</span><span class="pl-s1">app</span><span class="pl-c1">/</span><span class="pl-c1">12_20220811042722071864</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">29</span>:<span class="pl-c1">22</span>,<span class="pl-c1">145</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">ML</span> <span class="pl-s1">prediction</span> <span class="pl-v">Done</span>!!!
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">29</span>:<span class="pl-c1">22</span>,<span class="pl-c1">145</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> {<span class="pl-s">"id"</span> : <span class="pl-c1">12</span>,<span class="pl-s">'prediction'</span>: <span class="pl-s">'predicted value here'</span>, <span class="pl-s">'StatusCode'</span>: <span class="pl-s">'200'</span>, <span class="pl-s">'Validations'</span>: []}       
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">29</span>:<span class="pl-c1">22</span>,<span class="pl-c1">077</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-c1">**</span><span class="pl-c1">*</span> <span class="pl-v">ML</span> <span class="pl-s1">prediction</span> <span class="pl-v">API</span> <span class="pl-s1">started</span> <span class="pl-k">for</span> <span class="pl-s1">id</span> : <span class="pl-c1">12</span> <span class="pl-c1">**</span><span class="pl-c1">*</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">29</span>:<span class="pl-c1">22</span>,<span class="pl-c1">077</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-c">########################</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">29</span>:<span class="pl-c1">22</span>,<span class="pl-c1">077</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">Temp</span> <span class="pl-s1">folder</span> <span class="pl-s1">structure</span> <span class="pl-s1">created</span> :  <span class="pl-c1">/</span><span class="pl-s1">app</span><span class="pl-c1">/</span><span class="pl-c1">12_20220811042922077785</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">29</span>:<span class="pl-c1">22</span>,<span class="pl-c1">100</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">File</span> <span class="pl-s1">existing</span> <span class="pl-c1">in</span> <span class="pl-s1">this</span> <span class="pl-s1">id</span> <span class="pl-s1">folder</span> <span class="pl-c1">in</span> <span class="pl-v">S3B</span> <span class="pl-s1">folder</span>  .
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">29</span>:<span class="pl-c1">22</span>,<span class="pl-c1">101</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">File</span> <span class="pl-s1">existing</span> <span class="pl-c1">in</span> <span class="pl-s1">this</span> <span class="pl-s1">id</span> <span class="pl-s1">folder</span> <span class="pl-c1">in</span> <span class="pl-v">S3B</span> <span class="pl-s1">folder</span>  ..
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">29</span>:<span class="pl-c1">22</span>,<span class="pl-c1">101</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">File</span> <span class="pl-s1">existing</span> <span class="pl-c1">in</span> <span class="pl-s1">this</span> <span class="pl-s1">id</span> <span class="pl-s1">folder</span> <span class="pl-c1">in</span> <span class="pl-v">S3B</span> <span class="pl-s1">folder</span>  <span class="pl-c1">278692642.</span><span class="pl-s1">pdf</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">29</span>:<span class="pl-c1">22</span>,<span class="pl-c1">145</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">Deleted</span> <span class="pl-v">Temp</span> <span class="pl-s1">folder</span> : <span class="pl-c1">/</span><span class="pl-s1">app</span><span class="pl-c1">/</span><span class="pl-c1">12_20220811042822080625</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">29</span>:<span class="pl-c1">22</span>,<span class="pl-c1">145</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">ML</span> <span class="pl-s1">prediction</span> <span class="pl-v">Done</span>!!!
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">29</span>:<span class="pl-c1">22</span>,<span class="pl-c1">145</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> {<span class="pl-s">"id"</span> : <span class="pl-c1">12</span>,<span class="pl-s">'prediction'</span>: <span class="pl-s">'predicted value here'</span>, <span class="pl-s">'StatusCode'</span>: <span class="pl-s">'200'</span>, <span class="pl-s">'Validations'</span>: []}
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">38</span>,<span class="pl-c1">689</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-c1">278692642.</span><span class="pl-s1">pdf</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">39</span>,<span class="pl-c1">986</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-c1">/</span><span class="pl-s1">app</span><span class="pl-c1">/</span><span class="pl-c1">12_20220811042922077785</span><span class="pl-c1">/</span><span class="pl-c1">278692642.</span><span class="pl-s1">pdf</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">56</span>,<span class="pl-c1">711</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-s1">prediction</span>  <span class="pl-c1">=</span>  <span class="pl-s1">done</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">56</span>,<span class="pl-c1">711</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span>

<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">|</span> <span class="pl-c1">0.00</span><span class="pl-c1">%</span> [<span class="pl-c1">0</span><span class="pl-c1">/</span><span class="pl-c1">1</span> <span class="pl-c1">00</span>:<span class="pl-c1">00</span><span class="pl-c1">&lt;</span>?]

 <span class="pl-c1">|</span>████████████████████████████████████████<span class="pl-c1">|</span> <span class="pl-c1">100.00</span><span class="pl-c1">%</span> [<span class="pl-c1">1</span><span class="pl-c1">/</span><span class="pl-c1">1</span> <span class="pl-c1">00</span>:<span class="pl-c1">00</span><span class="pl-c1">&lt;</span><span class="pl-c1">00</span>:<span class="pl-c1">00</span>]

                                                                     

<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">29</span>:<span class="pl-c1">40</span>,<span class="pl-c1">316</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">Deleted</span> <span class="pl-v">Temp</span> <span class="pl-s1">folder</span> : <span class="pl-c1">/</span><span class="pl-s1">app</span><span class="pl-c1">/</span><span class="pl-c1">12_20220811042922077785</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">29</span>:<span class="pl-c1">40</span>,<span class="pl-c1">316</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">ML</span> <span class="pl-s1">prediction</span> <span class="pl-v">Done</span>!!!
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">29</span>:<span class="pl-c1">40</span>,<span class="pl-c1">318</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> {<span class="pl-s">"id"</span> : <span class="pl-c1">12</span>,<span class="pl-s">'prediction'</span>: <span class="pl-s">'predicted value here'</span>, <span class="pl-s">'StatusCode'</span>: <span class="pl-s">'200'</span>, <span class="pl-s">'Validations'</span>: []}


<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">-</span> 

<span class="pl-s1">here</span> <span class="pl-s1">for</span> <span class="pl-s1">first</span> <span class="pl-s1">time</span>, <span class="pl-s1">it</span> <span class="pl-s1">took</span> <span class="pl-s1">the</span> <span class="pl-s1">request</span> <span class="pl-s1">id</span> <span class="pl-s1">started</span> <span class="pl-s1">processing</span> <span class="pl-s1">but</span> <span class="pl-s1">before</span> <span class="pl-s1">completing</span> <span class="pl-s1">i</span>.<span class="pl-s1">e</span> <span class="pl-s1">before</span> <span class="pl-s1">deleting</span> <span class="pl-s1">temp</span> <span class="pl-s1">path</span>, <span class="pl-s1">second</span> <span class="pl-s1">process</span><span class="pl-c1">/</span><span class="pl-s1">thread</span> <span class="pl-c1">is</span> <span class="pl-s1">initiated</span> <span class="pl-k">as</span> <span class="pl-s1">i</span> <span class="pl-s1">see</span> <span class="pl-s1">this</span> <span class="pl-s1">log</span> <span class="pl-s1">again</span> 
 <span class="pl-c1">**</span><span class="pl-v">ML</span> <span class="pl-s1">prediction</span> <span class="pl-v">API</span> <span class="pl-s1">started</span> <span class="pl-k">for</span> <span class="pl-s1">id</span> : <span class="pl-c1">12</span> 
<span class="pl-c1">and</span> <span class="pl-s1">a</span> <span class="pl-s1">new</span> <span class="pl-s1">temp</span> <span class="pl-s1">path</span> <span class="pl-s1">is</span> <span class="pl-s1">also</span> <span class="pl-s1">created</span>
<span class="pl-c1">2022</span><span class="pl-c1">-</span><span class="pl-c1">08</span><span class="pl-c1">-</span><span class="pl-c1">11</span> <span class="pl-c1">04</span>:<span class="pl-c1">28</span>:<span class="pl-c1">22</span>,<span class="pl-c1">080</span> <span class="pl-c1">-</span> <span class="pl-s1">main</span> <span class="pl-c1">-</span> <span class="pl-v">INFO</span> <span class="pl-c1">-</span> <span class="pl-v">Temp</span> <span class="pl-s1">folder</span> <span class="pl-s1">structure</span> <span class="pl-s1">created</span> :  <span class="pl-c1">/</span><span class="pl-s1">app</span><span class="pl-c1">/</span><span class="pl-c1">12_20220811042822080625</span><span class="pl-c1">**</span>
<span class="pl-s1">and</span> <span class="pl-s1">starts</span> <span class="pl-s1">processes</span> <span class="pl-s1">same</span> <span class="pl-s1">request</span> <span class="pl-s1">again</span> <span class="pl-s1">before</span> <span class="pl-s1">first</span> <span class="pl-s1">one</span> <span class="pl-c1">is</span> <span class="pl-s1">complete</span> <span class="pl-s1">then</span> <span class="pl-s1">again</span> <span class="pl-s1">after</span> <span class="pl-s1">few</span> <span class="pl-s1">seconds</span> <span class="pl-s1">third</span> <span class="pl-s1">process</span><span class="pl-c1">/</span><span class="pl-s1">thread</span> <span class="pl-c1">is</span> <span class="pl-s1">initiated</span> <span class="pl-c1">and</span> <span class="pl-s1">starts</span> <span class="pl-s1">processing</span> <span class="pl-s1">on</span> <span class="pl-s1">same</span> <span class="pl-s1">request</span>. <span class="pl-s1">it</span> <span class="pl-s1">shouldn</span><span class="pl-s">'t process same request again and again. I don'</span><span class="pl-s1">t</span> <span class="pl-s1">have</span> <span class="pl-s1">any</span> <span class="pl-s1">multiprocessing</span> <span class="pl-c1">or</span> <span class="pl-s1">multithreading</span> <span class="pl-s1">concept</span> <span class="pl-s1">then</span> <span class="pl-s1">why</span> <span class="pl-s1">its</span> <span class="pl-s1">processing</span> <span class="pl-s1">same</span> <span class="pl-s1">request</span> <span class="pl-s1">again</span> <span class="pl-c1">and</span> <span class="pl-s1">again</span>. <span class="pl-s1">plz</span> <span class="pl-s1">guide</span></pre></div>
<h3 dir="auto">Description</h3>
<p dir="auto">I don't have any multiprocessing or multithreading concept in my Fast API Application then why its processing same request again and again.  Its a simple ML Processing Application</p>
<h3 dir="auto">Operating System</h3>
<p dir="auto">Linux</p>
<h3 dir="auto">Operating System Details</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">FastAPI Version</h3>
<p dir="auto">fastapi-0.68.2</p>
<h3 dir="auto">Python Version</h3>
<p dir="auto">3.8.5</p>
<h3 dir="auto">Additional Context</h3>
<p dir="auto"><em>No response</em></p>