I'm currently having issues related to ordering of...
# general
b
I'm currently having issues related to ordering of target execution. I have the following configurations in support/allen-srl-deps/BUILD:
Copy code
docker_environment(
    name="python38_builder",
    image="localhost/python38-builder-image:latest",
    platform="linux_x86_64"
)

shell_command(
    name="build_deps",
    command="build-deps",
    environment="python38_builder",
    tools = [ "sh", "echo" ]
)

files(
    name="allennlp_wheels",
    sources=["**/*.whl"],
    dependencies=[":build_deps"]
)

archive(
    name="do_archive",
    format="tar.gz",
    files=[":allennlp_wheels"]
)
With the following defined in the pants.toml
Copy code
[GLOBAL]
pants_version = "2.16.0"
pants_workdir = "%(buildroot)s/build/.pants.d"
pants_subprocessdir= "%(buildroot)s/build/.pids"
local_store_dir = "%(buildroot)s/build/lmdb_store"
named_caches_dir = "%(buildroot)s/build/named_caches"
backend_packages = [
    "pants.backend.shell",
    "pants.backend.docker"
]

[source]
root_patterns = [
    "/support/*"
]

[python]
interpreter_constraints = [ "==3.8.*" ]

[environments-preview.names]
python38_builder = "//support/allen-srl-deps:python38_builder"

[anonymous-telemetry]
enabled = false
When I run
pants package support/allen-srl-deps :
The
archive
target runs before the
build_deps
target (which never gets run). Can someone help me understand why this would be occurring? Any help would be appreciated
e
Order is expressed via dependencies. For dependencies that can't be inferred, you need to write those down in BUILD metadata. The
shell_command
target has
execution_dependencies
in the one direction (force things to happen before it because it needs them) and
output_directories
/
output_files
in the other direction (force things to depend on it running to produce files they use), etc. See: https://www.pantsbuild.org/docs/reference-shell_command
But more broadly, dependencies are your only tool to influence execution order with Pants. It relies on those to know what needs to happen before what else and what it can parallelize, etc. It's all data dependencies or bust.