Skip to content

Commit 1e94b6f

Browse files
committed
Add --no-broker to verdi presto (aiidateam#7284)
Allow creating profiles without any message broker configured. This is useful for profiles used only for data exploration and querying, where the daemon and process submission are not needed.
1 parent 28eda58 commit 1e94b6f

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

docs/source/reference/command_line.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,10 @@ Below is a list with all available subcommands.
352352
command automatically tries RabbitMQ first and falls
353353
back to ZMQ if unavailable. To switch to RabbitMQ later,
354354
use `verdi profile configure-rabbitmq`.
355+
--no-broker When toggled on, no message broker is configured. This
356+
means the daemon cannot be started and processes cannot
357+
be submitted. Useful for profiles used only for data
358+
exploration and querying.
355359
--postgres-hostname TEXT The hostname of the PostgreSQL server.
356360
--postgres-port INTEGER The port of the PostgreSQL server.
357361
--postgres-username TEXT The username of the PostgreSQL user that is authorized

src/aiida/cmdline/commands/cmd_presto.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ def detect_postgres_config(
133133
'automatically with the daemon. When not specified, the command automatically tries RabbitMQ first and falls back '
134134
'to ZMQ if unavailable. To switch to RabbitMQ later, use `verdi profile configure-rabbitmq`.',
135135
)
136+
@click.option(
137+
'--no-broker',
138+
is_flag=True,
139+
help='When toggled on, no message broker is configured. This means the daemon cannot be started and processes '
140+
'cannot be submitted. Useful for profiles used only for data exploration and querying.',
141+
)
136142
@click.option('--postgres-hostname', type=str, default='localhost', help='The hostname of the PostgreSQL server.')
137143
@click.option('--postgres-port', type=int, default=5432, help='The port of the PostgreSQL server.')
138144
@click.option(
@@ -155,6 +161,7 @@ def verdi_presto(
155161
email,
156162
use_postgres,
157163
use_zmq,
164+
no_broker,
158165
postgres_hostname,
159166
postgres_port,
160167
postgres_username,
@@ -222,7 +229,11 @@ def verdi_presto(
222229
else:
223230
echo.echo_report('Option `--use-postgres` not enabled: configuring the profile to use SQLite.')
224231

225-
if use_zmq:
232+
if no_broker:
233+
echo.echo_report('`--no-broker` enabled: configuring the profile without a broker.')
234+
broker_backend = None
235+
broker_config = None
236+
elif use_zmq:
226237
echo.echo_report('`--use-zmq` enabled: configuring the profile with ZMQ broker.')
227238
broker_backend = 'core.zmq'
228239
broker_config = {}
@@ -231,6 +242,10 @@ def verdi_presto(
231242
broker_config = detect_rabbitmq_config()
232243
except ConnectionError:
233244
echo.echo_report('RabbitMQ server not found: falling back to ZMQ broker.')
245+
echo.echo_warning(
246+
'The ZMQ broker is a new feature. If you experience issues, '
247+
'recreate the profile with `verdi presto --no-broker`.'
248+
)
234249
broker_backend = 'core.zmq'
235250
broker_config = {}
236251
else:

0 commit comments

Comments
 (0)