Commit 83016a90 authored by Matias Guijarro's avatar Matias Guijarro
Browse files

Merge branch '1017-create-session-does-not-tell-on-which-beacon' into 'master'

Resolve "create session does not tell on which beacon"

Closes #1017

See merge request !3735
parents acc11b86 701cd836
Pipeline #47218 failed with stages
in 105 minutes and 55 seconds
...@@ -176,6 +176,9 @@ class Connection: ...@@ -176,6 +176,9 @@ class Connection:
# Beacon connection # Beacon connection
self._host = host self._host = host
self._port = port self._port = port
# self._port_number is here to keep trace of port number
# as self._port can be replaced by unix socket name.
self._port_number = port
self._socket = None self._socket = None
self._connect_lock = gevent.lock.Semaphore() self._connect_lock = gevent.lock.Semaphore()
self._connected = gevent.event.Event() self._connected = gevent.event.Event()
......
...@@ -126,7 +126,11 @@ def create_session(session_name): ...@@ -126,7 +126,11 @@ def create_session(session_name):
This method is valid even if config directory is located on This method is valid even if config directory is located on
a remote computer. a remote computer.
""" """
print(("Creating '%s' BLISS session" % session_name)) beacon = client.get_default_connection()
print(
f"Creating '{session_name}' BLISS session on"
f"BEACON_HOST={beacon._host}:{beacon._port_number}"
)
config = static.get_config() config = static.get_config()
config.set_config_db_file("sessions/__init__.yml", "plugin: session\n") config.set_config_db_file("sessions/__init__.yml", "plugin: session\n")
...@@ -179,26 +183,26 @@ def main(): ...@@ -179,26 +183,26 @@ def main():
# Display session names and trees # Display session names and trees
if arguments["--show-sessions"]: if arguments["--show-sessions"]:
print_sessions_and_trees(get_sessions_list()) print_sessions_and_trees(get_sessions_list())
exit(0) sys.exit(0)
# Display session names only # Display session names only
if arguments["--show-sessions-only"]: if arguments["--show-sessions-only"]:
print_sessions_list(get_sessions_list()) print_sessions_list(get_sessions_list())
exit(0) sys.exit(0)
# Create session # Create session
if arguments["--create"]: if arguments["--create"]:
session_name = arguments["--create"] session_name = arguments["--create"]
if session_name in get_sessions_list(): if session_name in get_sessions_list():
print(("Session '%s' cannot be created: it already exists." % session_name)) print(("Session '%s' cannot be created: it already exists." % session_name))
exit(0) sys.exit(0)
elif session_name[0].isdigit(): elif session_name[0].isdigit():
print(f"Invalid session name ({session_name}). Must start with [a-zA-Z_]") print(f"Invalid session name ({session_name}). Must start with [a-zA-Z_]")
exit(0) sys.exit(0)
else: else:
create_session(session_name) create_session(session_name)
# exit ( or launch new session ? ) # exit ( or launch new session ? )
exit(0) sys.exit(0)
# Delete session # Delete session
if arguments["--delete"]: if arguments["--delete"]:
...@@ -206,7 +210,7 @@ def main(): ...@@ -206,7 +210,7 @@ def main():
if session_name in get_sessions_list(): if session_name in get_sessions_list():
if yes_or_no("Do you want to delete '%s' session?" % session_name): if yes_or_no("Do you want to delete '%s' session?" % session_name):
delete_session(session_name) delete_session(session_name)
exit(0) sys.exit(0)
else: else:
print( print(
( (
...@@ -214,7 +218,7 @@ def main(): ...@@ -214,7 +218,7 @@ def main():
% session_name % session_name
) )
) )
exit(0) sys.exit(0)
# check beacon connection # check beacon connection
static.get_config() static.get_config()
...@@ -225,7 +229,7 @@ def main(): ...@@ -225,7 +229,7 @@ def main():
if session_name not in get_sessions_list(): if session_name not in get_sessions_list():
print(("'%s' does not seem to be a valid session, exiting." % session_name)) print(("'%s' does not seem to be a valid session, exiting." % session_name))
print_sessions_list(get_sessions_list()) print_sessions_list(get_sessions_list())
exit(0) sys.exit(0)
else: else:
session_name = None session_name = None
......
...@@ -222,7 +222,7 @@ A skeleton of BLISS session can be created automatically with the `-c` option: ...@@ -222,7 +222,7 @@ A skeleton of BLISS session can be created automatically with the `-c` option:
example for a session named `demo_session` example for a session named `demo_session`
``` ```
(bliss) pcsht:~ % bliss -c demo_session (bliss) pcsht:~ % bliss -c demo_session
Creating 'demo_session' BLISS session Creating 'demo_session' BLISS session on BEACON_HOST=epilobe:25000
Creating sessions/demo_session.yml Creating sessions/demo_session.yml
Creating sessions/demo_session_setup.py Creating sessions/demo_session_setup.py
Creating sessions/scripts/demo_session.py Creating sessions/scripts/demo_session.py
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment