Skip to content

Commit

Permalink
GITBOOK-152: No subject
Browse files Browse the repository at this point in the history
  • Loading branch information
manast authored and gitbook-bot committed Feb 15, 2023
1 parent 488f943 commit af77b92
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 5 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions docs/gitbook/SUMMARY.md
Expand Up @@ -91,3 +91,7 @@

* [Compatibility class](bull-3.x-migration/compatibility-class.md)
* [Migration](bull-3.x-migration/migration.md)

## Python

* [Introduction](python/introduction.md)
4 changes: 2 additions & 2 deletions docs/gitbook/bull/introduction.md
Expand Up @@ -6,8 +6,8 @@ Bull is the legacy version of BullMQ. As it is still heavily used today, it is a

Bull has been a part of the NodeJS ecosystem for a long time and is used by many organizations both in commercial and open-source projects. A few special mentions:

![](<../.gitbook/assets/Screenshot 2022-02-15 at 11.32.39 (1).png>) ![](../.gitbook/assets/mozilla-logo-bw-rgb.png) ![](../.gitbook/assets/autodesk-logo-white.png) ![](../.gitbook/assets/Atlassian-horizontal-blue-rgb.webp)
![](<../.gitbook/assets/Screenshot 2022-02-15 at 11.32.39 (1).png>) ![](<../.gitbook/assets/mozilla-logo-bw-rgb (2).png>) ![](../.gitbook/assets/autodesk-logo-white.png) ![](<../.gitbook/assets/Atlassian-horizontal-blue-rgb (1).webp>)

![](../.gitbook/assets/midwayjs-logo.png) ![](<../.gitbook/assets/salesforce-logo (1).png>)
![](../.gitbook/assets/midwayjs-logo.png) ![](../.gitbook/assets/salesforce-logo.png)

![](<../.gitbook/assets/entethalliance-logo (1).png>) ![](../.gitbook/assets/kisspng-logo-retail-target-corporation-advertising-5ae5ef43944c89.3404142515250184356074.png)
6 changes: 3 additions & 3 deletions docs/gitbook/guide/jobs/getters.md
Expand Up @@ -2,7 +2,7 @@

When jobs are added to a queue, they will be in different statuses during their lifetime. BullMQ provides methods to retrieve information and jobs from the different statuses.

![Lifecycle of a job](<../../.gitbook/assets/architecture (1).png>)
![Lifecycle of a job](../../.gitbook/assets/complete-architecture.png)

#### Job Counts

Expand Down Expand Up @@ -32,5 +32,5 @@ const completed = await myQueue.getJobs(['completed'], 0, 100, true);

## Read more:

- 💡 [Get Job Counts API Reference](https://api.docs.bullmq.io/classes/Queue.html#getJobCounts)
- 💡 [Get Jobs API Reference](https://api.docs.bullmq.io/classes/Queue.html#getJobs)
* 💡 [Get Job Counts API Reference](https://api.docs.bullmq.io/classes/Queue.html#getJobCounts)
* 💡 [Get Jobs API Reference](https://api.docs.bullmq.io/classes/Queue.html#getJobs)
55 changes: 55 additions & 0 deletions docs/gitbook/python/introduction.md
@@ -0,0 +1,55 @@
---
description: BullMQ is now also available as an experimental python package.
---

# Introduction

{% hint style="info" %}
The Python package is still in early development and is not recommended for production deployment just yet. In the following months, we will be hardening the code and adding more testing and we expect to have a production-ready package although not all the features are available as in the NodeJS version.
{% endhint %}

### Installation

BullMQ is delivered as a pip package and can thus be installed using pip:

```
$ pip install bullmq
```

### Get started

BullMQ uses [asyncio](https://docs.python.org/3/library/asyncio.html) in order to implement concurrency and provide efficient processing of jobs.

You can add jobs to a queue like this, assuming you have a Redis host running locally:

```python
from bullmq import Queue

queue = Queue("myQueue")

# Add a job with data { "foo": "bar" } to the queue
await queue.add("myJob", { "foo": "bar" })

...

# Close when done adding jobs
await queue.close()

```

In order to consume the jobs from the queue you need to use the Worker class, providing a "processor" function that will consume the jobs. As soon as the worker is instantiated it will start consuming jobs:

```python
from bullmq import Worker

async def process(job):
# job.data will include the data added to the queue
return doSomethingAsync(job)

worker = Worker("myQueue", process)

# When no need to process more jobs we should close the worker
await worker.close()

```

0 comments on commit af77b92

Please sign in to comment.