Skip to content

how to deal with parallel microbetag calls  #8

@hariszaf

Description

@hariszaf

Running more than one jobs at the same time.

Here is the behavior of our VM which currently has a max memory (ram) of 3.8G

  • with no jobs: ~0.9G
  • with a single analysis: ~1.84G
  • with two analyeses: ~2.5G
    in the last case our CPUs were apparently running in 100%.
    Interestingly, even both jobs were completed and a .cx file was exported in both output folders under /tmp only in the first query it was actually returned. In the other the only thing that happened was that the style was changed

To enable several users at the same time, one thing is to increase VM memory (ram).
Alternatively, we can adapt a queuing system returning the annotated network through an email.

From AI, here is the concept:

from flask import Flask, jsonify
import threading
import time

app = Flask(__name__)

# Create a lock object
lock = threading.Lock()

@app.route('/process')
def process_request():
    # Acquire the lock before starting the process
    lock.acquire()

    try:
        # Simulate a long-running process
        time.sleep(5)
        result = {"status": "success", "message": "Process completed successfully"}
    finally:
        # Release the lock after the process is complete
        lock.release()

    return jsonify(result)

if __name__ == '__main__':
    app.run(debug=True)

For more on the Lock check here.

Make sure with IT it is ok we send emails from the VM.
If yes, create an email account to do so.
This can be the same for the μgrowthDB too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions