solidprivacy commited on
Commit
ad58eee
·
1 Parent(s): 82781ee

Remove temporary HF Space runtime probe workflow

Browse files
.github/workflows/hf-space-runtime-probe.yml DELETED
@@ -1,137 +0,0 @@
1
- name: HF Space runtime probe
2
-
3
- on:
4
- workflow_dispatch:
5
- push:
6
- branches:
7
- - main
8
- paths:
9
- - operator_triggers/hf_space_runtime_probe.txt
10
-
11
- permissions:
12
- contents: write
13
-
14
- jobs:
15
- probe:
16
- runs-on: ubuntu-latest
17
- env:
18
- HF_SPACE_ID: solidprivacy/scrub
19
- EVIDENCE_BRANCH: hf-space-runtime-probe-evidence-20260717
20
- steps:
21
- - uses: actions/checkout@v4
22
- with:
23
- ref: main
24
- fetch-depth: 0
25
-
26
- - uses: actions/setup-python@v5
27
- with:
28
- python-version: '3.11'
29
-
30
- - name: Install client
31
- run: python -m pip install --upgrade 'huggingface_hub>=1.1,<2'
32
-
33
- - name: Probe Space runtime and logs
34
- id: probe
35
- continue-on-error: true
36
- env:
37
- HF_TOKEN: ${{ secrets.HF_TOKEN }}
38
- run: |
39
- mkdir -p output/incidents/hf_space_probe_20260717
40
- python - <<'PY'
41
- from __future__ import annotations
42
-
43
- import json
44
- import os
45
- import re
46
- import signal
47
- from datetime import datetime, timezone
48
- from pathlib import Path
49
-
50
- from huggingface_hub import HfApi
51
-
52
- out = Path('output/incidents/hf_space_probe_20260717')
53
- out.mkdir(parents=True, exist_ok=True)
54
- token = os.environ['HF_TOKEN']
55
- repo_id = os.environ['HF_SPACE_ID']
56
- api = HfApi(token=token)
57
- secret_pattern = re.compile(r'hf_[A-Za-z0-9]{8,}')
58
-
59
- def sanitize(value: str) -> str:
60
- return secret_pattern.sub('hf_[REDACTED]', value)
61
-
62
- class TimedOut(Exception):
63
- pass
64
-
65
- def alarm_handler(signum, frame):
66
- raise TimedOut('operation timed out')
67
-
68
- signal.signal(signal.SIGALRM, alarm_handler)
69
-
70
- report = {
71
- 'schema': 'solidprivacy.hf_space_runtime_probe',
72
- 'schema_version': '1.0',
73
- 'space_id': repo_id,
74
- 'captured_at': datetime.now(timezone.utc).isoformat(),
75
- 'secrets_recorded': False,
76
- }
77
-
78
- try:
79
- signal.alarm(45)
80
- runtime = api.get_space_runtime(repo_id=repo_id)
81
- signal.alarm(0)
82
- report['runtime'] = {
83
- 'stage': runtime.stage,
84
- 'hardware': runtime.hardware,
85
- 'requested_hardware': runtime.requested_hardware,
86
- 'sleep_time': runtime.sleep_time,
87
- }
88
- except Exception as exc:
89
- signal.alarm(0)
90
- report['runtime_error'] = sanitize(f'{type(exc).__name__}: {exc}')
91
-
92
- for build, name in [(True, 'build.log'), (False, 'run.log')]:
93
- try:
94
- signal.alarm(60)
95
- lines = list(api.fetch_space_logs(repo_id=repo_id, build=build, follow=False))
96
- signal.alarm(0)
97
- text = sanitize(''.join(lines))
98
- (out / name).write_text(text[-100000:], encoding='utf-8')
99
- report[name] = {'ok': True, 'line_count': len(lines)}
100
- except Exception as exc:
101
- signal.alarm(0)
102
- message = sanitize(f'{type(exc).__name__}: {exc}')
103
- (out / name).write_text(message + '\n', encoding='utf-8')
104
- report[name] = {'ok': False, 'error': message}
105
-
106
- try:
107
- signal.alarm(45)
108
- info = api.space_info(repo_id=repo_id)
109
- signal.alarm(0)
110
- report['space_sha'] = getattr(info, 'sha', None)
111
- report['subdomain'] = getattr(info, 'subdomain', None)
112
- except Exception as exc:
113
- signal.alarm(0)
114
- report['space_info_error'] = sanitize(f'{type(exc).__name__}: {exc}')
115
-
116
- (out / 'report.json').write_text(json.dumps(report, indent=2, sort_keys=True), encoding='utf-8')
117
- print(json.dumps(report, indent=2, sort_keys=True))
118
- PY
119
-
120
- - name: Ensure failure evidence exists
121
- if: always()
122
- run: |
123
- mkdir -p output/incidents/hf_space_probe_20260717
124
- if [ ! -f output/incidents/hf_space_probe_20260717/report.json ]; then
125
- printf '{"schema":"solidprivacy.hf_space_runtime_probe","probe_step_outcome":"%s","report_generation_failed":true}\n' '${{ steps.probe.outcome }}' > output/incidents/hf_space_probe_20260717/report.json
126
- fi
127
-
128
- - name: Publish probe evidence
129
- if: always()
130
- run: |
131
- set -euo pipefail
132
- git config user.name 'solidprivacy-incident-worker'
133
- git config user.email 'actions@users.noreply.github.com'
134
- git checkout -B "$EVIDENCE_BRANCH"
135
- git add output/incidents/hf_space_probe_20260717
136
- git commit -m 'Record HF Space runtime probe evidence' || true
137
- git push --force origin HEAD:"$EVIDENCE_BRANCH"