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

Return for remote commander #581

Merged

Conversation

Andrei-Stepanov
Copy link
Contributor

No description provided.

Remote script can return to his caller any Python value.

Signed-off-by: Andrei Stepanov <astepano@redhat.com>
    Protect SSH link between master & runner from messages built in
    libs.

Signed-off-by: Andrei Stepanov <astepano@redhat.com>
@@ -26,6 +26,13 @@
import messenger as ms


logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
handler = logging.FileHandler("/tmp/remote_runner.log", "w", encoding=None,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about get temp log file like below:
tempfile.mktemp(suffix='.log', prefix='remote_runner', dir=data_dir.get_tmp_dir()),
so that your log will not be overwrite.

@Andrei-Stepanov
Copy link
Contributor Author

@xutian : cannot use data_dir module in remote_runner as it is copied to remote VM. And it runs in its own, doesn't knowing anything about Avocado.

  • I updated to use tempfile.mktemp

Signed-off-by: Andrei Stepanov <astepano@redhat.com>
@xutian
Copy link

xutian commented Jul 12, 2016

thanks your explain, update looks good to me. thanks @Andrei-Stepanov

@Andrei-Stepanov
Copy link
Contributor Author

May I ask what are rules for acceptance of pull-requests?
This pull request is almost month old.
Who is responsible to accept pull requests?
Inconvenience about using your own repo for running tests is very upsetting.

fd_stdout = sys.stdout.fileno() # == 1
fd_stderr = sys.stderr.fileno() # == 2
orig_stdout = os.dup(fd_stdout) # Original stdout to master.
orig_stderr = os.dup(fd_stderr) # Original srderr to master.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems this orig_stderr not used
I'm not familiar with remote runner, so just check this patch code here, no more comment from me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.
All SSH encoded base64 traffic goes through stdout.
Executed program/script has modified stdout/stderr.
stderr/stdout from remote_runner are endcoded and passed through original SSH stdout.
So.. in general stdout from SSH encapsulates stdout/stderr from program.
What you have pointed is not a bug. We can safely remove this variable. But...
I am sure that this code is a bit "tricky", so I just left this variable to represent what is really going here.
I can remove it. But it is safe to keep it for demonstrativeness. Do you want me to remove this variable ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yest, it's really a tricky point, keep it is fine.

@PandaWei
Copy link
Member

In fact, I have read your PR a few weeks ago.
No found any problem.
But you know It's not enough to just use my eyes to examine the code, unless it's a trivial fix.

Only VM.commander and VM.remote_commander will use remote_runner.py.
It's used not quite often and I didn't find any existing case to verify your codes.
That's why I didn't reply to you. and leave this PR to someone else who is more familiar with remote runner.

so if you can provide some test result or validation method to us next time, maybe you will get quick response.

@@ -726,7 +741,7 @@ def python_file_run_with_helper(self, test_path):
assert hasattr(module, "run")
run = getattr(module, "run")
helper = Helper(self)
run(helper)
return run(helper)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return code is OK,
ACK commit 983d589

@xutian
Copy link

xutian commented Jul 21, 2016

This PR got two ACK, so merged it. thanks @Andrei-Stepanov , @PandaWei

@xutian xutian closed this Jul 21, 2016
@xutian xutian reopened this Jul 21, 2016
@xutian xutian merged commit 431f540 into avocado-framework:master Jul 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants