Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Merge pull request #175 from girder/batch-threads
Browse files Browse the repository at this point in the history
Run batch jobs in threads.
  • Loading branch information
manthey authored May 25, 2022
2 parents 318be32 + 3a2f40b commit 048e044
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion slicer_cli_web/rest_slicer_cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import itertools
import json
import threading
import time

import cherrypy
Expand Down Expand Up @@ -203,7 +204,18 @@ def batchCLIJob(cliItem, params, user, cliTitle):
return job


def batchCLITask(job): # noqa C901
def batchCLITask(job):
"""
Run a batch of jobs via a thread.
:param job: the job model.
"""
proc = threading.Thread(target=batchCLITaskProcess, args=(job,), daemon=True)
proc.start()
return job, proc


def batchCLITaskProcess(job): # noqa C901
"""
Run a batch of jobs. The job parameters contain the id of the cli item,
the parameters, including those for batching, and the user id.
Expand Down

0 comments on commit 048e044

Please sign in to comment.