Change in osmo-gsm-tester[master]: process: Make sure sync process is terminated if ogt is stopped

2018-10-26 Thread Pau Espin Pedrol
Pau Espin Pedrol has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11459 )

Change subject: process: Make sure sync process is terminated if ogt is stopped
..

process: Make sure sync process is terminated if ogt is stopped

Change-Id: Iecdac96ea576a312be2a6c6b6799e249074687ef
---
M src/osmo_gsm_tester/process.py
1 file changed, 13 insertions(+), 12 deletions(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_gsm_tester/process.py b/src/osmo_gsm_tester/process.py
index 534cdba..fb5c6f6 100644
--- a/src/osmo_gsm_tester/process.py
+++ b/src/osmo_gsm_tester/process.py
@@ -236,25 +236,26 @@
  ' '.join(self.popen_args))]
 self.dbg(self.popen_args, dir=self.run_dir, conf=self.popen_kwargs)

+def run_proc_sync(proc):
+try:
+proc.launch()
+proc.wait()
+except Exception as e:
+proc.terminate()
+raise e
+if proc.result != 0:
+log.ctx(proc)
+raise log.Error('Exited in error')

 def run_local_sync(run_dir, name, popen_args):
 run_dir =run_dir.new_dir(name)
 proc = Process(name, run_dir, popen_args)
-proc.launch()
-proc.wait()
-if proc.result != 0:
-log.ctx(proc)
-raise log.Error('Exited in error')
+run_proc_sync(proc)

 def run_remote_sync(run_dir, remote_user, remote_addr, name, popen_args, 
remote_cwd=None):
 run_dir = run_dir.new_dir(name)
-proc = RemoteProcess(name, run_dir, remote_user, remote_addr, remote_cwd,
- popen_args)
-proc.launch()
-proc.wait()
-if proc.result != 0:
-log.ctx(proc)
-raise log.Error('Exited in error')
+proc = RemoteProcess(name, run_dir, remote_user, remote_addr, remote_cwd, 
popen_args)
+run_proc_sync(proc)

 def scp(run_dir, remote_user, remote_addr, name, local_path, remote_path):
 run_local_sync(run_dir, name, ('scp', '-r', local_path, '%s@%s:%s' % 
(remote_user, remote_addr, remote_path)))

--
To view, visit https://gerrit.osmocom.org/11459
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iecdac96ea576a312be2a6c6b6799e249074687ef
Gerrit-Change-Number: 11459
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 


Change in osmo-gsm-tester[master]: process: Make sure sync process is terminated if ogt is stopped

2018-10-26 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/11459 )

Change subject: process: Make sure sync process is terminated if ogt is stopped
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/11459
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iecdac96ea576a312be2a6c6b6799e249074687ef
Gerrit-Change-Number: 11459
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Fri, 26 Oct 2018 10:24:57 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-gsm-tester[master]: process: Make sure sync process is terminated if ogt is stopped

2018-10-25 Thread Pau Espin Pedrol
Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/11459


Change subject: process: Make sure sync process is terminated if ogt is stopped
..

process: Make sure sync process is terminated if ogt is stopped

Change-Id: Iecdac96ea576a312be2a6c6b6799e249074687ef
---
M src/osmo_gsm_tester/process.py
1 file changed, 13 insertions(+), 12 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester 
refs/changes/59/11459/1

diff --git a/src/osmo_gsm_tester/process.py b/src/osmo_gsm_tester/process.py
index 534cdba..fb5c6f6 100644
--- a/src/osmo_gsm_tester/process.py
+++ b/src/osmo_gsm_tester/process.py
@@ -236,25 +236,26 @@
  ' '.join(self.popen_args))]
 self.dbg(self.popen_args, dir=self.run_dir, conf=self.popen_kwargs)

+def run_proc_sync(proc):
+try:
+proc.launch()
+proc.wait()
+except Exception as e:
+proc.terminate()
+raise e
+if proc.result != 0:
+log.ctx(proc)
+raise log.Error('Exited in error')

 def run_local_sync(run_dir, name, popen_args):
 run_dir =run_dir.new_dir(name)
 proc = Process(name, run_dir, popen_args)
-proc.launch()
-proc.wait()
-if proc.result != 0:
-log.ctx(proc)
-raise log.Error('Exited in error')
+run_proc_sync(proc)

 def run_remote_sync(run_dir, remote_user, remote_addr, name, popen_args, 
remote_cwd=None):
 run_dir = run_dir.new_dir(name)
-proc = RemoteProcess(name, run_dir, remote_user, remote_addr, remote_cwd,
- popen_args)
-proc.launch()
-proc.wait()
-if proc.result != 0:
-log.ctx(proc)
-raise log.Error('Exited in error')
+proc = RemoteProcess(name, run_dir, remote_user, remote_addr, remote_cwd, 
popen_args)
+run_proc_sync(proc)

 def scp(run_dir, remote_user, remote_addr, name, local_path, remote_path):
 run_local_sync(run_dir, name, ('scp', '-r', local_path, '%s@%s:%s' % 
(remote_user, remote_addr, remote_path)))

--
To view, visit https://gerrit.osmocom.org/11459
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iecdac96ea576a312be2a6c6b6799e249074687ef
Gerrit-Change-Number: 11459
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol