Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finite State Machine Representation - PoC #161

Open
3 tasks
Tracked by #164
cc-a opened this issue Oct 18, 2024 · 2 comments · May be fixed by #241
Open
3 tasks
Tracked by #164

Finite State Machine Representation - PoC #161

cc-a opened this issue Oct 18, 2024 · 2 comments · May be fixed by #241
Assignees
Labels
umbrella To group together multiple interrelated issues and track their progress

Comments

@cc-a
Copy link
Contributor

cc-a commented Oct 18, 2024

Requires #160.

Whilst we eventually want a nicely laid out and rendered representation of the Finite State Machine (FSM) we're going to focus here on the fundamental functionality and prettify things later. For this current work we can assume the FSM will be as documented in the drunc wiki - https://github.com/DUNE-DAQ/drunc/wiki/FSM - however future work may consider working with arbitrary FSM's that will be loaded from configuration.

This issue proposes a simple representation of the FSM:

  • a row of labels corresponding to the states of the FSM. The current state of the root controller (as reported by the gRPC interface) is highlighted in a different colour.
  • a row of buttons corresponding to the transitions of the FSM. The currently available transitions are enabled, all others are disabled. Clicking a button triggers a view function that executes the transition on the root controller (via the gRPC interface) then reloads the page.

You'll need to add relevant view functions and wrapper functions to the controller driver interface module (see #160) as you go.

Breakdown (by @dalonsoa )

This issue is actually bigger than planned, so breaking it down into smaller chunks:

@dalonsoa
Copy link
Collaborator

dalonsoa commented Oct 22, 2024

@dalonsoa dalonsoa self-assigned this Oct 22, 2024
@dalonsoa dalonsoa mentioned this issue Nov 6, 2024
10 tasks
@dalonsoa
Copy link
Collaborator

dalonsoa commented Nov 7, 2024

From the conversations in Teams:

Pierre said:

Oh I see what you mean. First, the root-controller will send the command to all of its children. The FSMCommand schema is here: https://github.com/DUNE-DAQ/druncschema/blob/develop/schema/druncschema/controller.proto#L24 you should only worry about the following fields:

  string command_name = 1; // the transition name
  map<string, google.protobuf.Any> arguments = 2; // the arguments

To get to know which commands are available, you can use describe_fsm with no arguments, that returns https://github.com/DUNE-DAQ/druncschema/blob/develop/schema/druncschema/controller.proto#L76 which contains a list of FSMCommandDescription accessible right now. For each FSMCommandDescription, you get the name of the command, and a list of arguments: https://github.com/DUNE-DAQ/druncschema/blob/develop/schema/druncschema/controller.proto#L72 that specify what you need the user to pass, in which format, and whether the argument is mandatory or not. So you can use that to create a dialog for the user to enter the arguments. This then gets collected in an FSMCommand that is what the execute_fsm_command takes as "argument" (not the best name, I agree, it should be fsm_command). You can see an example of the whole process in https://github.com/DUNE-DAQ/drunc/blob/develop/src/drunc/controller/interface/shell_utils.py#L256 for the CLI. Let me know if that makes sense, otherwise, we can have a quick phone call.

One of the other thing that you can do (which we do in the command line interface), if you want to know all the transitions a priori is the following:

transitions = controller_driver.describe_fsm(key="all-transitions").data

That will give you all the transitions (accessible right now or not), so you can build all the FSM command widgets (?) once. Then, you can use:

transitions_accessible = controller_driver.describe_fsm().data

To get only the transitions that are accessible right now, and expose the widgets that are in that list.

@dalonsoa dalonsoa added the umbrella To group together multiple interrelated issues and track their progress label Nov 8, 2024
@dalonsoa dalonsoa linked a pull request Nov 22, 2024 that will close this issue
10 tasks
@dalonsoa dalonsoa linked a pull request Nov 22, 2024 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
umbrella To group together multiple interrelated issues and track their progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants