Spaces:
Runtime error
Runtime error
fix pagination
Browse files- README.md +2 -2
- RELEASE.md +6 -0
- requirements.txt +2 -1
- src/gradio_space_ci/__init__.py +1 -1
- src/gradio_space_ci/webhook.py +12 -13
README.md
CHANGED
@@ -46,7 +46,7 @@ The goal is to foster community contributions by making the review process as le
|
|
46 |
|
47 |
```py
|
48 |
# requirements.txt
|
49 |
-
gradio-space-ci @ git+https://huggingface.co/spaces/Wauplin/[email protected].
|
50 |
```
|
51 |
|
52 |
2. Set `HF_TOKEN` as a Space secret.
|
@@ -105,7 +105,7 @@ Add the following line to it:
|
|
105 |
|
106 |
```bash
|
107 |
# requirements.txt
|
108 |
-
gradio-space-ci @ git+https://huggingface.co/spaces/Wauplin/[email protected].
|
109 |
```
|
110 |
|
111 |
### 2. Add a user token as `HF_TOKEN` secret
|
|
|
46 |
|
47 |
```py
|
48 |
# requirements.txt
|
49 |
+
gradio-space-ci @ git+https://huggingface.co/spaces/Wauplin/[email protected].1
|
50 |
```
|
51 |
|
52 |
2. Set `HF_TOKEN` as a Space secret.
|
|
|
105 |
|
106 |
```bash
|
107 |
# requirements.txt
|
108 |
+
gradio-space-ci @ git+https://huggingface.co/spaces/Wauplin/[email protected].1
|
109 |
```
|
110 |
|
111 |
### 2. Add a user token as `HF_TOKEN` secret
|
RELEASE.md
CHANGED
@@ -1,3 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
## 0.2.0
|
2 |
|
3 |
- Move `gradio_space_ci` configuration to README.md metadata. Simplify integration (single `enable_space_ci` call).
|
|
|
1 |
+
## 0.2.1
|
2 |
+
|
3 |
+
- Install `huggingface_hub` dependency from source (commit [`7c74445903fe86f694ce6e42c386b7bebee94008`](https://github.com/huggingface/huggingface_hub/commit/7c74445903fe86f694ce6e42c386b7bebee94008)) in order to fix pagination when listing discussions from a repo. See [Pull Request #1962)(https://github.com/huggingface/huggingface_hub/pull/1962). Let's not forget to switch back to installing from PyPi once huggingface_hub `0.21.x` is released.
|
4 |
+
- Run recovery in the background to avoid interrupting the main thread.
|
5 |
+
- In recovery, loop only through pull requests instead of listing all discussions.
|
6 |
+
|
7 |
## 0.2.0
|
8 |
|
9 |
- Move `gradio_space_ci` configuration to README.md metadata. Simplify integration (single `enable_space_ci` call).
|
requirements.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
gradio
|
2 |
-
huggingface_hub>=0.
|
|
|
3 |
gradio-space-ci@git+https://huggingface.co/spaces/Wauplin/gradio-space-ci
|
|
|
1 |
gradio
|
2 |
+
# TODO: switch to huggingface_hub>=0.21.0 once released
|
3 |
+
huggingface_hub@git+https://github.com/huggingface/huggingface_hub@7c74445903fe86f694ce6e42c386b7bebee94008
|
4 |
gradio-space-ci@git+https://huggingface.co/spaces/Wauplin/gradio-space-ci
|
src/gradio_space_ci/__init__.py
CHANGED
@@ -38,4 +38,4 @@ else:
|
|
38 |
from .webhook import enable_space_ci # noqa: F401
|
39 |
|
40 |
|
41 |
-
__version__ = "0.2.
|
|
|
38 |
from .webhook import enable_space_ci # noqa: F401
|
39 |
|
40 |
|
41 |
+
__version__ = "0.2.1"
|
src/gradio_space_ci/webhook.py
CHANGED
@@ -197,19 +197,18 @@ background_pool = ThreadPoolExecutor(max_workers=1)
|
|
197 |
|
198 |
def recover_after_restart(space_id: str) -> None:
|
199 |
print("Looping through PRs to check if any needs to be synced.")
|
200 |
-
for discussion in get_repo_discussions(repo_id=space_id, repo_type="space"):
|
201 |
-
if discussion.
|
202 |
-
if discussion.
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
background_pool.submit(delete_ci_space, space_id=space_id, pr_num=discussion.num)
|
213 |
|
214 |
|
215 |
###
|
|
|
197 |
|
198 |
def recover_after_restart(space_id: str) -> None:
|
199 |
print("Looping through PRs to check if any needs to be synced.")
|
200 |
+
for discussion in get_repo_discussions(repo_id=space_id, repo_type="space", discussion_type="pull_request"):
|
201 |
+
if discussion.status == "open":
|
202 |
+
if not is_pr_synced(space_id=space_id, pr_num=discussion.num):
|
203 |
+
# Found a PR that is not yet synced
|
204 |
+
print(f"Recovery. Found an open PR that is not synced: {discussion.url}. Syncing it.")
|
205 |
+
background_pool.submit(sync_ci_space, space_id=space_id, pr_num=discussion.num)
|
206 |
+
if discussion.status == "merged" or discussion.status == "closed":
|
207 |
+
ci_space_id = _get_ci_space_id(space_id=space_id, pr_num=discussion.num)
|
208 |
+
if repo_exists(repo_id=ci_space_id, repo_type="space"):
|
209 |
+
# Found a PR for which the CI space has not been deleted
|
210 |
+
print(f"Recovery. Found a closed PR with an active CI space: {discussion.url}. Deleting it.")
|
211 |
+
background_pool.submit(delete_ci_space, space_id=space_id, pr_num=discussion.num)
|
|
|
212 |
|
213 |
|
214 |
###
|