@@ -36,7 +36,8 @@ def command_create_profile(
3636 first_name : str | None = None ,
3737 last_name : str | None = None ,
3838 institution : str | None = None ,
39- use_rabbitmq : bool = True ,
39+ broker : str = 'rabbitmq' ,
40+ use_rabbitmq : bool | None = None ,
4041 ** kwargs ,
4142):
4243 """Create a new profile, initialise its storage and create a default user.
@@ -51,10 +52,17 @@ def command_create_profile(
5152 :param first_name: First name for the default user.
5253 :param last_name: Last name for the default user.
5354 :param institution: Institution for the default user.
54- :param use_rabbitmq: Whether to configure RabbitMQ as the broker.
55+ :param broker: Message broker backend ('rabbitmq', 'zmq', or 'none').
56+ :param use_rabbitmq: Deprecated. Use ``broker`` instead. If False, equivalent to ``broker='none'``.
5557 :param kwargs: Arguments to initialise instance of the selected storage implementation.
5658 """
57- from aiida .brokers .rabbitmq .defaults import detect_rabbitmq_config
59+ # Handle deprecated --use-rabbitmq/--no-use-rabbitmq option
60+ if use_rabbitmq is not None :
61+ from aiida .common .warnings import warn_deprecation
62+
63+ warn_deprecation ('The `--use-rabbitmq` option is deprecated. Use `--broker` instead.' , version = 3 )
64+ if not use_rabbitmq :
65+ broker = 'none'
5866 from aiida .common import docs
5967 from aiida .plugins .entry_point import get_entry_point_from_class
6068
@@ -70,7 +78,9 @@ def command_create_profile(
7078 broker_backend = None
7179 broker_config = None
7280
73- if use_rabbitmq :
81+ if broker == 'rabbitmq' :
82+ from aiida .brokers .rabbitmq .defaults import detect_rabbitmq_config
83+
7484 try :
7585 broker_config = detect_rabbitmq_config ()
7686 except ConnectionError as exception :
@@ -80,8 +90,15 @@ def command_create_profile(
8090 broker_backend = 'core.rabbitmq'
8191
8292 echo .echo_report ('RabbitMQ can be reconfigured with `verdi profile configure-rabbitmq`.' )
83- else :
84- echo .echo_report ('Creating profile without RabbitMQ.' )
93+
94+ elif broker == 'zmq' :
95+ broker_backend = 'core.zmq'
96+ broker_config = {}
97+ echo .echo_success ('ZMQ broker configured (no external service required).' )
98+ echo .echo_report ('The ZMQ broker service will be started automatically with the daemon.' )
99+
100+ else : # broker == 'none'
101+ echo .echo_report ('Creating profile without a message broker.' )
85102 echo .echo_report ('It can be configured at a later point in time with `verdi profile configure-rabbitmq`.' )
86103 echo .echo_report (f'See { docs .URL_NO_BROKER } for details on the limitations of running without a broker.' )
87104
@@ -124,7 +141,8 @@ def command_create_profile(
124141 setup .SETUP_USER_FIRST_NAME (),
125142 setup .SETUP_USER_LAST_NAME (),
126143 setup .SETUP_USER_INSTITUTION (),
127- setup .SETUP_USE_RABBITMQ (),
144+ setup .SETUP_BROKER_BACKEND (),
145+ setup .SETUP_USE_RABBITMQ (), # Deprecated, for backward compatibility
128146 ],
129147)
130148def profile_setup ():
@@ -161,12 +179,26 @@ def profile_configure_rabbitmq(ctx, /, profile, non_interactive, force, **kwargs
161179 else :
162180 echo .echo_success ('Connected to RabbitMQ with the provided connection parameters' )
163181
182+ from aiida .engine .daemon .client import get_daemon_client
183+
184+ daemon_client = get_daemon_client (profile .name )
185+ daemon_running = daemon_client .is_daemon_running
186+
187+ if daemon_running :
188+ echo .echo_warning ('The daemon is currently running. It will need to be restarted for changes to take effect.' )
189+ click .confirm ('Do you want to apply the configuration and restart the daemon?' , abort = True )
190+
164191 profile .set_process_controller (name = 'core.rabbitmq' , config = broker_config )
165192 ctx .obj .config .update_profile (profile )
166193 ctx .obj .config .store ()
167194
168195 echo .echo_success (f'RabbitMQ configuration for `{ profile .name } ` updated to: { broker_config } ' )
169196
197+ if daemon_running :
198+ echo .echo_report ('Restarting the daemon...' )
199+ daemon_client .restart_daemon ()
200+ echo .echo_success ('Daemon restarted successfully.' )
201+
170202
171203@verdi_profile .command ('list' )
172204def profile_list ():
0 commit comments