Novartis / peax

Peax is a tool for interactive visual pattern search and exploration in epigenomic data based on unsupervised representation learning with autoencoders
http://peax.lekschas.de
Other
68 stars 14 forks source link

BE and FE information exchange after/during time-consuming operations #17

Closed cherepanovic closed 3 years ago

cherepanovic commented 3 years ago

Hello Fritz,

may I ask you how did you implement the communication between FE and BE after having triggered time-consuming operations such as model training (which run in separated threads)? How does the BE inform FE (for rerendering entire information on the page) after finishing a time-consuming job?

At the first glance, I could see that you don't use sockets.

thanks!

flekschas commented 3 years ago

It's pretty simple, I used three ingredients

The while communication works as follows:

  1. The frontend sends a request (e.g., PUT) to the server (e.g., to compute a projection)
  2. The server receives it and spins up a thread in which it computes the embedding
  3. Meanwhile the frontend creates a Promise for retrieving the embedding and queries the backend (GET request)
  4. The backend will check if the thread is still running and respond accordingly
  5. If the frontend gets a response saying the backend is still running it waits a bit and sends another request
cherepanovic commented 3 years ago
  1. If the frontend gets a response saying the backend is still running it waits a bit and sends another request

but if the user reloads the site then the site would be in the initial state and consequentially forget all previous requests (promises) to the backend etc.... or sends it (FE) always the same request to the backend independent whether something was requested to calculate?

flekschas commented 3 years ago

but if the user reloads the site then the site would be in the initial state and consequentially forget all previous requests (promises) to the backend etc.... or sends it (FE) always the same request to the backend independent whether something was requested to calculate?

No. The system is smarter than that ;) On init it check what resources are already available and then just retrieves them. If they are still computing you end up again in step 5.

cherepanovic commented 3 years ago

will look at it deeper :) thank you!

*btw is it a known best practice, does this pattern have a name?