Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-output package with pin_subpackage in test requirements fails to build #1142

Open
gabuzi opened this issue Oct 28, 2024 · 2 comments
Open

Comments

@gabuzi
Copy link
Contributor

gabuzi commented Oct 28, 2024

I have a situation where I build a multi output pkg from a monorepo.
Multiple subpackages with dependencies between them are built. "Normal" run dependencies work fine (I use pin_subpackage for this).

However, tests for one subpackage package require another subpackage. Using pin_subpackage for this works fine with conda-build, but rattler-build 0.28.0 doesn't seem to like this.

While we're at it: The situation I have also actually contains a dependency cycle (at test time only), and conda-build handles this. I'm just mentioning it here, because it seems like rattler-build seems to follow an eager testing schedule (test right after build), whereas conda first builds all subpackages, and then tests them. Rattler-build's eager testing behavior would not be compatible with this, unless the test-pins will be considered in the sorting of build steps (which can be a bit challenging given that it is in fact a cycle). With conda-build's build first, test later approach, this is no issue.

Reproducer:

recipe:
  name: subpkg_in_test_cyclic_dep
  version: 1234

source:
  path: .

build:
  number: 0

outputs:
  - package:
      name: subpkg1
    build:
      script:
        - touch file1
        - cp file1 $PREFIX/
    requirements:
      run:
        - ${{ pin_subpackage("subpkg2", exact=True) }}

  - package:
      name: subpkg2
    build:
      script:
        - touch file2
        - cp file2 $PREFIX/
    tests:
      - script:
          -
        requirements:
            run:
              - ${{ pin_subpackage("subpkg1", exact=True) }}  # <-- this causes issues
@wolfv
Copy link
Member

wolfv commented Oct 28, 2024

Thanks! Yes, I was aware of the issues with eager testing and it's something I would like to address soon. I would like to sort packages to still test as early as possible just to make users detect issues early on.

@mgorny
Copy link
Contributor

mgorny commented Dec 25, 2024

I've just had a similar problem, though there are no cycles in my case — just a plain case of:

recipe:
  name: test
  version: 1

outputs:
  - package:
      name: test
  - package:
      name: test-tests
    tests:
      - script:
          - true
        requirements:
          run:
            - ${{ pin_subpackage('test', exact=True) }}

causing:

thread 'main' panicked at src/lib.rs:415:55:
Could not parse MatchSpec: ParseChannelError(InvalidName("{\"pin_subpackage\":{\"name\""))
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: rattler_build::can_test
   4: core::iter::traits::iterator::Iterator::partition
   5: rattler_build::run_build_from_args::{{closure}}
   6: rattler_build::main::{{closure}}
   7: tokio::runtime::park::CachedParkThread::block_on
   8: tokio::runtime::runtime::Runtime::block_on
   9: rattler_build::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

The specific use case is we're splitting torchvision's tests into a subpackage, so they wouldn't multiply the size of the main package. For the time being, I have worked around the problem by specifying the pinned subpackage as a regular run requirement in the *-tests subpackage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants