Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/parallel jobs #195

Open
wants to merge 12 commits into
base: project/improve-queue
Choose a base branch
from

Conversation

Riul1999
Copy link
Collaborator

@Riul1999 Riul1999 commented Mar 26, 2024

Summary

Refactored the jobs in order to execute them in parallel, using multiprocessing Process.
In order to do so the Job Queue was refacored, decoupling the run method from the DashAI core, now it can run in another process.

Type of change

  • Back end new feature.
  • Refactoring.

Changes

  • Refactored run method from ModelJob, now it receive all the dependencies required to be execute and it not depends on the Container.
  • Added method get_args to BaseJob and ModelJob to get the required arguments of the job to be executed (run).
  • Added method store_results to BaseJob and ModelJob to persist the results of the job, storing the target data in the DB.
  • Added methods deliver_job, start_job, finish_job and terminate__job to register the state of the job and give feedback to the user.
  • Now it's not necessary to pass the db connection directly to the Job, so the job POST endpoint was modified to not use the db.
  • The job_queue_loop was updated to use the new API of Jobs, a Pipe is used to send/receive the results of the run method.
  • Added a new wait_point in the job_queue_loop function to wait until the child process sends data or an exception occurs. If an exception occurs, the execution status is set to error and the next job is executed.
  • Refactored DummyJob in test_simple_job_queue to use the new Job API.

How to Test

Run pytest .\tests\back\api\test_jobs.py.

@cristian-tamblay cristian-tamblay added the blocked Waiting for another PR to be merged label Apr 26, 2024
Copy link

Fix Queue Test Bug

Copy link

Parallel Jobs

@Riul1999 Riul1999 added back Backend work refactor Prune and embelish code and removed blocked Waiting for another PR to be merged labels May 7, 2024
@Riul1999 Riul1999 added the enhancement New feature or request label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back Backend work enhancement New feature or request refactor Prune and embelish code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants