refactor: clean up download target state representation
Download targets now store only 'download: <url>' in the state file
instead of using 'prompt' and 'model: __download__' as a workaround.
Also use exclude_defaults=True when serializing state to omit empty
fields like input_hashes: {} and extra_params: {}.
This commit is contained in:
parent
24cade558a
commit
612ea0ae9d
2 changed files with 53 additions and 41 deletions
|
|
@ -252,9 +252,6 @@ def _should_skip_failed_dep(
|
|||
return any(d in result.failed for d in _collect_all_deps(target_name, config))
|
||||
|
||||
|
||||
_DOWNLOAD_MODEL_SENTINEL = "__download__"
|
||||
|
||||
|
||||
def _is_dirty(
|
||||
target_name: str,
|
||||
config: ProjectConfig,
|
||||
|
|
@ -267,10 +264,7 @@ def _is_dirty(
|
|||
if isinstance(target_cfg, DownloadTargetConfig):
|
||||
return is_target_dirty(
|
||||
target_name,
|
||||
resolved_prompt=target_cfg.download,
|
||||
model=_DOWNLOAD_MODEL_SENTINEL,
|
||||
dep_files=[],
|
||||
extra_params={},
|
||||
download=target_cfg.download,
|
||||
state=state,
|
||||
project_dir=project_dir,
|
||||
)
|
||||
|
|
@ -346,24 +340,27 @@ def _process_outcomes(
|
|||
target_cfg = config.targets[name]
|
||||
|
||||
if isinstance(target_cfg, DownloadTargetConfig):
|
||||
resolved_prompt = target_cfg.download
|
||||
model_name = _DOWNLOAD_MODEL_SENTINEL
|
||||
record_target_state(
|
||||
name,
|
||||
download=target_cfg.download,
|
||||
state=state,
|
||||
project_dir=project_dir,
|
||||
)
|
||||
else:
|
||||
model_info = resolve_model(name, target_cfg, config.defaults)
|
||||
resolved_prompt = resolve_prompt(target_cfg.prompt, project_dir)
|
||||
model_name = model_info.name
|
||||
dep_files = _collect_dep_files(name, config, project_dir)
|
||||
extra = _collect_extra_params(name, config)
|
||||
|
||||
dep_files = _collect_dep_files(name, config, project_dir)
|
||||
extra = _collect_extra_params(name, config)
|
||||
record_target_state(
|
||||
name,
|
||||
resolved_prompt=resolved_prompt,
|
||||
model=model_info.name,
|
||||
dep_files=dep_files,
|
||||
extra_params=extra,
|
||||
state=state,
|
||||
project_dir=project_dir,
|
||||
)
|
||||
|
||||
record_target_state(
|
||||
name,
|
||||
resolved_prompt=resolved_prompt,
|
||||
model=model_name,
|
||||
dep_files=dep_files,
|
||||
extra_params=extra,
|
||||
state=state,
|
||||
project_dir=project_dir,
|
||||
)
|
||||
result.built.append(name)
|
||||
on_progress(BuildEvent.TARGET_OK, name, "")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue