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

hide('running') on the task level is broken #424

Open
svenXY opened this issue Aug 25, 2011 · 9 comments
Open

hide('running') on the task level is broken #424

svenXY opened this issue Aug 25, 2011 · 9 comments
Labels

Comments

@svenXY
Copy link

@svenXY svenXY commented Aug 25, 2011

  1. it does not hide stuff like 'executing task...'
  2. it removes newlines from the last output, thus joining the next line of output

fabfile is:
@task
def show_hostname():
with settings(hide('running')):
run('hostname')
run('date')

% /opt/python-2.7/bin/fab -f output.py -H x1,x2 show_hostname
[x1] Executing task 'show_hostname'
[x1] out: x1mydomain.de
[x1] out: [x1] out: Thu Aug 25 10:34:10 CEST 2011
[x1] out: [x2] Executing task 'show_hostname'
[x2] out: x2.mydomain.de
[x2] out: [x2] out: Thu Aug 25 10:34:11 CEST 2011
[x2] out:
Done.

and while we are at it:

  1. run('hostname') for example always outputs an empty line like so:

[h1] Executing task 'show_hostname'
[h1] out: h1.mydomain.de
[h1] out:

is 3) by purpose and are 1,2 problems coming from that empty line?

Thanks,
Sven

@gregglind
Copy link

@gregglind gregglind commented Aug 29, 2011

if you look at fabric.main:main, you'll see the 'executing' happens outside the task, which is why it's not hidden, by the hide. As a work around (global!) you can set fabric.state.output['running'] = False, or pass in --hide=running.

@ghost ghost assigned bitprophet Aug 30, 2011
@bitprophet
Copy link
Member

@bitprophet bitprophet commented Aug 30, 2011

Gregg is right re: executing -- it needs to be a global setting due to when the "Executing" lines are printed -- though I acknowledge that it's not terrifically intuitive and wish there was a better way around it. (I can think of one way to do it for new-style tasks, but not sure it's worth increasing the differences in behavior between the two types, at the moment...)

Newlines at the end of stdout blocks are on purpose, IIRC, though I can't recall if we are explicitly inserting them or if it's actually from the remote end (and is just triggering a new line prefix.) But I don't think it's a bug per se.

The "missing" newlines may be related -- I'd have to double check. May be a situation where it was going to look ugly one way or another and we had to shift the ugliness to the less common case.

@charlax
Copy link

@charlax charlax commented Sep 3, 2012

Is there any update on this bug/UI inconsistency? I'm trying to tail a file via fabric, and it'd be great to mask those "[hostname]" output.

I tried fabric.state.output['running'] = False, nothing change.

@bitprophet
Copy link
Member

@bitprophet bitprophet commented Sep 8, 2012

@charlax You can use fab --hide=running and that will flip that output level off from the very start of the run, so it should hide all the 'running task x' stuff that is not hideable from inside tasks themselves. Not sure why I didn't mention this in the earlier comment.

You should also be able to make that fabric.state.output change you mentioned, at module (top) level in your fabfile -- where exactly did you put it when you tried? If it's inside a task it still won't work.

@charlax
Copy link

@charlax charlax commented Sep 11, 2012

Oh right, actually what I'm trying to do is hide the [host.com] out: part, sorry for the misunderstanding.

@bitprophet
Copy link
Member

@bitprophet bitprophet commented Sep 11, 2012

Meaning just that part of the line? There is a private config setting for that, but I don't see that changing before fab 2.0 comes out, so I'll let you in on the secret: it's env.output_prefix, set it to False and it will just print literal stdout/stderr with no line prefixes.

@charlax
Copy link

@charlax charlax commented Sep 12, 2012

Thanks!

@jpgeek
Copy link

@jpgeek jpgeek commented Oct 26, 2015

Seems like the @hosts() decorator should make it possible to hide the 'host' part of the running output without forcing disabling of

fabric.state.output['running']

globally . This would allow overriding the env.hosts for a single method which is what it is meant to do. It seems that it should behave as the env.hosts in that setting it to an empty iterator (or None) should trigger the local_only execution which would not print the host. Currently, an empty iterator in @hosts is ignored and it falls back to using env.hosts. If it will get pulled I will write a patch.

@petri
Copy link

@petri petri commented Nov 20, 2015

  • how to also hide the "Done." printed after completion?
  • how to also hide the "Disconnecting from my.server.com... done."?

It would be useful if I could just disable ALL (really literally all) output except what I explicitly print out, except when there's a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants