Skip to content

Commit

Permalink
Merge pull request #3 from evertoncastro/version003
Browse files Browse the repository at this point in the history
Update documentation
  • Loading branch information
evertoncastro committed Aug 6, 2022
2 parents 6c5c38d + 6225b79 commit 75dd8aa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
20 changes: 4 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Async Cloud Tasks
## Use Cloud Tasks to defer function execution in your web applications :honey_pot:
## Use Cloud Tasks to easily defer functions executions in your web applications 🍯

### Inspired by [django-cloud-tasks](https://github.com/GeorgeLubaretsi/django-cloud-tasks), thanks to GeorgeLubaretsi 👏🏻👏🏻👏🏻

Expand Down Expand Up @@ -73,8 +73,8 @@ urlpatterns = [
Simply import the task decorator and define the task inside ``cloud_tasks.py`` in your app.
First parameter should always be ``request`` which is populated after task is executed by Cloud Task service.

You can get actual request coming from Cloud Task service by accessing ``request.request`` in your task body and
additional attributes such as: ``request.task_id```, ```request.request_headers```
You can get actual request coming from Cloud Task service by accessing `request.request` in your task body and
additional attributes such as: `request.task_id`, `request.request_headers`

```python
# cloud_tasks.py
Expand All @@ -95,19 +95,7 @@ from my_app.cloud_tasks import example_task
example_task(p1='1', p2='2').defer()
```

Pushing remote task to the queue (when task handler is defined elsewhere):

```python
from async_cloud_tasks import remote_task
from async_cloud_tasks import batch_execute

example_task = remote_task(queue='my-queue', handler='remote_app.cloud_tasks.example_task'):
payload_1 = example_task(payload={'p1': 1, 'p2': '2'})
payload_1.defer()
```


It is also possible to run an actual function using ``run`` method of ``CloudTaskWrapper`` object instance that is returned after task is called (this can be useful for debugging):
It is also possible to run an actual function using `run` method of `CloudTaskWrapper` object instance that is returned after task is called (this can be useful for debugging):

```python
task = example_task(p1=i, p2=i)
Expand Down
2 changes: 1 addition & 1 deletion async_cloud_tasks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.utils.module_loading import autodiscover_modules
from .base import remote_task

__version__ = '0.0.2'
__version__ = '0.0.3'


def autodiscover():
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ packages = ["async_cloud_tasks"]

[project]
name = "async-cloud-tasks"
version = "0.0.2"
description = "Use Cloud Tasks to defer function execution (forked from github.com/GeorgeLubaretsi/django-cloud-tasks)"
version = "0.0.3"
description = "Use Cloud Tasks to easily defer functions executions"
readme = "README.md"
authors = [{ name = "Everton Castro", email = "evertoncastro.sp@gmail.com" }]
license = { file = "LICENSE" }
Expand Down

0 comments on commit 75dd8aa

Please sign in to comment.