예제 #1
0
def execute_remote(fun, *args, **kwargs):
    """Execute arbitrary function/object remotely.

    :param fun: A callable function or object.
    :param \*args: Positional arguments to apply to the function.
    :param \*\*kwargs: Keyword arguments to apply to the function.

    The object must be picklable, so you can't use lambdas or functions
    defined in the REPL (the objects must have an associated module).

    :returns: class:`celery.result.AsyncResult`.

    """
    return ExecuteRemoteTask.delay(pickle.dumps(fun), args, kwargs)
예제 #2
0
파일: __init__.py 프로젝트: jokar/minion
def execute_remote(fun, *args, **kwargs):
    """Execute arbitrary function/object remotely.

    :param fun: A callable function or object.
    :param \*args: Positional arguments to apply to the function.
    :param \*\*kwargs: Keyword arguments to apply to the function.

    The object must be picklable, so you can't use lambdas or functions
    defined in the REPL (the objects must have an associated module).

    :returns class:`celery.result.AsyncResult`:

    """
    return ExecuteRemoteTask.delay(pickle.dumps(fun), args, kwargs)
예제 #3
0
 def test_execute_remote(self):
     self.assertEqual(
         ExecuteRemoteTask.apply(
             args=[pickle.dumps(some_func), [10], {}]).get(), 100)
예제 #4
0
 def test_execute_remote(self):
     self.assertEqual(ExecuteRemoteTask.apply(
                         args=[pickle.dumps(some_func), [10], {}]).get(),
                       100)