Skip to content

Commit

Permalink
fix: debuged yaml and cache problem
Browse files Browse the repository at this point in the history
  • Loading branch information
martins0n committed Dec 15, 2022
1 parent 2a136cd commit 5d9118d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
15 changes: 4 additions & 11 deletions .github/workflows/notebooks.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
name: Test notebooks

# on:
# push:
# branches:
# - master
# pull_request:
# branches:
# - master
# types: [closed]

on:
push:
branches:
- master
pull_request:
types: [opened, synchronize]
branches:
- master
types: [closed]

jobs:

notebooks-test:
# if: github.event_name == 'push'||github.event.pull_request.merged == true
if: github.event_name == 'push'||github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix release docs and docker images cron job ([#982](https://github.com/tinkoff-ai/etna/pull/982))
- Fix forecast first point with CatBoostPerSegmentModel ([#1010](https://github.com/tinkoff-ai/etna/pull/1010))
- Fix hanging EDA notebook ([#1027](https://github.com/tinkoff-ai/etna/pull/1027))
-
- Fix hanging EDA notebook v2 + cache clean script ([#1034](https://github.com/tinkoff-ai/etna/pull/1034))
-
## [1.13.0] - 2022-10-10
### Added
Expand Down
32 changes: 32 additions & 0 deletions scripts/cache_cleaner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import json
import subprocess
from datetime import datetime

from pydantic import BaseModel, parse_obj_as


class GithubCache(BaseModel):
id: int
ref: str
key: str
version: str
last_accessed_at: datetime
created_at: datetime
size_in_bytes: int


OWNER = "tinkoff-ai"
REPO = "etna"
COMMAND_GET_LIST = f'gh api -H "Accept: application/vnd.github+json" /repos/{OWNER}/{REPO}/actions/caches'
COMMAND_DELETE = (
lambda x: f'gh api --method DELETE -H "Accept: application/vnd.github+json" /repos/{OWNER}/{REPO}/actions/caches/{x}'
)

output = subprocess.check_output(COMMAND_GET_LIST, shell=True)

cache_list = parse_obj_as(list[GithubCache], json.loads(output)["actions_caches"])


print("Total caches:", len(cache_list))

list(map(lambda x: subprocess.check_output(COMMAND_DELETE(x.id), shell=True), cache_list))

0 comments on commit 5d9118d

Please sign in to comment.