MCPcopy
hub / github.com/WebODM/WebODM / run_function_async

Function run_function_async

app/plugins/worker.py:7–16  ·  view source on GitHub ↗

Run a function asynchronously using Celery. Plugins should use this function so that they don't have to register new Celery tasks at startup. Functions should import any required library at the top of the function body. :param {Function} a function to execute

(func, *args, **kwargs)

Source from the content-addressed store, hash-verified

5task = app.task
6
7def run_function_async(func, *args, **kwargs):
8 """
9 Run a function asynchronously using Celery.
10 Plugins should use this function so that they don't
11 have to register new Celery tasks at startup. Functions
12 should import any required library at the top of the function body.
13 :param {Function} a function to execute
14 """
15 source = inspect.getsource(func)
16 return eval_async.delay(source, func.__name__, *args, **kwargs)
17
18
19@app.task(bind=True, time_limit=settings.WORKERS_MAX_TIME_LIMIT)

Callers 6

postMethod · 0.90
postMethod · 0.90
postMethod · 0.90
postMethod · 0.90
postMethod · 0.90
postMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected