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

Rich add newline to long log message and it cannot be copy and paste directly into terminal #3276

Open
Tracked by #2928
noklam opened this issue Nov 6, 2023 · 4 comments

Comments

@noklam
Copy link
Contributor

noklam commented Nov 6, 2023

Description

    text = ",".join([f"node_{i}" for i in range(100)])
    logger.info(f"A very long log message - {text}")

I started with a pandas-iris starter and add this into one of the node. Copying and paste it into terminal produce this result. This
conflicts with some feature such as resume pipeline (kedro will produce a log suggestion how to recover from a fail pipeline). This is common with medium size project.

image

Context

Steps to Reproduce

Expected Result

Actual Result

-- If you received an error, place it here.
-- Separate them if you have more than one.

Your Environment

  • Kedro version used (pip show kedro or kedro -V):
  • Python version used (python -V):
  • Operating system and version:
@datajoely
Copy link
Contributor

for this sort of error we could use pyperclip which pandas includes to make pd.DataFrame.to_clipboard() possible...

@noklam
Copy link
Contributor Author

noklam commented Nov 6, 2023

Nice! Would rich override this? It would be a great solution if works.

@astrojuanlu
Copy link
Member

I'm not sure it's possible to keep the rich logging while solving this issue. Probably we should push for making rich optional #2928. Voting to close this issue.

@david-stanley-94
Copy link

Relevant code from logging.py for restarting a failed pipeline is:

            self._logger.warning(
                "There are %d nodes that have not run.\n"
                "You can resume the pipeline run from the nearest nodes with "
                "persisted inputs by adding the following "
                "argument to your previous command:\n%s",
                len(remaining_nodes),
                postfix,
            )

Can this not be altered to have a copy-pasteable form of the postfix, which contains the CLI element, printed to terminal using the out method from rich (https://rich.readthedocs.io/en/stable/console.html#low-level-output)? Either (a) as duplicate to follow the current logging call, or (b) as a replacement for removing the postfix from the current logging call?

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

No branches or pull requests

5 participants