Skip to content

Job command is truncated and unreadable sometimes. #2727

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

Closed
lisimia opened this issue Feb 11, 2016 · 10 comments
Closed

Job command is truncated and unreadable sometimes. #2727

lisimia opened this issue Feb 11, 2016 · 10 comments

Comments

@lisimia
Copy link

lisimia commented Feb 11, 2016

Issue #1119
and
6db82c1#diff-2496498d8489caaa1554877d00271179R654

forced a maximum length on my jobs.

i run about 10~20 jobs regularly, all over 200 characters long, the first 30 characters, and last 30 characters are always the same

its a bit weird i know.

but i would like to add an environment flag that truncate_command checks for in which if set, will NOT truncate the command.

I view this as a regression because it broke existing behaviour, with no way to go back. I'm willing to put in the code if someone can point me in the right direction

@faho
Copy link
Member

faho commented Feb 11, 2016

I'm willing to put in the code if someone can point me in the right direction

The code seems visible in that diff - "truncate_command" in proc.cpp.

Though I'd like it if it wouldn't use an additional environment variable. I'd prefer if it filled $COLUMNS, if there has to be any truncation. @ridiculousfish: Remember why you added the truncation?

@ridiculousfish
Copy link
Member

I added the truncation because status message could be unreasonably long, especially the "has ended" or "terminated by signal" messages. The command could be so long that the status change itself would be lost.

@lisimia what is the context where you want to see longer messages? Is it for these signal status messages?

@lisimia
Copy link
Author

lisimia commented Feb 11, 2016

Job 3, “python Tasks/my_magical_script.py arg1 ar.…” has ended

is what is see when i run a job in the background and it finishes

what was actually ran:
python Tasks/my_magical_script.py arg1 arg2 arg3 arg4 some_unique_hash_that_i_typed_in >> /dev/null ^^&1 &

i want to see the full command of what job finished.

maybe we can provide a custom implementation (function) for truncate_command like how we can define the function for fish_prompt

@ridiculousfish

@lisimia lisimia changed the title Job command is truncated and unusable sometimes. Job command is truncated and unreadable sometimes. Feb 11, 2016
@ridiculousfish
Copy link
Member

Thanks for answering my question. What do you do with that information? Do you cross-reference that hash with something else? Or do you want to, say, copy and paste the whole command to run it again?

What I'm trying to ascertain is whether there's some smarter truncation or labelling or other behavior that would make this better for everyone, and wouldn't involve introducing new configuration. I suspect you don't actually want to see the whole command, but rather uniquely identifying part of it? But I could be wrong.

Maybe when multiple jobs have the same prefix, the truncation could start at the point that's different.

@lisimia
Copy link
Author

lisimia commented Feb 11, 2016

yes that's the issue, i have up to 20 jobs that have the same starting prefix,
when a job finishes, i would like the see exactly which one finished


one problem i predict in your proposed solution, the last running command (of the 20), would appear like it is the only command thus only print the prefix and not the important part of the command (some arbitrary part in the middle)


printing the ending won't work either because in this case it'll only print ' /dev/null ^^&1 &' has finished

@oranja
Copy link

oranja commented Feb 14, 2016

@ridiculousfish
I get the feeling that different users will have different reasons and requirements here.
bash doesn't do any truncating, and as much as no one here wants bash to be the role model, I think that this is the only possible solution that satisfies everyone without configuration.

To overcome the original problem,

The command could be so long that the status change itself would be lost.

I'd suggest to separate the status from the command.
bash does it with a long space (tab?). In fish I'd prefer a newline between the status and the command, since the status description is longer and more informative in fish.

@ridiculousfish
Copy link
Member

bash puts the status before the command - that's kind of clever in fact.

@lisimia
Copy link
Author

lisimia commented Feb 14, 2016

it would sound like just a rewritten format string in: 6db82c1#diff-2496498d8489caaa1554877d00271179R694 and to not use the truncate_command function
should be enough? should I get started?

@ridiculousfish
Copy link
Member

Sure, go for it.

@soumya92
Copy link
Contributor

With #6959, this is customizable at the user level, without needing to change code in fish-shell.

For the specific use-case mentioned in this bug, you can choose exactly how to truncate the command (so, e.g. skip the first 20 characters, or truncate from the end rather than the beginning, or even grep for your hash...), by copying and then altering the fish_job_summary function to your local configuration.

@lisimia lisimia closed this as completed May 20, 2020
@zanchey zanchey modified the milestones: fish-future, fish 3.2.0 May 20, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants