Skip to content

Commit d0e025f

Browse files
committed
restructure & add intro content
1 parent bd59d56 commit d0e025f

File tree

4 files changed

+265
-232
lines changed

4 files changed

+265
-232
lines changed

docs/assets/visualization.png

71.3 KB
Loading

docs/index.md

Lines changed: 20 additions & 223 deletions
Original file line numberDiff line numberDiff line change
@@ -1,234 +1,31 @@
1-
---
2-
title: Quick Start
3-
---
4-
# Get the Badger working!
1+
# Welcome to Task Badger Documentation
52

6-
Let's discover **Task Badger in less than 5 minutes**.
3+
Task Badger is a specialized monitoring system designed to provide deep visibility into your background jobs and asynchronous tasks. While it doesn't handle task execution itself, Task Badger seamlessly integrates with popular task processing systems like Celery to give developers comprehensive insights into their task operations. With Task Badger, you can track task progress, analyze performance patterns, and debug issues across your distributed task processing infrastructure. Whether you're managing a small set of periodic jobs or orchestrating complex distributed workflows, Task Badger offers the monitoring and observability tools you need to ensure your tasks are running smoothly.
74

8-
## Setup
5+
![Task Badger](assets/visualization.png)
96

10-
In order to use the API you will need the following details:
7+
## Key Features
118

12-
* Organization slug
13-
* You can get this by going to 'My Organization'
14-
* Project slug
15-
* Go to the 'Projects' page. The slug for each project is listed.
16-
* API Key
17-
* Create one on your Profile page
9+
- **Task States**: Track the status of tasks with various states such as `pending`, `in_progress`, `completed`, `error`, and more.
10+
- **Actions and Triggers**: Automate actions based on task events using flexible trigger definitions.
11+
- **Integrations**: Connect with various services like email, webhooks, and more to extend the functionality of Task Badger
12+
- **Monitoring and Alerts**: Stay informed with real-time monitoring and customizable alerts for task events.
1813

14+
## Getting Started
1915

20-
## Montior Celery Tasks
16+
To get started with Task Badger, check out the following sections:
2117

22-
When using the [Celery integration](python-celery.md) you can use the `CelerySystemIntegration` class to automatically record tasks.
18+
- [Quick Start Guide](quick.md): Learn how to set up and start using Task Badger.
19+
- [Task States](data_model.md): Understand the different states a task can be in and how they are managed.
20+
- [Task Actions](data_model.md#task-actions): Discover how to configure actions and triggers to automate your workflows.
21+
- [API Reference](api.md): Explore the API documentation to integrate Task Badger with your applications.
22+
- [Python SDK](python.md): Get started with the Python SDK to interact with Task Badger programmatically.
2323

24-
```python
25-
from celery import Celery
26-
import taskbadger
27-
from taskbadger.systems.celery import CelerySystemIntegration
24+
## Community and Support
2825

29-
app = Celery('hello', broker='amqp://guest@localhost//')
26+
Join our community to get help, share ideas, and stay updated with the latest news:
3027

31-
taskbadger.init(
32-
organization_slug="my-org",
33-
project_slug="my-project",
34-
token="***",
35-
tags={"environment": "production"},
36-
systems=[CelerySystemIntegration(record_task_args=True)]
37-
)
28+
- [GitHub](https://github.com/Task Badger): Report issues, contribute to the project, and browse the source code.
29+
- [Twitter](https://twitter.com/@task_badger): Follow us for updates and announcements.
3830

39-
@app.task
40-
def hello(who):
41-
return f'hello {who}'
42-
```
43-
44-
This is all the configuration that is needed to do basic task tracking with Celery.
45-
46-
## Monitor a task from the command line
47-
48-
The Task Badger CLI allows you to run commands from the shell and have them monitored
49-
by Task Badger. The task status will get updated once the command completes.
50-
51-
### Install and configure the CLI
52-
53-
```bash
54-
$ python3 -m pip install taskbadger
55-
56-
$ taskbadger configure
57-
58-
Organization slug: my-org
59-
Project slug: project-x
60-
API Key: XYZ.ABC
61-
62-
Config written to ~/.config/taskbadger/confi
63-
```
64-
65-
### Use the CLI to run and monitor the command
66-
67-
```shell
68-
$ taskbadger run "demo task" \
69-
--action "error email to:[email protected]" \
70-
--tag "environment=staging" \
71-
-- path/to/script.sh
72-
73-
Task created: https://taskbadger.net/public/tasks/xyz/
74-
```
75-
76-
If the command completes with a non-zero exit code the task status will be set to `error`
77-
and an email will be sent to `[email protected]`.
78-
79-
See more about the [CLI](cli.md).
80-
81-
## Use the API directly
82-
83-
=== "Python"
84-
85-
Install the `taskbadger` Python library:
86-
87-
```shell
88-
$ python3 -m pip install taskbadger
89-
```
90-
91-
Configure the API client:
92-
93-
```python
94-
import taskbadger
95-
96-
taskbadger.init(
97-
organization_slug="my-org",
98-
project_slug="my-project",
99-
token="***",
100-
tags={"environment": "production"},
101-
)
102-
```
103-
104-
=== "Shell"
105-
106-
Export the configuration parameters:
107-
108-
```shell
109-
export ORG="my-org"
110-
export PROJECT="my-project"
111-
export API_KEY="***"
112-
```
113-
114-
### Creating a task
115-
116-
Creating a task is very simple. Make a POST request to the API with the task
117-
data.
118-
119-
=== "Python"
120-
121-
```python
122-
> task = Task.create("task name", stale_timeout=10, tags={"environment": "staging"})
123-
> task.id
124-
"128aoa98e0fiq238"
125-
```
126-
127-
=== "Shell"
128-
129-
```shell
130-
$ curl -X POST "https://taskbadger.net/api/${ORG}/${PROJECT}/tasks/" \
131-
-H "Authorization: Bearer ${API_KEY}" \
132-
-H "Content-Type: application/json" \
133-
-d '{"name": "demo task", "stale_timeout": 10, "tags": {"environment": "staging"}}'
134-
```
135-
136-
The response will include the task ID which is needed for updating the task.
137-
138-
```json title="Response"
139-
{
140-
"id": "{task_id}",
141-
"organization": "my-org",
142-
"project": "my-project",
143-
"name": "demo task",
144-
"status": "pending",
145-
"value": null,
146-
"value_max": null,
147-
"value_percent": null,
148-
"data": null,
149-
"max_runtime": null,
150-
"stale_timeout": 10,
151-
"start_time": null,
152-
"end_time": null,
153-
"created": "2022-09-22T06:53:40.683555Z",
154-
"updated": "2022-09-22T06:53:40.683555Z"
155-
"url": "https://taskbadger.net/a/{example_org/tasks/{task_id}/",
156-
"public_url": "https://taskbadger.net/public/tasks/{task_id}/",
157-
"tags": {"environment": "staging"}
158-
}
159-
```
160-
161-
The task will now be listed in the task list: `https://taskbadger.net/a/${ORG}/tasks/`.
162-
163-
### Update task progress
164-
165-
Here we update the task `status` and `value`. By default, a task's value can range from
166-
0 to 100.
167-
168-
=== "Python"
169-
170-
```python
171-
from taskbadger import StatusEnum
172-
task.update(status=StatusEnum.PROCESSING, value=5)
173-
```
174-
175-
=== "Shell"
176-
177-
```shell
178-
$ curl -X PATCH "https://taskbadger.net/api/${ORG}/${PROJECT}/tasks/${TASK_ID}/" \
179-
-H "Authorization: Bearer ${API_KEY}" \
180-
-H "Content-Type: application/json" \
181-
-d '{"status": "processing", "value": 5}'
182-
```
183-
184-
### Add an action to the task
185-
186-
Here we update create a new action for the task so that we get notified when the task completes.
187-
188-
=== "Python"
189-
190-
```python
191-
from taskbadger import Action, EmailIntegration
192-
task.add_actions([
193-
Action(
194-
"*/10%,success,error",
195-
integration=EmailIntegration(to="[email protected]")
196-
)
197-
])
198-
```
199-
200-
=== "Shell"
201-
202-
```shell
203-
$ curl -X PATCH "https://taskbadger.net/api/${ORG}/${PROJECT}/tasks/${TASK_ID}/" \
204-
-H "Authorization: Bearer ${API_KEY}" \
205-
-H "Content-Type: application/json" \
206-
-d '{"actions":[{"integration":"email","trigger":"success,error","config":{"to":"[email protected]"}}]}'
207-
```
208-
209-
Read more about [actions](data_model.md#task-actions).
210-
211-
### Mark the task complete
212-
213-
When the task is complete update the status to either `success` or `error`.
214-
The value may also be updated to 100.
215-
216-
=== "Python"
217-
218-
```python
219-
task.update(status=StatusEnum.SUCCESS, value=100)
220-
```
221-
222-
=== "Shell"
223-
224-
```shell
225-
$ curl -X PATCH "https://taskbadger.net/api/${ORG}/${PROJECT}/tasks/${TASK_ID}/" \
226-
-H "Authorization: Bearer ${API_KEY}" \
227-
-H "Content-Type: application/json" \
228-
-d '{"status": "success", "value": 100}'
229-
```
230-
Also check your email to see if you got the notification.
231-
232-
## A real example
233-
234-
Take a look at how to apply this to a real [example](web_example.md).
31+
We hope you find Task Badger useful and look forward to your feedback!# Welcome to Task Badger Documentation

0 commit comments

Comments
 (0)