unified sics_command() with sics_client()
This commit is contained in:
parent
4b9e0e905d
commit
8a9dee244e
2
sea.py
2
sea.py
@ -81,7 +81,7 @@ class SeaManager(ServiceManager):
|
||||
if service != 'sea': # ignore when service == 'graph'
|
||||
return ''
|
||||
try:
|
||||
return sics_command(('localhost', self.info[ins]['sea']), 'samenv name')
|
||||
return sics_client(('localhost', self.info[ins]['sea']), 'samenv name')
|
||||
except Exception as e:
|
||||
print(self.info)
|
||||
return repr(e)
|
||||
|
@ -49,14 +49,11 @@ def sics_coroutine(hostport, login):
|
||||
request = yield '\n'.join(result)
|
||||
|
||||
|
||||
def sics_client(hostport, login='Spy 007'):
|
||||
def sics_client(hostport, command=None, login='Spy 007'):
|
||||
sics = sics_coroutine(hostport, login)
|
||||
next(sics) # start generator
|
||||
return sics
|
||||
|
||||
|
||||
def sics_command(hostport, command, login='Spy 007'):
|
||||
sics = sics_client(hostport, login)
|
||||
if command is None:
|
||||
return sics
|
||||
result = sics.send(command)
|
||||
sics.close()
|
||||
return result
|
||||
|
Loading…
x
Reference in New Issue
Block a user