Celery 3.0 Documentationyou can use redis://localhost. You defined a single task, called add, returning the sum of two numbers. Running the Celery worker server You now run the worker by executing our program with the worker y): return x + y @app.task def mul(x, y): return x * y @app.task def xsum(numbers): return sum(numbers) Starting the worker The celery program can be used to start the worker (you need Example setting explicit name: >>> @app.task(name='sum-of-two-numbers') >>> def add(x, y): ... return x + y >>> add.name 'sum-of-two-numbers' A best practice is to use the module name as a name-space0 码力 | 2110 页 | 2.23 MB | 1 年前3
Celery v4.0.0 Documentationyou can use redis://localhost. You defined a single task, called add, returning the sum of two numbers. Running the Celery worker server You now run the worker by executing our program with the worker y): return x + y @app.task def mul(x, y): return x * y @app.task def xsum(numbers): return sum(numbers) Starting the worker The celery program can be used to start the worker (you need Example setting explicit name: >>> @app.task(name='sum-of-two-numbers') >>> def add(x, y): ... return x + y >>> add.name 'sum-of-two-numbers' A best practice is to use the module name as a name-space0 码力 | 2106 页 | 2.23 MB | 1 年前3
Celery 3.1 Documentationcan use redis://localhost. You defined a single task, called add, which returns the sum of two numbers. Running the celery worker server You now run the worker by executing our program with the worker y): return x + y @app.task def mul(x, y): return x * y @app.task def xsum(numbers): return sum(numbers) Starting the worker The celery program can be used to start the worker (you need not provided. For example: >>> @app.task(name='sum-of-two-numbers') >>> def add(x, y): ... return x + y >>> add.name 'sum-of-two-numbers' A best practice is to use the module name as a namespace0 码力 | 887 页 | 1.22 MB | 1 年前3
Celery 3.1 Documentationcan use redis://localhost. You defined a single task, called add, which returns the sum of two numbers. Running the celery worker server You now run the worker by executing our program with the worker add(x, y): return x + y @app.task def mul(x, y): return x * y @app.task def xsum(numbers): return sum(numbers) Starting the worker The celery program can be used to start the worker (you need to not provided. For example: >>> @app.task(name='sum-of-two-numbers') >>> def add(x, y): ... return x + y >>> add.name 'sum-of-two-numbers' A best practice is to use the module name as a namespace, this0 码力 | 607 页 | 2.27 MB | 1 年前3
Celery 1.0 Documentation1.1.2 Example You probably want to see some code by now, so here’s an example task adding two numbers: from celery.decorators import task @task def add(x, y): return x + y You can execute the task Celery 1.3.1 Creating a simple task In this example we are creating a simple task that adds two numbers. Tasks are defined in a normal python module. The module can be named whatever you like, but the pickled, you can’t use custom classes defined in the shell session. This is a task that adds two numbers: from celery.decorators import task @task() def add(x, y): return x + y To execute this task,0 码力 | 123 页 | 400.69 KB | 1 年前3
Celery v5.0.1 Documentationyou can use redis://localhost. You defined a single task, called add, returning the sum of two numbers. Running the Celery worker server You can now run the worker by executing our program with the y): return x + y @app.task def mul(x, y): return x * y @app.task def xsum(numbers): return sum(numbers) Starting the worker The celery program can be used to start the worker (you need Example setting explicit name: >>> @app.task(name='sum-of-two-numbers') >>> def add(x, y): ... return x + y >>> add.name 'sum-of-two-numbers' A best practice is to use the module name as a name-space0 码力 | 2313 页 | 2.13 MB | 1 年前3
Celery v5.0.2 Documentationyou can use redis://localhost. You defined a single task, called add, returning the sum of two numbers. Running the Celery worker server You can now run the worker by executing our program with the y): return x + y @app.task def mul(x, y): return x * y @app.task def xsum(numbers): return sum(numbers) Starting the worker The celery program can be used to start the worker (you need Example setting explicit name: >>> @app.task(name='sum-of-two-numbers') >>> def add(x, y): ... return x + y >>> add.name 'sum-of-two-numbers' A best practice is to use the module name as a name-space0 码力 | 2313 页 | 2.14 MB | 1 年前3
Celery v5.0.5 Documentationyou can use redis://localhost. You defined a single task, called add, returning the sum of two numbers. Running the Celery worker server You can now run the worker by executing our program with the y): return x + y @app.task def mul(x, y): return x * y @app.task def xsum(numbers): return sum(numbers) Starting the worker The celery program can be used to start the worker (you need Example setting explicit name: >>> @app.task(name='sum-of-two-numbers') >>> def add(x, y): ... return x + y >>> add.name 'sum-of-two-numbers' A best practice is to use the module name as a name-space0 码力 | 2315 页 | 2.14 MB | 1 年前3
Celery v5.0.0 Documentationyou can use redis://localhost. You defined a single task, called add, returning the sum of two numbers. Running the Celery worker server You can now run the worker by executing our program with the y): return x + y @app.task def mul(x, y): return x * y @app.task def xsum(numbers): return sum(numbers) Starting the worker The celery program can be used to start the worker (you need Example setting explicit name: >>> @app.task(name='sum-of-two-numbers') >>> def add(x, y): ... return x + y >>> add.name 'sum-of-two-numbers' A best practice is to use the module name as a name-space0 码力 | 2309 页 | 2.13 MB | 1 年前3
Celery 1.0 Documentation“tombstone”). Example You probably want to see some code by now, so here’s an example task adding two numbers: from celery.decorators import task @task def add(x, y): return x + y You can execute the with Celery Creating a simple task In this example we are creating a simple task that adds two numbers. Tasks are defined in a normal python module. The module can be named whatever you like, but the pickled, you can’t use custom classes defined in the shell session. This is a task that adds two numbers: from celery.decorators import task @task() def add(x, y): return x + y To execute this task0 码力 | 221 页 | 283.64 KB | 1 年前3
共 51 条
- 1
- 2
- 3
- 4
- 5
- 6













