【问题标题】:Github Actions stays stuck on a task and finally fail on timeout [closed]Github Actions 停留在一个任务上,最后超时失败 [关闭]
【发布时间】:2021-07-21 14:14:39
【问题描述】:

对于ruptures python 包,我们使用 Github Actions 对每个应该合并到master 的 PR 运行测试。到目前为止,它工作得很好。但是几天以来,这个 Gh Actions 一直卡住,最终在超时(360 分钟)时失败。

请查找here 特定运行中的症状示例。

请找到 here 执行测试的 Gh Actions 代码。它在几个 python 版本和操作系统上有一个strategy matrix

name: Run tests

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    strategy:
      matrix:
        python-version: [3.6, 3.7, 3.8, 3.9]
        os: [ubuntu-latest, windows-latest, macos-latest]
        exclude:
          - os: windows-latest
            python-version: 3.9
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v2
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install ruptures
      run: |
        python -m pip install --upgrade pip
        python -m pip install .[test]
    - name: Test with pytest
      run: |
        python -m pytest

据我所知,没有错误,只是卡住了。据我所知,它始终停留在strategy matrix 组合的第一个元素上,即对我们来说它是 python v3.6(这是矩阵可能性中最低的)。但同样,不确定它是否与此相关,因为没有错误,只是超时,没有关于出错的具体消息(除非我没有找到正确的地方)。

由于我认为这可能与 Gh 在 matrix 上的太多组合作业迷路有关,因此我尝试在 strategy 中指定 max-parallel: 2。但它并没有解决任何问题。

出于同样的原因,我尝试从strategy matrix 中删除 python v3.6,以查看 python v3.6 是否是特定问题。但它不能解决任何问题,Gh Actions 只是停留在 Python v3.7 而不是 v3.6 上。请参阅here 以查看运行情况。

测试在本地顺利运行。

我不知道是什么原因导致了这种行为,更何况这个 Gh Actions 过去几个月都可以毫无问题地运行。

【问题讨论】:

  • 仅供参考,我试图通过列出 3 个作业来扁平化操作系统维度上的 matrix。所以matrix 只剩下 python 版本维度了。它没有解决任何问题。请参阅here 了解运行情况。
  • 貌似是pip相关的问题……很奇怪:github.com/deepcharles/ruptures/runs/…
  • 升级pip有什么特别的原因吗?你能省略这一步,看看会发生什么吗?
  • 非常感谢@jidicula 的评论。我能够调查并找到一个可行的解决方案!

标签: python github pip github-actions


【解决方案1】:

感谢jidicula,我得以调查并找到解决方案。

底线:

  • 与 Github Actions 无关
  • pip完全相关

解决方案:

不要使用python -m pip install --upgrade pip 升级pip,而是手动将版本设置为上一个工作版本python -m pip install pip==21.0.1。详情:

  • 在我们的特定情况下,升级 pip 将提供 v21.1 版本
  • pip 允许 Gh Actions 顺利运行的最后一个版本是v21.0.1。所以我现在手动将pip 设置为这个特定值

说明:

新的 (v21.1) pip 版本似乎存在问题

failing Gh Actions中,有如下消息:

Processing /home/runner/work/ruptures/ruptures
  DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behaviour before it becomes the default.
   pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555.

然而,一旦pip 升级到v21.1,添加或不添加--use-feature=in-tree-build 并没有解决任何问题,pip 只是卡住了。

也与--use-feature=in-tree-build 的使用有关,我在pip repo 上发现了this 问题。这最后一期有一个评论建议做

python setup.py bdist_wheel
pip install dist/*.whl

而不是pip install .,这在我们的特定情况下不是一个好的解决方案,因为我们正在利用指定[options.extras_require] 的可能性,例如python -m pip install .[test]。但这可能对您有所帮助!

最后,有关pip 中潜在错误的更多详细信息,请查找here 将几个相关行为分组的问题。

【讨论】:

    猜你喜欢
    • 2020-12-19
    • 2021-08-18
    • 1970-01-01
    • 1970-01-01
    • 2021-10-12
    • 2020-09-25
    • 2020-01-14
    • 2022-06-12
    • 2022-07-10
    相关资源
    最近更新 更多