question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[KED-2336] kedro clean

See original GitHub issue

Description

A command that deletes all intermediate data sets created during a pipeline run, not unlike make clean.

Context

In order to debug pipelines it is often helpful to add intermediate outputs to the data catalog and write them to disk. However, “leftover” intermediate data sets can be a source of bugs when developing pipelines. Suppose you rewired the pipelines and made an error, but it does not show up as pipeline failure because you forgot to delete an old intermediate data set.

Possible Implementation

One could perhaps mark data sets as “intermediate” in the sense of fully managed by pipelines - never modified or replaced except by kedro run. Then kedro clean could automatically delete those.

Possible Alternatives

Manually deleting these datasets from the data folder.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
DmitriiDeriabinQBcommented, Dec 7, 2020

example code to show how this can be done

Sure, first run kedro ipython from your project root, then

from pathlib import Path
from shutil import rmtree

pipeline = context.pipelines["<pipeline_name>"]
intermediate = pipeline.all_outputs() & pipeline.all_inputs() & catalog._data_sets.keys()

for dataset_name in intermediate:
    filepath = Path(catalog._data_sets[dataset_name]._filepath)
    if filepath.is_file():
        filepath.unlink()
    elif filepath.is_dir():
        rmtree(filepath)
0reactions
stale[bot]commented, Apr 12, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[KED-2336] kedro clean · Issue #635 - GitHub
Description A command that deletes all intermediate data sets created during a pipeline run, not unlike make clean.
Read more >
Frequently asked questions — Kedro 0.18.4 documentation
Write cleaner code, so that your Python code is easy to maintain and re-run in future; it does this by applying standardisation and...
Read more >
Kedro IO — Kedro 0.18.4 documentation
Kedro Logo. stable. Introduction. What is Kedro? Learn how to use Kedro · Assumptions ... Run the project · Cleanup · How to...
Read more >
Kedro's command line interface — Kedro 0.17.6 documentation
Kedro's command line interface (CLI) is used to give commands to Kedro via a terminal shell (such as the terminal app on macOS,...
Read more >
Modular pipelines — Kedro 0.18.4 documentation
A modular pipeline is defined by its folder structure. You can generate this file structure with the CLI command kedro pipeline create <pipeline_name>...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found