Deep-sea commited on
Commit
c7a4046
·
verified ·
1 Parent(s): 7764486

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -4
Dockerfile CHANGED
@@ -8,8 +8,8 @@ RUN apk update && \
8
  apk add python3 py3-pip git && \
9
  pip3 install --break-system-packages --upgrade pip
10
 
11
- # 安装 Python 包
12
- RUN pip3 install --break-system-packages watchdog huggingface_hub aiohttp
13
 
14
  # 预创建 Gitea 所需目录并设置权限
15
  RUN mkdir -p /data/gitea/conf /data/gitea/log /data/gitea/git /data/git /data/ssh && \
@@ -165,7 +165,8 @@ class DataDirectoryHandler(FileSystemEventHandler):
165
  current_time = time.time()
166
  if current_time - self.last_commit_time > self.commit_delay:
167
  self.last_commit_time = current_time
168
- asyncio.run(self.commit_changes(change_type))
 
169
 
170
  async def commit_changes(self, change_type):
171
  """异步提交变更到 Hugging Face Hub,带重试机制"""
@@ -182,7 +183,7 @@ class DataDirectoryHandler(FileSystemEventHandler):
182
  repo_id=self.repo_id,
183
  repo_type="dataset",
184
  commit_message=commit_message,
185
- ignore_patterns=["*.tmp", "*.log", "*.temp", ".git/*"]
186
  )
187
  logger.info(f"✅ 成功提交变更到 Hugging Face Hub: {commit_message}")
188
  return
 
8
  apk add python3 py3-pip git && \
9
  pip3 install --break-system-packages --upgrade pip
10
 
11
+ # 安装 Python 包,包括 pytz
12
+ RUN pip3 install --break-system-packages watchdog huggingface_hub aiohttp pytz
13
 
14
  # 预创建 Gitea 所需目录并设置权限
15
  RUN mkdir -p /data/gitea/conf /data/gitea/log /data/gitea/git /data/git /data/ssh && \
 
165
  current_time = time.time()
166
  if current_time - self.last_commit_time > self.commit_delay:
167
  self.last_commit_time = current_time
168
+ # 使用 asyncio.create_task 异步调度提交
169
+ asyncio.create_task(self.commit_changes(change_type))
170
 
171
  async def commit_changes(self, change_type):
172
  """异步提交变更到 Hugging Face Hub,带重试机制"""
 
183
  repo_id=self.repo_id,
184
  repo_type="dataset",
185
  commit_message=commit_message,
186
+ ignore_patterns=["*.tmp", "*._workers", "*.log", "*.temp", ".git/*"]
187
  )
188
  logger.info(f"✅ 成功提交变更到 Hugging Face Hub: {commit_message}")
189
  return