async function stops while backend threadpoolexecutor is running

Suoritettu Julkaistu 1 vuosi sitten Maksettu toimituksen yhteydessä
Suoritettu Maksettu toimituksen yhteydessä

I am trying to build a progress bar on my home page ([login to view URL]) using async function. async function awaits for fetch from flask function @progress, and based on the fetched data, it updates the progress bar.

In flask, I have multithreaded API calls, which are initiated within @home function after the submit button is pressed from the [login to view URL] page. Submit button is part of a wtf form.

After succesful completion of threads, there is redirect to @output where the result is displayed in output.html.

This works perfectly in chrome browser in PC environment. However, in azure hosted environment, the async javascript function stops while the threadpoolexecutor is running in the backend. I cannot see the async function running in the log stream. The progress bar also stops updating since async has stopped.

Just before redirect for output, the last status is displayed in the progress bar.

** Backend Flask**

@[login to view URL]('/', methods=['GET', 'POST'])

def home():

global TEMP_FILES

topic_form = TopicForm()

threads = []

if topic_form.validate_on_submit():

with ThreadPoolExecutor(max_workers=20) as executor:

for index, pdf_path in enumerate(TEMP_FILES):

[login to view URL]([login to view URL](xxx, xxx,xxx))

wait(threads)

return redirect(url_for('output'))

return render_template("[login to view URL]", topic_form=topic_form)

@[login to view URL]('/progress/<int:file_id>')

def progress(file_id):

try:

status_dict = {'status': 'xyz, 'value':'123'}

except IndexError:

status_dict = {'status': "Start", 'value': "1"}

return [login to view URL](status_dict)

**In the [login to view URL]**

<form method="POST">

{{ topic_form.csrf_token }}

{{ [login to view URL] }}

</form>

<p>The executions takes about 20 - 30 secs per file.</p>

<h5>File 1 - Progress Bar</h5>

<div class="progress progress-striped active">

<div id="file0-bar" class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 1%">Start</div>

</div>

**Script**

<script>

var timeout;

async function getStatus() {

let get_0;

try {

const res_0 = await fetch("/progress/0");

get_0 = await [login to view URL]();

} catch (e) {

[login to view URL]("Error: ", e);

}

[login to view URL]("file0-bar").innerHTML = [login to view URL];

[login to view URL]("file0-bar").style.width= [login to view URL] + "%";

timeout = setTimeout(getStatus, 1000);

}

getStatus();

</script>

JavaScript Tietojärjestelmäarkkitehtuuri Python Flask HTML5

Projektin tunnus: #35905844

Tietoa projektista

14 ehdotusta Etäprojekti Aktiivinen 1 vuosi sitten

Myönnetty käyttäjälle:

manojmo

hi, Are there any errors in the javascript console( dev tools ) ? What is the status code for the async request in the network tab of dev tools ? Does the async request get logged on the server even once ? Btw, is t Lisää

€70 EUR 2 päivässä
(6 Arvostelua)
4.2

14 freelanceria on tarjonnut keskimäärin €170 tähän työhön

kazemmojtama

Hello, good time Hope you are doing well I'm expert in MATLAB/Simulink, Python, PHP, JavaScript and C programming and by strong mathematical and statistical background, have good flexibility for solve your project. I Lisää

€250 EUR 7 päivässä
(12 arvostelua)
6.6
priyank086

Hello, Greetings of the day!! I have understood your requirement in the project “140.00 EUR This project will be delivered in 7 Days” I have 10+ years Experience in Nodejs, Python, AI/ML, Web Designing/Development Lisää

€140 EUR 7 päivässä
(11 arvostelua)
4.4
vijaydvaswani

It seems that the issue with the progress bar not updating in the hosted environment is due to the fetch requests being blocked by some security measures. The fact that it works locally in a PC environment suggests tha Lisää

€200 EUR 3 päivässä
(7 arvostelua)
3.9
ayanelaw

Hi, my name is Wale, i am a full-stack web developer with python as my primary language and django as my framework. However, i think i can get around flask pretty quickly to work on this project. How about taking a dif Lisää

€200 EUR 21 päivässä
(7 arvostelua)
4.0
Sanskriti143

Hello Satya Prakash S., I am an expert developer and designer I can start working immediately and can help you with "async function stops while backend threadpoolexecutor is running " as per the requirements. Just Lisää

€140 EUR 7 päivässä
(3 arvostelua)
3.5
raeedawer

Hi, I'm Raeed, as a java developer it is interesting to help you with your project. You can contact me to talk about the details

€90 EUR 7 päivässä
(6 arvostelua)
3.1
hashirqureshi01

async function stops while backend threadpoolexecutor is running Hello Satya Prakash S., I would like to grab this opportunity and will be dedicated to your work till you get 100% satisfied with the tasks. I have Lisää

€140 EUR 7 päivässä
(2 arvostelua)
1.0
alsaharia5

Hey, I have 4 years of experience in working with python algorithms and making projects work independently. I have worked with data from several companies and have done projects involving high level quantitative. I can Lisää

€155.56 EUR 3 päivässä
(1 arvostelu)
0.8
amritadalal188

Hello, I have read your project details. I am an experienced Web developer having experience of over 9 years. I can easily build sites of the following niche 1) Static 2) Dynamic 3) Ecommerce website 4) Education Webs Lisää

€210 EUR 12 päivässä
(0 arvostelua)
0.0
freelancemonica1

Hi Greetings! I am available right now for the project discussion and can start the project on an immediate basis. I have understood your project requirement I have7++ experience in design and development. I can ha Lisää

€250 EUR 7 päivässä
(0 arvostelua)
0.0