Skip to content

Commit

Permalink
Release v0.6.4
Browse files Browse the repository at this point in the history
# Release Notes

- Fix attachment sending via Telegram interfaces (81673b5)
- Fix PollingTelegramInterface dropping whenever an error occurred while responding (ec19921)
- Fix `Pipeline._run_pipeline` failing when `ctx_id=None` (5c22cc7)
- Docker improvements (#279)
- Various tutorial improvements
- Add release checklist
  • Loading branch information
RLKRo authored Dec 11, 2023
2 parents faccc40 + 8bfe13b commit d388322
Show file tree
Hide file tree
Showing 18 changed files with 204 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

- [ ] I have performed a self-review of the changes

*List here tasks to do in order to complete this PR.*
*List here tasks to complete in order to mark this PR as ready for review.*

# To Consider

Expand Down
81 changes: 81 additions & 0 deletions .github/process_github_events.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# flake8: noqa
import os
import json
import requests

GITHUB_ARGS = {
"GITHUB_TOKEN": None,
"GITHUB_REPOSITORY": None,
"GITHUB_EVENT_PATH": None,
"GITHUB_EVENT_NAME": None,
}

for arg in GITHUB_ARGS:
GITHUB_ARGS[arg] = os.getenv(arg)

if GITHUB_ARGS[arg] is None:
raise RuntimeError(f"`{arg}` is not set")


def post_comment_on_pr(comment: str, pr_number: int):
"""
Leave a comment as `github-actions` bot on a PR.
"""
headers = {
"Accept": "application/vnd.github+json",
"Authorization": f'Bearer {GITHUB_ARGS["GITHUB_TOKEN"]}',
"X-GitHub-Api-Version": "2022-11-28",
}

escaped_comment = comment.replace("\n", "\\n")

data = f'{{"body": "{escaped_comment}","event": "COMMENT","comments": []}}'

response = requests.post(
f'https://api.github.com/repos/{GITHUB_ARGS["GITHUB_REPOSITORY"]}/pulls/{pr_number}/reviews',
headers=headers,
data=data,
)

if not response.status_code == 200:
raise RuntimeError(response.__dict__)


RELEASE_CHECKLIST = """It appears this PR is a release PR (change its base from `master` if that is not the case).
Here's a release checklist:
- [ ] Update package version
- [ ] Change PR merge option
- [ ] Test modules without automated testing:
- [ ] Requiring telegram `api_id` and `api_hash`
- [ ] Requiring `HF_API_KEY`
- [ ] Search for objects to be deprecated
"""


def post_release_checklist(pr_payload: dict):
pr_number = pr_payload["number"]
pr_base = pr_payload["base"]

if pr_base["ref"] == "master":
print("post_release_checklist")
post_comment_on_pr(RELEASE_CHECKLIST, pr_number)


def on_opened_pull_request(event_info: dict):
print("on_opened_pull_request")

post_release_checklist(event_info["pull_request"])


def main():
with open(GITHUB_ARGS["GITHUB_EVENT_PATH"], "r", encoding="utf-8") as fd:
event_info = json.load(fd)
print(f"event info: {event_info}")
if GITHUB_ARGS["GITHUB_EVENT_NAME"] == "pull_request_target" and event_info["action"] == "opened":
on_opened_pull_request(event_info)


if __name__ == "__main__":
main()
28 changes: 28 additions & 0 deletions .github/workflows/event_handler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on:
pull_request_target:
types: [ opened ]

jobs:
event_handler:
strategy:
fail-fast: false

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: set up python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: install dependencies
run: python -m pip install requests
shell: bash

- name: handle event
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python .github/process_github_events.py
shell: bash
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ To execute all tests, including integration with DBs and APIs tests, run
```bash
make test_all
```
for successful execution of this command `Docker` and `docker-compose` are required.
for successful execution of this command `Docker` and `docker compose` are required.

To make sure that the code satisfies only the style requirements, run
```bash
Expand All @@ -127,22 +127,22 @@ DFF uses docker images for two purposes:
The first group can be launched via

```bash
docker-compose --profile context_storage up
docker compose --profile context_storage up
```

This will download and run all the databases (`mysql`, `postgres`, `redis`, `mongo`, `ydb`).

The second group can be launched via

```bash
docker-compose --profile stats up
docker compose --profile stats up
```

This will download and launch Superset Dashboard, Clickhouse, OpenTelemetry Collector.

To launch both groups run
```bash
docker-compose --profile context_storage --profile stats up
docker compose --profile context_storage --profile stats up
```
or
```bash
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pip install dff[benchmark] # dependencies for benchmarking
For example, if you are going to use one of the database backends,
you can specify the corresponding requirements yourself. Multiple dependencies can be installed at once, e.g.
```bash
pip install dff[postgresql, mysql]
pip install dff[postgresql,mysql]
```

## Basic example
Expand Down
52 changes: 47 additions & 5 deletions docker-compose.yml → compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "3.9"
services:

mysql:
env_file: [.env_file]
image: mysql:latest
Expand All @@ -10,6 +11,13 @@ services:
- 3307:3306
volumes:
- mysql-data:/var/lib/mysql
healthcheck:
test: mysql -u $${MYSQL_USERNAME} -p$${MYSQL_PASSWORD} -e "select 1;"
interval: 5s
timeout: 10s
retries: 5
start_period: 30s

psql:
env_file: [.env_file]
image: postgres:latest
Expand All @@ -20,6 +28,13 @@ services:
- 5432:5432
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: psql pg_isready -U $${POSTGRES_USERNAME} -d $${POSTGRES_DB}
interval: 5s
timeout: 10s
retries: 5
start_period: 30s

redis:
env_file: [.env_file]
image: redis:latest
Expand All @@ -31,6 +46,13 @@ services:
- 6379:6379
volumes:
- redis-data:/data
healthcheck:
test: redis-cli --raw incr ping
interval: 5s
timeout: 10s
retries: 5
start_period: 30s

mongo:
env_file: [.env_file]
image: mongo:latest
Expand All @@ -41,6 +63,13 @@ services:
- 27017:27017
volumes:
- mongo-data:/data/db
healthcheck:
test: mongosh --norc --quiet --eval 'db.runCommand("ping").ok' localhost:27017/test
interval: 5s
timeout: 10s
retries: 5
start_period: 30s

ydb:
env_file: [.env_file]
image: cr.yandex/yc/yandex-docker-local-ydb:latest
Expand All @@ -55,6 +84,13 @@ services:
volumes:
- ydb-data:/ydb_data
- ydb-certs:/ydb_certs
healthcheck:
test: sh ./health_check
interval: 5s
timeout: 10s
retries: 5
start_period: 30s

dashboard:
env_file: [.env_file]
build:
Expand All @@ -70,6 +106,7 @@ services:
- stats
ports:
- "8088:8088"

dashboard-metadata:
env_file: [.env_file]
image: postgres:latest
Expand All @@ -83,11 +120,13 @@ services:
command: -p 5433
healthcheck:
test: pg_isready -p 5433 --username=$${POSTGRES_USERNAME}
interval: 4s
timeout: 3s
retries: 3
interval: 5s
timeout: 10s
retries: 5
start_period: 30s
volumes:
- dashboard-data:/var/lib/postgresql/data

clickhouse:
env_file: [.env_file]
image: clickhouse/clickhouse-server:latest
Expand All @@ -101,10 +140,12 @@ services:
volumes:
- ch-data:/var/lib/clickhouse/
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:8123/ping || exit 1
test: wget --no-verbose --tries=1 --spider http://localhost:8123/ping
interval: 5s
timeout: 4s
timeout: 10s
retries: 5
start_period: 30s

otelcol:
image: otel/opentelemetry-collector-contrib:latest
profiles:
Expand All @@ -121,6 +162,7 @@ services:
ports:
- "4317:4317" # OTLP over gRPC receiver
- "4318:4318" # OTLP over HTTP receiver

volumes:
ch-data:
dashboard-data:
Expand Down
2 changes: 1 addition & 1 deletion dff/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

__author__ = "Denis Kuznetsov"
__email__ = "[email protected]"
__version__ = "0.6.3"
__version__ = "0.6.4"


import nest_asyncio
Expand Down
Loading

0 comments on commit d388322

Please sign in to comment.