Skip to content

Conversation

@d-perl
Copy link
Contributor

@d-perl d-perl commented Dec 11, 2025

closes #681

To test procedures locally you can start the BEC server with: bec-server start --use-in-process-proc-worker, this will avoid the use of podman.

Introduces a high level interface in the BEC client to manage procedures, with a convenience function to run a loaded macro

Also starts the procedure runner as part of the scan server

You can operate it from bec.proc, e.g.:

default@bec [1/1] ❯❯ st = bec.proc.request_new("sleep", ((),{"time_s":5}))

• default@bec [2/1] ❯❯ st
Out[2]: ProcedureStatus for sleep: Scheduleddefault@bec [3/1] ❯❯ st
Out[3]: ProcedureStatus for sleep: Runningdefault@bec [4/1] ❯❯ st
Out[4]: ProcedureStatus for sleep: Finisheddefault@bec [5/1] ❯❯ st = bec.proc.request_new("doesn't exist")

• default@bec [6/1] ❯❯ st
Out[6]:
ProcedureStatus for doesn't exist: Rejected
ERROR:
Procedure doesn't exist not known to the server. Available: ['log execution message args', 'run scan', 'sleep', 'run_script', 'run_macro']

• default@bec [7/1] ❯❯ st = bec.proc.run_macro("macro_test", 2, 3)

and get a list of available procedures like:

• default@bec [1/1] ❯❯ bec.proc.available_procedures()

Available procedures and their signatures:
------------------------------------------

'log execution message args':
    (*args, **kwargs)

'run scan':
    (scan_name: str, args: tuple, parameters: dict)

'sleep':
    (time_s: float)

'run_script':
    (script_id: str)

'run_macro':
    (macro_name: str, params: tuple[tuple, dict] | None = None)

@d-perl d-perl force-pushed the feat/681_procedure_hli branch 14 times, most recently from a39f75a to eb7e19d Compare December 11, 2025 21:14
@d-perl d-perl force-pushed the feat/681_procedure_hli branch 12 times, most recently from b276fcc to 97b79a3 Compare December 12, 2025 17:33
@d-perl d-perl force-pushed the feat/681_procedure_hli branch from 9cd838a to 7ce805f Compare January 5, 2026 14:31
@d-perl d-perl force-pushed the feat/681_procedure_hli branch 8 times, most recently from 7ba475b to 0413bfa Compare January 6, 2026 13:53
@d-perl d-perl force-pushed the feat/681_procedure_hli branch 2 times, most recently from bf32bc2 to 1b9afa2 Compare January 6, 2026 15:30
Copy link
Contributor

@cappel89 cappel89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! A couple of minor comments. For me it worked good, although I was unable to start a procedure with "run_scan" through the CLI. Maybe we can check that briefly together tomorrow.

@d-perl d-perl force-pushed the feat/681_procedure_hli branch from 1b9afa2 to ef116b4 Compare January 8, 2026 09:35
and fix a few small errors
@d-perl d-perl force-pushed the feat/681_procedure_hli branch from ef116b4 to 78f5348 Compare January 8, 2026 09:39
@wakonig
Copy link
Contributor

wakonig commented Jan 8, 2026

as far as I understood from @d-perl, this PR would anyway soon be followed up with another PR to implement the multiprocess worker, replacing the inprocess one. If @cappel89 thinks his comments have been addressed, we should merge it

@d-perl
Copy link
Contributor Author

d-perl commented Jan 8, 2026

@wakonig that's right, I already started drafting it, I just didn't want to pile more stuff on this PR

@d-perl d-perl merged commit c625832 into main Jan 12, 2026
35 checks passed
@d-perl d-perl deleted the feat/681_procedure_hli branch January 12, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: Add high-level interface for launching procedures

4 participants