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

[DRAFT] Stage Labeling #5207

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions conda_build/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ def build(
"other arguments (config) by keyword."
)

# NOTE: Should be moved as part of sanitization, Argparse?
recipes = []
for recipe in ensure_list(recipe_paths_or_metadata):
if isinstance(recipe, str):
Expand Down
15 changes: 15 additions & 0 deletions conda_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3656,6 +3656,7 @@ def check_external():
)


# TODO: build_tree ==> Workflow orchetrator needs to be moved out of build
def build_tree(
recipe_list, config, stats, build_only=False, post=None, notest=False, variants=None
):
Expand Down Expand Up @@ -3694,6 +3695,9 @@ def build_tree(
try:
recipe = recipe_list.popleft()
name = recipe.name() if hasattr(recipe, "name") else recipe

# recipe == MetaData i.e. rendered recipe
# TODO: Move to the post render stage or enviroments stage
if hasattr(recipe, "config"):
metadata = recipe
cfg = metadata.config
Expand Down Expand Up @@ -3748,7 +3752,9 @@ def build_tree(
# This is the "TOP LEVEL" loop. Only vars used in the top-level
# recipe are looped over here.

# NOTE: This smells like RENDER STAGE to me
for metadata, need_source_download, need_reparse_in_env in metadata_tuples:
# Maybe the needs_reparse is how the run_exports stuff works
get_all_replacements(metadata.config.variant)
if post is None:
utils.rm_rf(metadata.config.host_prefix)
Expand All @@ -3759,6 +3765,7 @@ def build_tree(
metadata.name(), metadata.version(), reset=True
)

# RENDER?, ENVIROMENT, FETCH, COMPILE, PACKAGE, INDEX STAGE in build function
packages_from_this = build(
metadata,
stats,
Expand All @@ -3768,6 +3775,7 @@ def build_tree(
built_packages=built_packages,
notest=notest,
)
# if is TEST STAGE
if not notest:
for pkg, dict_and_meta in packages_from_this.items():
if pkg.endswith(CONDA_PACKAGE_EXTENSIONS) and os.path.isfile(
Expand Down Expand Up @@ -3844,6 +3852,8 @@ def build_tree(
package_subset=[dep],
require_files=True,
)

# TEST STAGE
# test that package, using the local channel so that our new
# upstream dep gets used
test(
Expand All @@ -3856,6 +3866,7 @@ def build_tree(
else:
built_packages.update(packages_from_this)

# CLEANUP STAGE
if os.path.exists(metadata.config.work_dir) and not (
metadata.config.dirty
or metadata.config.keep_old_work
Expand Down Expand Up @@ -3886,6 +3897,8 @@ def build_tree(
# os.unlink(os.path.join(metadata.config.work_dir, 'metadata_conda_debug.yaml'))

except DependencyNeedsBuildingError as e:
# This is the universal orchestration error handling process.
# The intention is to handle interdependencies it the multi output
skip_names = ["python", "r", "r-base", "mro-base", "perl", "lua"]
built_package_paths = [entry[1][1].path for entry in built_packages.items()]
add_recipes = []
Expand Down Expand Up @@ -3973,6 +3986,7 @@ def build_tree(
retried_recipes.append(os.path.basename(name))
recipe_list.extendleft(add_recipes)

# CLEANUP STAGE which upload is a part of
tarballs = [f for f in built_packages if f.endswith(CONDA_PACKAGE_EXTENSIONS)]
if post in [True, None]:
# TODO: could probably use a better check for pkg type than this...
Expand All @@ -3990,6 +4004,7 @@ def build_tree(
print(json.dumps(hash_inputs, sort_keys=True, indent=2))
print("\n")

# ALso part of Cleanup
total_time = time.time() - initial_time
max_memory_used = max([step.get("rss") for step in stats.values()] or [0])
total_disk = sum([step.get("disk") for step in stats.values()] or [0])
Expand Down
1 change: 1 addition & 0 deletions conda_build/cli/main_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def parse_args(args: Sequence[str] | None) -> tuple[ArgumentParser, Namespace]:
help="""Only run the build, without any post processing or
testing. Implies --no-test and --no-anaconda-upload.""",
)
# TODO: Understand what post does
parser.add_argument(
"-p",
"--post",
Expand Down
2 changes: 1 addition & 1 deletion conda_build/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ def expand_globs(path_list, root_dir):
return files


def find_recipe(path):
def find_recipe(path) -> os.PathLike:
"""recurse through a folder, locating valid meta files (see VALID_METAS). Raises error if more than one is found.

Returns full path to meta file to be built.
Expand Down
Loading