pre-commit-ci / issues

public issues for https://pre-commit.ci
16 stars 3 forks source link

Job stuck in queue #181

Closed dan-blanchard closed 1 year ago

dan-blanchard commented 1 year ago

My team and I were planning on switching to using pre-commit.ci, but I've noticed that sometimes jobs just get stuck in the queue, and the main selling point of switching to pre-commit.ci is that it's faster than our previous approach using GitHub actions. There also doesn't seem to be any way to force a stuck job to re-run.

Also, up until about a minute ago, the time the job was queued was not updating in the UI (and it kept saying it had only been 4 minutes, and not over 19 minutes).

Here's an example of such a job: https://results.pre-commit.ci/run/github/523425790/1683054324.24Fx3_qRQgmGlcHQul4PRQ

asottile commented 1 year ago

hmmm I was just looking into this because it caused a page -- would you be able to share some of your pre-commit configuration? I think it's related to a repository having too many dependencies but I'm not 100% certain

dan-blanchard commented 1 year ago

Sure, here's out our pre-commit config:

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
ci:
  skip: [terraform-fmt, yarn-build-check, yarn-check]

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.4.0
    hooks:
      - id: check-yaml
        args: ["--allow-multiple-documents"]
        exclude: ^helm/cloud/
      - id: check-json
      - id: check-added-large-files
      - id: check-case-conflict
      - id: check-merge-conflict
      - id: detect-aws-credentials
        args: ["--allow-missing-credentials"]

  - repo: https://github.com/charliermarsh/ruff-pre-commit
    # Ruff version.
    rev: "v0.0.263"
    hooks:
      - id: ruff
        args: [--fix, --exit-non-zero-on-fix]

  - repo: https://github.com/psf/black
    rev: 23.3.0
    hooks:
      - id: black
        # It is recommended to specify the latest version of Python
        # supported by your project here, or alternatively use
        # pre-commit's default_language_version, see
        # https://pre-commit.com/#top_level-default_language_version
        language_version: python3.9

  - repo: https://github.com/asottile/blacken-docs
    rev: v1.12.1
    hooks:
      - id: blacken-docs
        additional_dependencies: [black==22.3.0]

  - repo: https://github.com/RobertCraigie/pyright-python
    rev: v1.1.282
    hooks:
      - id: pyright
        additional_dependencies:
          - "acme==2.5.0"
          - "aiobotocore==2.5.0"
          - "aiohttp==3.8.4"
          - "aioitertools==0.11.0"
          - "aiosignal==1.3.1"
          - "altair==4.2.2"
          - "altair-data-server==0.4.1"
          - "altair-saver==0.5.0"
          - "altair-viewer==0.4.0"
          - "amqp==5.1.1"
          - "anyio==3.6.2"
          - "appnope==0.1.3"
          - "argon2-cffi==21.3.0"
          - "argon2-cffi-bindings==21.2.0"
          - "asgiref==3.6.0"
          - "asttokens==2.2.1"
          - "async-generator==1.10"
          - "async-timeout==4.0.2"
          - "asyncstdlib==3.10.6"
          - "attrs==22.2.0"
          - "autobahn==23.1.2"
          - "Automat==22.10.0"
          - "backcall==0.2.0"
          - "backoff==2.2.1"
          - "billiard==3.6.4.0"
          - "black==23.3.0"
          - "boto3==1.26.76"
          - "botocore==1.29.76"
          - "build==0.10.0"
          - "bytecode==0.14.1"
          - "CacheControl==0.12.11"
          - "cachetools==5.3.0"
          - "cattrs==22.2.0"
          - "celery==5.2.7"
          - "certbot==2.5.0"
          - "certbot-dns-route53==2.5.0"
          - "certifi==2022.12.7"
          - "cffi==1.15.1"
          - "cfgv==3.3.1"
          - "channels==3.0.5"
          - "channels-redis==4.1.0"
          - "chardet==5.1.0"
          - "charset-normalizer==3.1.0"
          - "cleo==2.0.1"
          - "click==8.1.3"
          - "click-didyoumean==0.3.0"
          - "click-plugins==1.1.1"
          - "click-repl==0.2.0"
          - "cloudbridge==3.1.0"
          - "cloudpickle==2.2.1"
          - "colored==1.4.4"
          - "comm==0.1.3"
          - "ConfigArgParse==1.5.3"
          - "configobj==5.0.8"
          - "constantly==15.1.0"
          - "coverage==7.2.3"
          - "crashtest==0.4.1"
          - "cryptography==40.0.2"
          - "daphne==3.0.2"
          - "dask==2022.2.0"
          - "datadog-api-client==2.11.0"
          - "ddsketch==2.0.4"
          - "ddtrace==1.11.2"
          - "debugpy==1.6.7"
          - "decorator==5.1.1"
          - "defusedxml==0.7.1"
          - "Deprecated==1.2.13"
          - "deprecation==2.1.0"
          - "deptry==0.8.0"
          - "diff-match-patch==20200713"
          - "distlib==0.3.6"
          - "distributed==2022.2.0"
          - "distro==1.8.0"
          - "dj-rest-auth==3.0.0"
          - "Django==4.1.8"
          - "django-allauth==0.54.0"
          - "django-amazon-ses==4.0.1"
          - "django-axes==5.41.1"
          - "django-cors-headers==3.14.0"
          - "django-debug-toolbar==4.0.0"
          - "django-environ==0.10.0"
          - "django-extensions==3.2.1"
          - "django-filter==23.1"
          - "django-import-export==3.2.0"
          - "django-invitations==2.0.0"
          - "django-ipware==5.0.0"
          - "django-ninja==0.21.0"
          - "django-storages==1.13.2"
          - "django-structlog==5.0.2"
          - "djangorestframework==3.14.0"
          - "dulwich==0.21.3"
          - "entrypoints==0.4"
          - "envier==0.4.0"
          - "et-xmlfile==1.1.0"
          - "exceptiongroup==1.1.1"
          - "execnet==1.9.0"
          - "executing==1.2.0"
          - "fakeredis==2.11.2"
          - "filelock==3.11.0"
          - "freezegun==1.0.0"
          - "frozenlist==1.3.3"
          - "fsspec==2023.4.0"
          - "future==0.18.3"
          - "google-ads==21.0.0"
          - "google-api-core==2.11.0"
          - "google-api-python-client==2.85.0"
          - "google-auth==2.17.3"
          - "google-auth-httplib2==0.1.0"
          - "google-auth-oauthlib==1.0.0"
          - "google-cloud-appengine-logging==1.3.0"
          - "google-cloud-artifact-registry==0.3.3"
          - "google-cloud-audit-log==0.2.5"
          - "google-cloud-bigquery==3.9.0"
          - "google-cloud-compute==1.11.0"
          - "google-cloud-core==2.3.2"
          - "google-cloud-logging==3.5.0"
          - "google-cloud-storage==2.8.0"
          - "google-crc32c==1.5.0"
          - "google-resumable-media==2.4.1"
          - "googleapis-common-protos==1.59.0"
          - "grpc-google-iam-v1==0.12.6"
          - "grpcio==1.53.0"
          - "grpcio-status==1.53.0"
          - "gunicorn==20.1.0"
          - "h11==0.14.0"
          - "HeapDict==1.0.1"
          - "html5lib==1.1"
          - "httplib2==0.22.0"
          - "httptools==0.5.0"
          - "hubspot-api-client==7.5.0"
          - "hupper==1.12"
          - "hyperlink==21.0.0"
          - "identify==2.5.22"
          - "idna==3.4"
          - "importlib-metadata==6.4.0"
          - "incremental==22.10.0"
          - "iniconfig==2.0.0"
          - "installer==0.7.0"
          - "ipykernel==6.22.0"
          - "ipython==8.12.0"
          - "ipywidgets==8.0.6"
          - "jaraco.classes==3.2.3"
          - "jedi==0.18.2"
          - "Jinja2==3.1.2"
          - "jmespath==0.10.0"
          - "josepy==1.13.0"
          - "jsondiff==2.0.0"
          - "jsonschema==4.17.3"
          - "junitparser==2.8.0"
          - "jupyter_client==8.2.0"
          - "jupyter_core==5.3.0"
          - "jupyterlab-widgets==3.0.7"
          - "keyring==23.13.1"
          - "kombu==5.2.4"
          - "libcst==0.4.9"
          - "locket==1.0.0"
          - "lockfile==0.12.2"
          - "lupa==1.14.1"
          - "lz4==4.3.2"
          - "markdown-it-py==2.2.0"
          - "MarkupPy==1.14"
          - "MarkupSafe==2.1.2"
          - "matplotlib-inline==0.1.6"
          - "mdurl==0.1.2"
          - "monotonic==1.6"
          - "more-itertools==9.1.0"
          - "moto==4.1.7"
          - "msgpack==1.0.5"
          - "multidict==6.0.4"
          - "mypy-extensions==1.0.0"
          - "nest-asyncio==1.5.6"
          - "netaddr==0.8.0"
          - "nodeenv==1.7.0"
          - "numpy==1.24.2"
          - "oauthlib==3.2.2"
          - "odfpy==1.4.1"
          - "openpyxl==3.1.2"
          - "opentelemetry-api==1.16.0"
          - "outcome==1.2.0"
          - "packaging==23.1"
          - "pandas==2.0.0"
          - "parsedatetime==2.6"
          - "parso==0.8.3"
          - "partd==1.4.0"
          - "pathspec==0.11.1"
          - "pexpect==4.8.0"
          - "pickleshare==0.7.5"
          - "pkginfo==1.9.6"
          - "platformdirs==2.6.2"
          - "pluggy==1.0.0"
          - "poetry==1.4.2"
          - "poetry-core==1.5.2"
          - "poetry-plugin-export==1.3.0"
          - "portpicker==1.5.2"
          - "pre-commit==3.2.2"
          - "prometheus-client==0.16.0"
          - "prompt-toolkit==3.0.38"
          - "proto-plus==1.22.2"
          - "protobuf==4.22.3"
          - "psutil==5.9.4"
          - "psycopg2-binary==2.9.6"
          - "ptyprocess==0.7.0"
          - "pure-eval==0.2.2"
          - "py==1.11.0"
          - "pyasn1==0.4.8"
          - "pyasn1-modules==0.2.8"
          - "pycparser==2.21"
          - "pydantic==1.10.7"
          - "pyeventsystem==0.1.0"
          - "Pygments==2.15.0"
          - "PyJWT==2.6.0"
          - "pyOpenSSL==23.1.1"
          - "pyparsing==3.0.9"
          - "pyproject_hooks==1.0.0"
          - "pyRFC3339==1.1"
          - "pyrsistent==0.19.3"
          - "PySocks==1.7.1"
          - "pytest==7.3.1"
          - "pytest-asyncio==0.21.0"
          - "pytest-celery==0.0.0"
          - "pytest-cov==4.0.0"
          - "pytest-django==4.5.2"
          - "pytest-env==0.8.1"
          - "pytest-freezegun==0.4.2"
          - "pytest-html==3.2.0"
          - "pytest-httpserver==1.0.6"
          - "pytest-json-report==1.5.0"
          - "pytest-metadata==2.0.4"
          - "pytest-mock==3.10.0"
          - "pytest-shard==0.1.2"
          - "pytest-timeout==2.1.0"
          - "pytest-xdist==3.2.1"
          - "python-dateutil==2.8.2"
          - "python-dotenv==1.0.0"
          - "python3-openid==3.2.0"
          - "pytz==2023.3"
          - "PyYAML==6.0"
          - "pyzmq==25.0.2"
          - "rapidfuzz==2.15.1"
          - "redis==4.5.4"
          - "requests==2.28.2"
          - "requests-mock==1.10.0"
          - "requests-oauthlib==1.3.1"
          - "requests-toolbelt==0.10.1"
          - "responses==0.23.1"
          - "rich==13.3.4"
          - "rsa==4.9"
          - "ruff==0.0.262"
          - "s3transfer==0.6.0"
          - "segment-analytics-python==2.2.2"
          - "selenium==4.8.3"
          - "service-identity==21.1.0"
          - "shellingham==1.5.0.post1"
          - "six==1.16.0"
          - "sniffio==1.3.0"
          - "sortedcontainers==2.4.0"
          - "sqlparse==0.4.4"
          - "stack-data==0.6.2"
          - "stripe==5.4.0"
          - "structlog==23.1.0"
          - "syrupy==4.0.1"
          - "tablib==3.4.0"
          - "tblib==1.7.0"
          - "tenacity==8.2.2"
          - "tomli==2.0.1"
          - "tomlkit==0.11.7"
          - "toolz==0.12.0"
          - "tornado==6.2"
          - "traitlets==5.9.0"
          - "trio==0.22.0"
          - "trio-websocket==0.10.2"
          - "trove-classifiers==2023.3.9"
          - "Twisted==22.10.0"
          - "txaio==23.1.1"
          - "types-PyYAML==6.0.12.9"
          - "typing-inspect==0.8.0"
          - "typing_extensions==4.5.0"
          - "tzdata==2023.3"
          - "uritemplate==4.1.1"
          - "urllib3==1.26.15"
          - "uvicorn==0.22.0"
          - "uvloop==0.17.0"
          - "vine==5.0.0"
          - "virtualenv==20.21.0"
          - "watchfiles==0.19.0"
          - "wcwidth==0.2.6"
          - "webencodings==0.5.1"
          - "websockets==11.0.1"
          - "Werkzeug==2.2.3"
          - "whitenoise==6.4.0"
          - "widgetsnbextension==4.0.7"
          - "wrapt==1.15.0"
          - "wsproto==1.2.0"
          - "xattr==0.10.1"
          - "xlrd==2.0.1"
          - "xlwt==1.3.0"
          - "xmltodict==0.13.0"
          - "yarl==1.8.2"
          - "zict==2.2.0"
          - "zipp==3.15.0"
          - "zope.interface==6.0"
          - "zstd==1.5.5.1"

  - repo: local
    hooks:
      - id: yarn-check
        name: yarn-check
        language: system
        pass_filenames: False
        files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
        types: [file]
        entry: "sh -c 'cd frontend && yarn --mutex file check'"

      - id: yarn-build-check
        name: yarn-build-check
        entry: "sh -c 'cd frontend && yarn --mutex file run build-check'"
        pass_filenames: False
        language: system
        files: ".[tj]sx?$"

  - repo: https://github.com/pre-commit/mirrors-eslint
    rev: "v7.32.0"
    hooks:
      - id: eslint
        additional_dependencies:
          - "@typescript-eslint/eslint-plugin@5.44.0"
          - "@typescript-eslint/parser@5.58.0"
          - eslint@7.32.0
          - eslint-config-prettier@8.8.0
          - eslint-plugin-import@2.22.1
          - eslint-plugin-prefer-arrow@1.2.3
          - eslint-plugin-prettier@4.2.1
          - eslint-plugin-react@7.32.2
          - eslint-plugin-react-hooks@4.6.0
          - prettier@2.2.1
        files: frontend/src/.*\.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
        types: [file]

  - repo: https://github.com/gruntwork-io/pre-commit
    rev: "v0.1.17" # Get the latest from: https://github.com/gruntwork-io/pre-commit/releases
    hooks:
      - id: terraform-fmt
        files: \.tf(vars)?$
asottile commented 1 year ago

ah yep that pyright configuration is going to have too many dependencies -- maybe try with a ci: skip: [pyright] configuration and see if that lets it go through?

dan-blanchard commented 1 year ago

What's the limit on dependencies? I can run that locally fine.

Since pyright is a static type checker, in order for that to work properly it needs to have the same dependencies installed as our local development environments. We previously were using a local repo with a hook that ran it via poetry, but this was the simplest way to reproduce that on pre-commit.ci that I could think of.

Is this just an expected limitation of the hosted service at this time? Is it really only meant for very simple hooks that don't have to do any sort of complex analysis?

asottile commented 1 year ago

pre-commit in general (not just the ci system) is not designed to install your repository under test. things like test runners and full type analysis are better done using a test runner and not as part of git hooks

there's two limits in play here -- one is a size limit (which we enforce mostly to prevent abuse) and the other is a key length limit (which I don't control -- dynamo is angry which is why it's in a crashed state and doesn't have a nice error message)

dan-blanchard commented 1 year ago

FYI, I added pyright to the skip list and it is still stuck queuing for 10 minutes.

asottile commented 1 year ago

ok interesting 🤔 -- I bet it's still trying to make the clone even though it's going to skip building it

dan-blanchard commented 1 year ago

Yeah, once I removed the dependencies entirely it stopped getting stuck

asottile commented 1 year ago

the key length problem should be fixed now -- so in theory pre-commit ci will now support more additional_dependencies -- though no promises on whether installing all of those will fit within the time bounds or the disk space bounds